layout: Remove wrong optimization when placing table among floats (#35207)

When we try to place a table next to some floats, and it doesn't fit
vertically, then we try again considering more floats. And as an
optimization we were using the previous width of the table as a minimum.
However, this was wrong, because the table might accept a smaller width
when the available space is smaller than beforehand.

Signed-off-by: Oriol Brufau <obrufau@igalia.com>
This commit is contained in:
Oriol Brufau 2025-01-29 07:54:52 -08:00 committed by GitHub
parent 53fcc98585
commit bc7cdab46f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 41 additions and 16 deletions

View file

@ -251,18 +251,6 @@ impl<'a> PlacementAmongFloats<'a> {
}
}
/// After placing a table and then laying it out, it may turn out wider than what
/// we initially expected. This method takes care of updating the data so that
/// the next place() can find the right area for the new size.
/// Note that if the new size is smaller, placement won't backtrack to consider
/// areas that weren't big enough for the old size.
pub(crate) fn set_inline_size(&mut self, inline_size: Au, pbm: &PaddingBorderMargin) {
self.object_size.inline = inline_size;
self.max_inline_end = (self.float_context.containing_block_info.inline_end -
pbm.margin.inline_end.auto_is(Au::zero))
.max(self.min_inline_start + inline_size);
}
/// After placing an object with `height: auto` (and using the minimum inline and
/// block size as the object size) and then laying it out, try to fit the object into
/// the current set of bands, given block size after layout and the available inline