diff --git a/components/style/gecko/conversions.rs b/components/style/gecko/conversions.rs index 2426bef42dc..8f3fb6bf2d0 100644 --- a/components/style/gecko/conversions.rs +++ b/components/style/gecko/conversions.rs @@ -102,6 +102,16 @@ impl From for LengthOrPercentage { } } +impl From for LengthOrPercentageOrAuto { + fn from(other: nsStyleCoord_CalcValue) -> LengthOrPercentageOrAuto { + match (other.mHasPercent, other.mLength) { + (false, _) => LengthOrPercentageOrAuto::Length(Au(other.mLength)), + (true, 0) => LengthOrPercentageOrAuto::Percentage(Percentage(other.mPercent)), + _ => LengthOrPercentageOrAuto::Calc(other.into()), + } + } +} + impl From for CoordDataValue { fn from(reference: Angle) -> Self { match reference { diff --git a/components/style/properties/gecko.mako.rs b/components/style/properties/gecko.mako.rs index 3b92e207129..af74593c536 100644 --- a/components/style/properties/gecko.mako.rs +++ b/components/style/properties/gecko.mako.rs @@ -3434,7 +3434,7 @@ fn static_assert() { LengthOrPercentageOrAuto::Auto } else { debug_assert!(ty == DimensionType::eLengthPercentage as u8); - LengthOrPercentageOrAuto::Calc(value.into()) + value.into() } }