diff --git a/components/style/properties/helpers/animated_properties.mako.rs b/components/style/properties/helpers/animated_properties.mako.rs index 6e8cefc74c5..d11f9bd271e 100644 --- a/components/style/properties/helpers/animated_properties.mako.rs +++ b/components/style/properties/helpers/animated_properties.mako.rs @@ -33,9 +33,9 @@ use std::fmt; use style_traits::ToCss; use super::ComputedValues; use values::CSSFloat; -use values::{Auto, Either, Normal, generics}; +use values::{Auto, Either, generics}; use values::computed::{Angle, LengthOrPercentageOrAuto, LengthOrPercentageOrNone}; -use values::computed::{BorderRadiusSize, ClipRect, LengthOrNone}; +use values::computed::{BorderRadiusSize, ClipRect}; use values::computed::{CalcLengthOrPercentage, Context, LengthOrPercentage}; use values::computed::{MaxLength, MinLength}; use values::computed::position::{HorizontalPosition, VerticalPosition}; @@ -630,20 +630,6 @@ impl Interpolate for Au { } } -impl Interpolate for Auto { - #[inline] - fn interpolate(&self, _other: &Self, _progress: f64) -> Result { - Ok(Auto) - } -} - -impl Interpolate for Normal { - #[inline] - fn interpolate(&self, _other: &Self, _progress: f64) -> Result { - Ok(Normal) - } -} - impl Interpolate for Option where T: Interpolate, { @@ -1110,16 +1096,6 @@ impl Interpolate for ClipRect { ${impl_interpolate_for_shadow('BoxShadow', 'CSSParserColor::RGBA(RGBA::transparent())',)} ${impl_interpolate_for_shadow('TextShadow', 'CSSParserColor::RGBA(RGBA::transparent())',)} -impl Interpolate for LengthOrNone { - fn interpolate(&self, other: &Self, progress: f64) -> Result { - match (*self, *other) { - (Either::First(ref length), Either::First(ref other)) => - length.interpolate(&other, progress).map(Either::First), - _ => Err(()), - } - } -} - /// Check if it's possible to do a direct numerical interpolation /// between these two transform lists. /// http://dev.w3.org/csswg/css-transforms/#transform-transform-animation @@ -2244,20 +2220,6 @@ impl ComputeDistance for Au { } } -impl ComputeDistance for Auto { - #[inline] - fn compute_distance(&self, _other: &Self) -> Result { - Err(()) - } -} - -impl ComputeDistance for Normal { - #[inline] - fn compute_distance(&self, _other: &Self) -> Result { - Err(()) - } -} - impl ComputeDistance for Option where T: ComputeDistance, { @@ -2529,18 +2491,6 @@ impl ComputeDistance for LengthOrPercentageOrNone { } } -impl ComputeDistance for LengthOrNone { - #[inline] - fn compute_distance(&self, other: &Self) -> Result { - match (*self, *other) { - (Either::First(ref length), Either::First(ref other)) => { - length.compute_distance(other) - }, - _ => Err(()), - } - } -} - impl ComputeDistance for MinLength { #[inline] fn compute_distance(&self, other: &Self) -> Result { diff --git a/components/style/values/mod.rs b/components/style/values/mod.rs index 430eac27419..01a774d138e 100644 --- a/components/style/values/mod.rs +++ b/components/style/values/mod.rs @@ -11,6 +11,7 @@ use Atom; pub use cssparser::{RGBA, Token, Parser, serialize_identifier, serialize_string}; use parser::{Parse, ParserContext}; +use properties::animated_properties::{ComputeDistance, Interpolate}; use std::ascii::AsciiExt; use std::borrow::Cow; use std::fmt::{self, Debug}; @@ -126,6 +127,20 @@ macro_rules! define_keyword_type { } } + impl Interpolate for $name { + #[inline] + fn interpolate(&self, _other: &Self, _progress: f64) -> Result { + Ok($name) + } + } + + impl ComputeDistance for $name { + #[inline] + fn compute_distance(&self, _other: &Self) -> Result { + Err(()) + } + } + impl fmt::Debug for $name { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, $css)