diff --git a/components/style/properties/helpers/animated_properties.mako.rs b/components/style/properties/helpers/animated_properties.mako.rs index b44bc15c4fc..6ce41696e64 100644 --- a/components/style/properties/helpers/animated_properties.mako.rs +++ b/components/style/properties/helpers/animated_properties.mako.rs @@ -789,7 +789,7 @@ impl ToAnimatedZero for AnimationValue { impl RepeatableListAnimatable for LengthOrPercentage {} impl RepeatableListAnimatable for Either {} impl RepeatableListAnimatable for Either {} -impl RepeatableListAnimatable for SvgLengthOrPercentageOrNumber {} +impl RepeatableListAnimatable for SvgLengthOrPercentageOrNumber {} macro_rules! repeated_vec_impl { ($($ty:ty),*) => { diff --git a/components/style/values/animated/mod.rs b/components/style/values/animated/mod.rs index 084dbc8bb6b..9272db6d22e 100644 --- a/components/style/values/animated/mod.rs +++ b/components/style/values/animated/mod.rs @@ -19,7 +19,6 @@ use values::computed::GreaterThanOrEqualToOneNumber as ComputedGreaterThanOrEqua use values::computed::MaxLength as ComputedMaxLength; use values::computed::MozLength as ComputedMozLength; use values::computed::NonNegativeLength as ComputedNonNegativeLength; -use values::computed::NonNegativeLengthOrPercentage as ComputedNonNegativeLengthOrPercentage; use values::computed::NonNegativeNumber as ComputedNonNegativeNumber; use values::specified::url::SpecifiedUrl; @@ -306,20 +305,6 @@ impl ToAnimatedValue for ComputedNonNegativeLength { } } -impl ToAnimatedValue for ComputedNonNegativeLengthOrPercentage { - type AnimatedValue = Self; - - #[inline] - fn to_animated_value(self) -> Self { - self - } - - #[inline] - fn from_animated_value(animated: Self::AnimatedValue) -> Self { - animated.0.clamp_to_non_negative().into() - } -} - impl ToAnimatedValue for ComputedBorderCornerRadius { type AnimatedValue = Self; diff --git a/components/style/values/computed/length.rs b/components/style/values/computed/length.rs index a9d211a235e..8c00d330222 100644 --- a/components/style/values/computed/length.rs +++ b/components/style/values/computed/length.rs @@ -14,7 +14,7 @@ use style_traits::{CssWriter, ToCss}; use style_traits::values::specified::AllowedNumericType; use super::{Number, ToComputedValue, Context, Percentage}; use values::{Auto, CSSFloat, Either, None_, Normal, specified}; -use values::animated::{Animate, Procedure, ToAnimatedZero}; +use values::animated::{Animate, Procedure, ToAnimatedValue, ToAnimatedZero}; use values::computed::NonNegativeNumber; use values::distance::{ComputeSquaredDistance, SquaredDistance}; use values::generics::NonNegative; @@ -664,6 +664,20 @@ impl ToComputedValue for specified::LengthOrPercentageOrNone { /// A wrapper of LengthOrPercentage, whose value must be >= 0. pub type NonNegativeLengthOrPercentage = NonNegative; +impl ToAnimatedValue for NonNegativeLengthOrPercentage { + type AnimatedValue = LengthOrPercentage; + + #[inline] + fn to_animated_value(self) -> Self::AnimatedValue { + self.into() + } + + #[inline] + fn from_animated_value(animated: Self::AnimatedValue) -> Self { + animated.clamp_to_non_negative().into() + } +} + impl From for NonNegativeLengthOrPercentage { #[inline] fn from(length: NonNegativeLength) -> Self {