layout: Change the IndefiniteContainingBlock sizes to Option<Au> (#35653)

Thus avoiding the need to convert to/from `AuOrAuto`.

Signed-off-by: Oriol Brufau <obrufau@igalia.com>
This commit is contained in:
Oriol Brufau 2025-02-25 15:24:29 +01:00 committed by GitHub
parent 31b2f81bc6
commit ebb19bcd60
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 19 additions and 37 deletions

View file

@ -898,19 +898,11 @@ impl SizeConstraint {
_ => None,
}
}
#[inline]
pub(crate) fn to_auto_or(self) -> AutoOr<Au> {
self.to_definite()
.map_or(AutoOr::Auto, AutoOr::LengthPercentage)
}
}
impl From<AuOrAuto> for SizeConstraint {
fn from(size: AuOrAuto) -> Self {
size.non_auto()
.map(SizeConstraint::Definite)
.unwrap_or_default()
impl From<Option<Au>> for SizeConstraint {
fn from(size: Option<Au>) -> Self {
size.map(SizeConstraint::Definite).unwrap_or_default()
}
}