Enable min-content, max-content, fit-content and stretch (#33492)

For the sizing properties.

We don't actually support them yet, just treating them as
the initial value.

Signed-off-by: Oriol Brufau <obrufau@igalia.com>
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
This commit is contained in:
Oriol Brufau 2024-09-20 16:48:27 +02:00 committed by GitHub
parent 4bde9af515
commit 9597390d2b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
66 changed files with 120 additions and 2798 deletions

View file

@ -48,11 +48,11 @@ impl AxisSize {
/// containing block size, min constraint, and max constraint
pub fn new(size: &Size, content_size: Option<Au>, min: &Size, max: &MaxSize) -> AxisSize {
match size {
Size::Auto => AxisSize::MinMax(SizeConstraint::new(content_size, min, max, None)),
Size::LengthPercentage(ref lp) => match lp.maybe_to_used_value(content_size) {
Some(length) => AxisSize::Definite(length),
None => AxisSize::Infinite,
},
_ => AxisSize::MinMax(SizeConstraint::new(content_size, min, max, None)),
}
}
}
@ -72,10 +72,7 @@ fn from_flex_basis(flex_basis: &FlexBasis, main_length: &Size, containing_length
_ => width,
};
match width {
Size::Auto => MaybeAuto::Auto,
Size::LengthPercentage(ref lp) => MaybeAuto::Specified(lp.to_used_value(containing_length)),
}
MaybeAuto::from_option(width.to_used_value(containing_length))
}
/// Represents a child in a flex container. Most fields here are used in