diff options
author | Martin Robinson <mrobinson@igalia.com> | 2025-03-25 10:41:59 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-03-25 09:41:59 +0000 |
commit | b4a768cfc7c4c4fdef5c6454aeb4a124f303d40d (patch) | |
tree | 6148d1e2cda20aa30cd8877b25591a87e7de81fb /components/layout_2020 | |
parent | b79a79458dcbd9e199c7ac3be649b3586fda80c7 (diff) | |
download | servo-b4a768cfc7c4c4fdef5c6454aeb4a124f303d40d.tar.gz servo-b4a768cfc7c4c4fdef5c6454aeb4a124f303d40d.zip |
layout: Ensure compatible positioning context during flexbox block content sizing calculation (#36123)
Sometimes column Flexbox needs to do an early layout pass to determine
the preferred block content size of flex items. Previously the
absolutely positioned children created during this pass were discarded,
but now they are cached to be possibly used during the final layout
phase of the flex item. Since they are not thrown away, it is necessary
that the `PositioningContext` used to collect them is compatible with
their final `PositioningContext`.
Fixes #36121.
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Diffstat (limited to 'components/layout_2020')
-rw-r--r-- | components/layout_2020/flexbox/layout.rs | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/components/layout_2020/flexbox/layout.rs b/components/layout_2020/flexbox/layout.rs index 880847617f6..f71f5da6915 100644 --- a/components/layout_2020/flexbox/layout.rs +++ b/components/layout_2020/flexbox/layout.rs @@ -2619,11 +2619,14 @@ impl FlexItemBox { auto_cross_size_stretches_to_container_size: bool, intrinsic_sizing_mode: IntrinsicSizingMode, ) -> Au { - let mut positioning_context = PositioningContext::new_for_subtree( - flex_context - .positioning_context - .collects_for_nearest_positioned_ancestor(), - ); + let mut positioning_context = PositioningContext::new_for_style(self.style()) + .unwrap_or_else(|| { + PositioningContext::new_for_subtree( + flex_context + .positioning_context + .collects_for_nearest_positioned_ancestor(), + ) + }); let style = self.independent_formatting_context.style(); match &self.independent_formatting_context.contents { |