diff options
author | Martin Robinson <mrobinson@igalia.com> | 2024-10-24 10:44:30 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-10-24 17:44:30 +0000 |
commit | 52db185568ca4dc49d28211f70b29aedecffaaf0 (patch) | |
tree | 4be1e80182425b3fa51e7d440a40dc6f59ca152d /components/layout_2020/flexbox/construct.rs | |
parent | 638b520186f30d66fefa5a687799093dec071306 (diff) | |
download | servo-52db185568ca4dc49d28211f70b29aedecffaaf0.tar.gz servo-52db185568ca4dc49d28211f70b29aedecffaaf0.zip |
layout: Avoid layout sometimes when stretching (#33967)
This is the second flexbox caching change. It seeks to detect when a
relayout can be avoided in the case of a stretching flex item. This
heuristic can be combined, because currently we still do relayout
sometimes when we do not need to.
For instance currently we always relayout when a flex child is itself a
column flex. This only needs to happen when the grandchildren themselves
grow or shrink. That optimization is perhaps a lower priority as
`flex-grow: 0 / flex-shrink: 1` is the default behavior for flex.
Since this change means we more consistenly zero out the percentage part
of `calc` expressions when they have circular dependencies, this causes one
test to start failing (`/css/css-values/calc-min-height-block-1.html`).
This is related to w3c/csswg-drafts#10969, which is pending on further
discussion in the working group.
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Co-authored-by: Oriol Brufau <obrufau@igalia.com>
Diffstat (limited to 'components/layout_2020/flexbox/construct.rs')
-rw-r--r-- | components/layout_2020/flexbox/construct.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/components/layout_2020/flexbox/construct.rs b/components/layout_2020/flexbox/construct.rs index d1d3580aace..c4c5ff57d60 100644 --- a/components/layout_2020/flexbox/construct.rs +++ b/components/layout_2020/flexbox/construct.rs @@ -181,7 +181,7 @@ where independent_formatting_context: IndependentFormattingContext::NonReplaced( non_replaced, ), - cached_layout: Default::default(), + block_content_size_cache: Default::default(), }))) }, FlexLevelJob::Element { @@ -213,7 +213,7 @@ where contents, self.text_decoration_line, ), - cached_layout: Default::default(), + block_content_size_cache: Default::default(), })) }; box_slot.set(LayoutBox::FlexLevel(box_.clone())); |