diff options
Diffstat (limited to 'components/style/properties/helpers.mako.rs')
-rw-r--r-- | components/style/properties/helpers.mako.rs | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/components/style/properties/helpers.mako.rs b/components/style/properties/helpers.mako.rs index 23398a9729e..de63e97ee90 100644 --- a/components/style/properties/helpers.mako.rs +++ b/components/style/properties/helpers.mako.rs @@ -1090,6 +1090,23 @@ #[cfg_attr(feature = "servo", derive(HeapSizeOf))] pub struct SpecifiedValue(pub ${length_type}); + % if length_type == "MozLength": + impl SpecifiedValue { + /// Returns the `auto` value. + pub fn auto() -> Self { + use values::specified::length::LengthOrPercentageOrAuto; + SpecifiedValue(MozLength::LengthOrPercentageOrAuto(LengthOrPercentageOrAuto::Auto)) + } + + /// Returns a value representing a `0` length. + pub fn zero() -> Self { + use values::specified::length::{LengthOrPercentageOrAuto, NoCalcLength}; + SpecifiedValue(MozLength::LengthOrPercentageOrAuto( + LengthOrPercentageOrAuto::Length(NoCalcLength::zero()))) + } + } + % endif + #[inline] pub fn get_initial_value() -> computed_value::T { use values::computed::${length_type}; |