From 3a3c3aeb7548db10a6ef16ca988fb573dd349303 Mon Sep 17 00:00:00 2001 From: Oriol Brufau Date: Wed, 19 Mar 2025 09:52:35 +0100 Subject: [PATCH] layout: Don't consider a definite `stretch` size as intrinsic (#36045) `block_size_is_zero_or_intrinsic()` was always returning true for `stretch`. This function is used for the margin collapse heuristics in block layout, so we were considering that an empty element with `height: stretch` would self-collapse. Signed-off-by: Oriol Brufau --- components/layout_2020/flow/mod.rs | 12 +++++++----- .../css/css-sizing/stretch/block-height-009.html.ini | 2 -- 2 files changed, 7 insertions(+), 7 deletions(-) delete mode 100644 tests/wpt/meta/css/css-sizing/stretch/block-height-009.html.ini diff --git a/components/layout_2020/flow/mod.rs b/components/layout_2020/flow/mod.rs index 477093f164b..898f2d00500 100644 --- a/components/layout_2020/flow/mod.rs +++ b/components/layout_2020/flow/mod.rs @@ -2144,11 +2144,13 @@ impl<'container> PlacementState<'container> { fn block_size_is_zero_or_intrinsic(size: &StyleSize, containing_block: &ContainingBlock) -> bool { match size { - StyleSize::Auto | - StyleSize::MinContent | - StyleSize::MaxContent | - StyleSize::FitContent | - StyleSize::Stretch => true, + StyleSize::Auto | StyleSize::MinContent | StyleSize::MaxContent | StyleSize::FitContent => { + true + }, + StyleSize::Stretch => { + // TODO: Should this return true when the containing block has a definite size of 0px? + !containing_block.size.block.is_definite() + }, StyleSize::LengthPercentage(lp) => { // TODO: Should this resolve definite percentages? Blink does it, Gecko and WebKit don't. lp.is_definitely_zero() || diff --git a/tests/wpt/meta/css/css-sizing/stretch/block-height-009.html.ini b/tests/wpt/meta/css/css-sizing/stretch/block-height-009.html.ini deleted file mode 100644 index 33772d1d1fb..00000000000 --- a/tests/wpt/meta/css/css-sizing/stretch/block-height-009.html.ini +++ /dev/null @@ -1,2 +0,0 @@ -[block-height-009.html] - expected: FAIL