diff --git a/components/style/values/animated/effects.rs b/components/style/values/animated/effects.rs index 4e3aeb4fde8..c1ce7fd6bed 100644 --- a/components/style/values/animated/effects.rs +++ b/components/style/values/animated/effects.rs @@ -13,7 +13,7 @@ use values::Impossible; use values::animated::{Animate, Procedure, ToAnimatedValue, ToAnimatedZero}; use values::animated::color::RGBA; use values::computed::{Angle, Number}; -use values::computed::length::{Length, NonNegativeLength}; +use values::computed::length::Length; use values::distance::{ComputeSquaredDistance, SquaredDistance}; use values::generics::effects::BoxShadow as GenericBoxShadow; use values::generics::effects::Filter as GenericFilter; @@ -33,7 +33,7 @@ pub type TextShadowList = ShadowList; pub struct ShadowList(Vec); /// An animated value for a single `box-shadow`. -pub type BoxShadow = GenericBoxShadow, Length, NonNegativeLength, Length>; +pub type BoxShadow = GenericBoxShadow, Length, Length, Length>; /// An animated value for the `filter` property. #[cfg_attr(feature = "servo", derive(MallocSizeOf))] @@ -42,14 +42,14 @@ pub struct FilterList(pub Vec); /// An animated value for a single `filter`. #[cfg(feature = "gecko")] -pub type Filter = GenericFilter; +pub type Filter = GenericFilter; /// An animated value for a single `filter`. #[cfg(not(feature = "gecko"))] -pub type Filter = GenericFilter; +pub type Filter = GenericFilter; /// An animated value for the `drop-shadow()` filter. -pub type SimpleShadow = GenericSimpleShadow, Length, NonNegativeLength>; +pub type SimpleShadow = GenericSimpleShadow, Length, Length>; impl ToAnimatedValue for ComputedBoxShadowList { type AnimatedValue = BoxShadowList; diff --git a/components/style/values/animated/mod.rs b/components/style/values/animated/mod.rs index a118292dd98..04bab7375f1 100644 --- a/components/style/values/animated/mod.rs +++ b/components/style/values/animated/mod.rs @@ -17,7 +17,6 @@ use values::computed::BorderCornerRadius as ComputedBorderCornerRadius; use values::computed::ComputedUrl; use values::computed::MaxLength as ComputedMaxLength; use values::computed::MozLength as ComputedMozLength; -use values::computed::NonNegativeLength as ComputedNonNegativeLength; use values::specified::url::SpecifiedUrl; pub mod color; @@ -261,20 +260,6 @@ trivial_to_animated_value!(ComputedUrl); trivial_to_animated_value!(bool); trivial_to_animated_value!(f32); -impl ToAnimatedValue for ComputedNonNegativeLength { - type AnimatedValue = Self; - - #[inline] - fn to_animated_value(self) -> Self { - self - } - - #[inline] - fn from_animated_value(animated: Self::AnimatedValue) -> Self { - ComputedNonNegativeLength::new(animated.px().max(0.)) - } -} - impl ToAnimatedValue for ComputedBorderCornerRadius { type AnimatedValue = Self; diff --git a/components/style/values/computed/length.rs b/components/style/values/computed/length.rs index 8c00d330222..b482c8aeb17 100644 --- a/components/style/values/computed/length.rs +++ b/components/style/values/computed/length.rs @@ -815,6 +815,20 @@ pub type LengthOrNormal = Either; /// A wrapper of Length, whose value must be >= 0. pub type NonNegativeLength = NonNegative; +impl ToAnimatedValue for NonNegativeLength { + type AnimatedValue = Length; + + #[inline] + fn to_animated_value(self) -> Self::AnimatedValue { + self.0 + } + + #[inline] + fn from_animated_value(animated: Self::AnimatedValue) -> Self { + NonNegativeLength::new(animated.px().max(0.)) + } +} + impl NonNegativeLength { /// Create a NonNegativeLength. #[inline]