mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-18 08:20:44 +00:00
LibWeb: Cache "has size containment" flag in Layout::Box
Allows us to avoid DOM node lookup whenever we need to query natural size of a box during layout. Makes 3-4% of `Box::preferred_aspect_ratio()` go away from profiles on www.nyan.cat
This commit is contained in:
parent
693fe76d1c
commit
7cae4fadbc
Notes:
github-actions[bot]
2025-03-26 17:53:01 +00:00
Author: https://github.com/kalenikaliaksandr
Commit: 7cae4fadbc
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4104
Reviewed-by: https://github.com/gmta ✅
3 changed files with 11 additions and 6 deletions
|
@ -40,6 +40,9 @@ public:
|
|||
bool has_natural_height() const { return natural_height().has_value(); }
|
||||
bool has_natural_aspect_ratio() const { return natural_aspect_ratio().has_value(); }
|
||||
|
||||
bool has_size_containment() const { return m_has_size_containment; }
|
||||
void set_has_size_containment(bool value) { m_has_size_containment = value; }
|
||||
|
||||
void set_natural_width(Optional<CSSPixels> width) { m_natural_width = width; }
|
||||
void set_natural_height(Optional<CSSPixels> height) { m_natural_height = height; }
|
||||
void set_natural_aspect_ratio(Optional<CSSPixelFraction> ratio) { m_natural_aspect_ratio = ratio; }
|
||||
|
@ -79,6 +82,8 @@ private:
|
|||
Optional<CSSPixels> m_natural_height;
|
||||
Optional<CSSPixelFraction> m_natural_aspect_ratio;
|
||||
|
||||
bool m_has_size_containment { false };
|
||||
|
||||
Vector<GC::Ref<Node>> m_contained_abspos_children;
|
||||
|
||||
OwnPtr<IntrinsicSizes> mutable m_cached_intrinsic_sizes;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue