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>
This commit is contained in:
Oriol Brufau 2025-03-19 09:52:35 +01:00 committed by GitHub
parent 6be7612d16
commit 3a3c3aeb75
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 7 additions and 7 deletions

View file

@ -2144,11 +2144,13 @@ impl<'container> PlacementState<'container> {
fn block_size_is_zero_or_intrinsic(size: &StyleSize, containing_block: &ContainingBlock) -> bool { fn block_size_is_zero_or_intrinsic(size: &StyleSize, containing_block: &ContainingBlock) -> bool {
match size { match size {
StyleSize::Auto | StyleSize::Auto | StyleSize::MinContent | StyleSize::MaxContent | StyleSize::FitContent => {
StyleSize::MinContent | true
StyleSize::MaxContent | },
StyleSize::FitContent | StyleSize::Stretch => {
StyleSize::Stretch => true, // TODO: Should this return true when the containing block has a definite size of 0px?
!containing_block.size.block.is_definite()
},
StyleSize::LengthPercentage(lp) => { StyleSize::LengthPercentage(lp) => {
// TODO: Should this resolve definite percentages? Blink does it, Gecko and WebKit don't. // TODO: Should this resolve definite percentages? Blink does it, Gecko and WebKit don't.
lp.is_definitely_zero() || lp.is_definitely_zero() ||

View file

@ -1,2 +0,0 @@
[block-height-009.html]
expected: FAIL