layout: Allow lazy resolution of automatic minimum sizes (#35965)

`Size::resolve_for_min()` had an `Au` parameter, representing the value
to be used for an automatic minimum size. However, this amount isn't
trivial to compute in flexbox, so this patch changes the parameter to a
function that can be called lazily.

Note flexbox isn't currently using `Size::resolve_for_min()`, but it
will in #35961.

Signed-off-by: Oriol Brufau <obrufau@igalia.com>
This commit is contained in:
Oriol Brufau 2025-03-13 23:50:16 +01:00 committed by GitHub
parent 62d6759106
commit 7cf2fc88a0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 20 additions and 20 deletions

View file

@ -1715,7 +1715,7 @@ impl InitialFlexLineLayout<'_> {
item.item.content_cross_sizes.resolve(
axis,
Size::Stretch,
Au::zero(),
Au::zero,
Some(final_line_cross_size - item.item.pbm_auto_is_zero.cross),
|| content_size.into(),
// Tables have a special sizing in the block axis in that handles collapsed rows,
@ -1966,7 +1966,7 @@ impl FlexItem<'_> {
self.content_cross_sizes.resolve(
Direction::Inline,
automatic_size,
Au::zero(),
Au::zero,
Some(stretch_size),
get_content_size,
self.is_table(),
@ -2117,7 +2117,7 @@ impl FlexItem<'_> {
self.content_cross_sizes.resolve(
Direction::Block,
Size::FitContent,
Au::zero(),
Au::zero,
stretch_size,
|| content_block_size.into(),
self.is_table(),