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 { diff --git a/tests/wpt/meta/MANIFEST.json b/tests/wpt/meta/MANIFEST.json index 117f1af832b..522021d0a9c 100644 --- a/tests/wpt/meta/MANIFEST.json +++ b/tests/wpt/meta/MANIFEST.json @@ -2599,6 +2599,13 @@ {} ] ], + "mixed-containing-blocks-crash.html": [ + "f8a38e057d32e8bb8d7e143d867ca6364210ba38", + [ + null, + {} + ] + ], "negative-available-size-crash.html": [ "837fdaeba9ef8baeb4f2bad281bb13551d6d8ff9", [ diff --git a/tests/wpt/tests/css/css-flexbox/mixed-containing-blocks-crash.html b/tests/wpt/tests/css/css-flexbox/mixed-containing-blocks-crash.html new file mode 100644 index 00000000000..f8a38e057d3 --- /dev/null +++ b/tests/wpt/tests/css/css-flexbox/mixed-containing-blocks-crash.html @@ -0,0 +1,13 @@ + +CSS Flexbox: Mixed containing blocks + + + + + + +
+
Three
fixed
+
+ +