diff options
author | Oriol Brufau <obrufau@igalia.com> | 2025-03-19 09:52:35 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-03-19 08:52:35 +0000 |
commit | 3a3c3aeb7548db10a6ef16ca988fb573dd349303 (patch) | |
tree | 41f4f8aba9284da9aad11784e262f58ab8eaf8dd /components/layout_2020 | |
parent | 6be7612d165ab15b5df383fb378633b707a6f782 (diff) | |
download | servo-3a3c3aeb7548db10a6ef16ca988fb573dd349303.tar.gz servo-3a3c3aeb7548db10a6ef16ca988fb573dd349303.zip |
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 <obrufau@igalia.com>
Diffstat (limited to 'components/layout_2020')
-rw-r--r-- | components/layout_2020/flow/mod.rs | 12 |
1 files changed, 7 insertions, 5 deletions
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() || |