layout: Support stretch cross size for automatic min size in flexbox (#35652)

The computation of the automatic minimum size may involve transferring
a definite cross size into the main axis through the aspect ratio.
We were only considering numeric sizes as definite, but `stretch` can
also be definite.

Signed-off-by: Oriol Brufau <obrufau@igalia.com>
This commit is contained in:
Oriol Brufau 2025-02-26 17:30:36 +01:00 committed by GitHub
parent 9d5171f3c5
commit 6aae4df909
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 93 additions and 5 deletions

View file

@ -2530,14 +2530,16 @@ impl FlexItemBox {
Direction::Block
};
let cross_stretch_size = containing_block_size
.cross
.map(|v| v - pbm_auto_is_zero.cross);
let cross_size = SizeConstraint::new(
if content_box_size.cross.is_initial() && auto_cross_size_stretches_to_container_size {
containing_block_size
.cross
.map(|v| v - pbm_auto_is_zero.cross)
cross_stretch_size
} else {
// TODO(#32853): handle size keywords.
content_box_size.cross.to_numeric()
content_box_size
.cross
.maybe_resolve_extrinsic(cross_stretch_size)
},
min_size.cross.auto_is(Au::zero),
max_size.cross,