layout: Unify logic for laying out replaced and non-replaced in a BFC (#37864)

The logic for laying out block-level replaced elements wasn't taking
floats into account when resolving a `stretch` inline size. By handling
them with the same logic as non-replaced elements, we fix that problem,
and reduce the amount of code.

Testing: Adding new tests
Fixes: #37861

Signed-off-by: Oriol Brufau <obrufau@igalia.com>
This commit is contained in:
Oriol Brufau 2025-07-04 19:47:40 +02:00 committed by GitHub
parent 72b1331949
commit 4ee7a34f32
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 257 additions and 252 deletions

View file

@ -2147,7 +2147,7 @@ impl FlexItem<'_> {
#[inline]
fn is_table(&self) -> bool {
self.box_.is_table()
self.box_.independent_formatting_context.is_table()
}
}
@ -2225,7 +2225,7 @@ impl FlexItemBox {
.map(|v| Au::zero().max(v - pbm_auto_is_zero.cross)),
};
let is_table = self.is_table();
let is_table = self.independent_formatting_context.is_table();
let tentative_cross_content_size = if cross_axis_is_item_block_axis {
self.independent_formatting_context
.tentative_block_content_size(preferred_aspect_ratio)
@ -2718,12 +2718,4 @@ impl FlexItemBox {
},
}
}
#[inline]
fn is_table(&self) -> bool {
match &self.independent_formatting_context.contents {
IndependentFormattingContextContents::NonReplaced(content) => content.is_table(),
IndependentFormattingContextContents::Replaced(_) => false,
}
}
}