diff options
author | sin-ack <sin-ack@users.noreply.github.com> | 2022-09-18 16:37:51 +0000 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2022-09-18 18:55:06 +0200 |
commit | e9d5d2f74b8c8442fde9d2fd783c035e54f01ead (patch) | |
tree | d8d19385e56b5f45f6e18f2d79c2f088bf24db47 /Userland | |
parent | 97b5230413f85fad22c05578f1d41c039a039617 (diff) | |
download | serenity-e9d5d2f74b8c8442fde9d2fd783c035e54f01ead.zip |
LibWeb: Remove the flex item size cache
This was overly permissive as the FIXME stated and was causing layout
issues.
Diffstat (limited to 'Userland')
-rw-r--r-- | Userland/Libraries/LibWeb/Layout/FlexFormattingContext.cpp | 11 | ||||
-rw-r--r-- | Userland/Libraries/LibWeb/Layout/LayoutState.h | 2 |
2 files changed, 1 insertions, 12 deletions
diff --git a/Userland/Libraries/LibWeb/Layout/FlexFormattingContext.cpp b/Userland/Libraries/LibWeb/Layout/FlexFormattingContext.cpp index 0623e43956..cc6a319356 100644 --- a/Userland/Libraries/LibWeb/Layout/FlexFormattingContext.cpp +++ b/Userland/Libraries/LibWeb/Layout/FlexFormattingContext.cpp @@ -713,16 +713,7 @@ void FlexFormattingContext::determine_flex_base_size_and_hypothetical_main_size( if (has_definite_main_size(child_box)) return resolved_definite_main_size(flex_item); - // NOTE: To avoid repeated layout work, we keep a cache of flex item main sizes on the - // root LayoutState object. It's available through a full layout cycle. - // FIXME: Make sure this cache isn't overly permissive.. - auto& size_cache = m_state.m_root.flex_item_size_cache; - auto it = size_cache.find(&flex_item.box); - if (it != size_cache.end()) - return it->value; - auto main_size = calculate_indefinite_main_size(flex_item); - size_cache.set(&flex_item.box, main_size); - return main_size; + return calculate_indefinite_main_size(flex_item); }(); // The hypothetical main size is the itemโs flex base size clamped according to its used min and max main sizes (and flooring the content box size at zero). diff --git a/Userland/Libraries/LibWeb/Layout/LayoutState.h b/Userland/Libraries/LibWeb/Layout/LayoutState.h index d7b3ec01a1..091e79dee2 100644 --- a/Userland/Libraries/LibWeb/Layout/LayoutState.h +++ b/Userland/Libraries/LibWeb/Layout/LayoutState.h @@ -148,8 +148,6 @@ struct LayoutState { HashMap<NodeWithStyleAndBoxModelMetrics const*, NonnullOwnPtr<IntrinsicSizes>> mutable intrinsic_sizes; - HashMap<Box const*, float> mutable flex_item_size_cache; - LayoutState const* m_parent { nullptr }; LayoutState const& m_root; }; |