From 4d25e87ac6b23334b91a3e8a5cfbd9aa58f941f3 Mon Sep 17 00:00:00 2001 From: Brian Birtles Date: Wed, 10 May 2017 13:38:06 +0900 Subject: [PATCH] Rename the Interpolate trait to Animatable --- components/style/properties/helpers.mako.rs | 10 +- .../helpers/animated_properties.mako.rs | 120 +++++++++--------- .../properties/longhand/background.mako.rs | 7 +- .../style/properties/longhand/box.mako.rs | 4 +- .../style/properties/longhand/font.mako.rs | 4 +- .../longhand/inherited_table.mako.rs | 4 +- .../longhand/inherited_text.mako.rs | 8 +- .../style/properties/longhand/svg.mako.rs | 12 +- components/style/values/mod.rs | 4 +- ports/geckolib/glue.rs | 2 +- tests/unit/style/animated_properties.rs | 2 +- 11 files changed, 89 insertions(+), 88 deletions(-) diff --git a/components/style/properties/helpers.mako.rs b/components/style/properties/helpers.mako.rs index 9f89abda857..66b0e3f720a 100644 --- a/components/style/properties/helpers.mako.rs +++ b/components/style/properties/helpers.mako.rs @@ -111,8 +111,8 @@ pub struct T(pub SmallVec<[single_value::T; 1]>); % if delegate_animate: - use properties::animated_properties::Interpolate; - impl Interpolate for T { + use properties::animated_properties::Animatable; + impl Animatable for T { fn interpolate(&self, other: &Self, progress: f64) -> Result { self.0.interpolate(&other.0, progress).map(T) } @@ -974,10 +974,10 @@ %> -/// Macro for defining Interpolate trait for tuple struct which has Option, +/// Macro for defining Animatable trait for tuple struct which has Option, /// e.g. struct T(pub Option). -<%def name="impl_interpolate_for_option_tuple(value_for_none)"> - impl Interpolate for T { +<%def name="impl_animatable_for_option_tuple(value_for_none)"> + impl Animatable for T { #[inline] fn interpolate(&self, other: &Self, progress: f64) -> Result { match (self, other) { diff --git a/components/style/properties/helpers/animated_properties.mako.rs b/components/style/properties/helpers/animated_properties.mako.rs index 8767f78102f..732b528fff1 100644 --- a/components/style/properties/helpers/animated_properties.mako.rs +++ b/components/style/properties/helpers/animated_properties.mako.rs @@ -581,7 +581,7 @@ impl AnimationValue { } } -impl Interpolate for AnimationValue { +impl Animatable for AnimationValue { fn interpolate(&self, other: &Self, progress: f64) -> Result { match (self, other) { % for prop in data.longhands: @@ -613,17 +613,17 @@ impl Interpolate for AnimationValue { /// A trait used to implement [interpolation][interpolated-types]. /// /// [interpolated-types]: https://drafts.csswg.org/css-transitions/#interpolated-types -pub trait Interpolate: Sized { +pub trait Animatable: Sized { /// Interpolate a value with another for a given property. fn interpolate(&self, other: &Self, progress: f64) -> Result; } /// https://drafts.csswg.org/css-transitions/#animtype-repeatable-list -pub trait RepeatableListInterpolate: Interpolate {} +pub trait RepeatableListAnimatable: Animatable {} -impl RepeatableListInterpolate for Either {} +impl RepeatableListAnimatable for Either {} -impl Interpolate for SmallVec<[T; 1]> { +impl Animatable for SmallVec<[T; 1]> { fn interpolate(&self, other: &Self, progress: f64) -> Result { use num_integer::lcm; let len = lcm(self.len(), other.len()); @@ -634,15 +634,15 @@ impl Interpolate for SmallVec<[T; 1]> { } /// https://drafts.csswg.org/css-transitions/#animtype-number -impl Interpolate for Au { +impl Animatable for Au { #[inline] fn interpolate(&self, other: &Self, progress: f64) -> Result { Ok(Au((self.0 as f64 + (other.0 as f64 - self.0 as f64) * progress).round() as i32)) } } -impl Interpolate for Option - where T: Interpolate, +impl Animatable for Option + where T: Animatable, { #[inline] fn interpolate(&self, other: &Option, progress: f64) -> Result, ()> { @@ -656,7 +656,7 @@ impl Interpolate for Option } /// https://drafts.csswg.org/css-transitions/#animtype-number -impl Interpolate for f32 { +impl Animatable for f32 { #[inline] fn interpolate(&self, other: &f32, progress: f64) -> Result { Ok(((*self as f64) + ((*other as f64) - (*self as f64)) * progress) as f32) @@ -664,7 +664,7 @@ impl Interpolate for f32 { } /// https://drafts.csswg.org/css-transitions/#animtype-number -impl Interpolate for f64 { +impl Animatable for f64 { #[inline] fn interpolate(&self, other: &f64, progress: f64) -> Result { Ok(*self + (*other - *self) * progress) @@ -672,7 +672,7 @@ impl Interpolate for f64 { } /// https://drafts.csswg.org/css-transitions/#animtype-integer -impl Interpolate for i32 { +impl Animatable for i32 { #[inline] fn interpolate(&self, other: &i32, progress: f64) -> Result { let a = *self as f64; @@ -682,7 +682,7 @@ impl Interpolate for i32 { } /// https://drafts.csswg.org/css-transitions/#animtype-number -impl Interpolate for Angle { +impl Animatable for Angle { #[inline] fn interpolate(&self, other: &Angle, progress: f64) -> Result { self.radians().interpolate(&other.radians(), progress).map(Angle::from_radians) @@ -690,7 +690,7 @@ impl Interpolate for Angle { } /// https://drafts.csswg.org/css-transitions/#animtype-visibility -impl Interpolate for Visibility { +impl Animatable for Visibility { #[inline] fn interpolate(&self, other: &Self, progress: f64) -> Result { match (*self, *other) { @@ -708,7 +708,7 @@ impl Interpolate for Visibility { } } -impl Interpolate for Size2D { +impl Animatable for Size2D { #[inline] fn interpolate(&self, other: &Self, progress: f64) -> Result { let width = try!(self.width.interpolate(&other.width, progress)); @@ -718,7 +718,7 @@ impl Interpolate for Size2D { } } -impl Interpolate for Point2D { +impl Animatable for Point2D { #[inline] fn interpolate(&self, other: &Self, progress: f64) -> Result { let x = try!(self.x.interpolate(&other.x, progress)); @@ -728,7 +728,7 @@ impl Interpolate for Point2D { } } -impl Interpolate for BorderRadiusSize { +impl Animatable for BorderRadiusSize { #[inline] fn interpolate(&self, other: &Self, progress: f64) -> Result { self.0.interpolate(&other.0, progress).map(generics::BorderRadiusSize) @@ -736,7 +736,7 @@ impl Interpolate for BorderRadiusSize { } /// https://drafts.csswg.org/css-transitions/#animtype-length -impl Interpolate for VerticalAlign { +impl Animatable for VerticalAlign { #[inline] fn interpolate(&self, other: &Self, progress: f64) -> Result { match (*self, *other) { @@ -751,7 +751,7 @@ impl Interpolate for VerticalAlign { } } -impl Interpolate for BackgroundSizeList { +impl Animatable for BackgroundSizeList { #[inline] fn interpolate(&self, other: &Self, progress: f64) -> Result { self.0.interpolate(&other.0, progress).map(BackgroundSizeList) @@ -759,7 +759,7 @@ impl Interpolate for BackgroundSizeList { } /// https://drafts.csswg.org/css-transitions/#animtype-color -impl Interpolate for RGBA { +impl Animatable for RGBA { #[inline] fn interpolate(&self, other: &RGBA, progress: f64) -> Result { fn clamp(val: f32) -> f32 { @@ -786,7 +786,7 @@ impl Interpolate for RGBA { } /// https://drafts.csswg.org/css-transitions/#animtype-color -impl Interpolate for CSSParserColor { +impl Animatable for CSSParserColor { #[inline] fn interpolate(&self, other: &Self, progress: f64) -> Result { match (*self, *other) { @@ -799,14 +799,14 @@ impl Interpolate for CSSParserColor { } /// https://drafts.csswg.org/css-transitions/#animtype-lpcalc -impl Interpolate for CalcLengthOrPercentage { +impl Animatable for CalcLengthOrPercentage { #[inline] fn interpolate(&self, other: &Self, progress: f64) -> Result { fn interpolate_half(this: Option, other: Option, progress: f64) -> Result, ()> - where T: Default + Interpolate, + where T: Default + Animatable, { match (this, other) { (None, None) => Ok(None), @@ -826,7 +826,7 @@ impl Interpolate for CalcLengthOrPercentage { } /// https://drafts.csswg.org/css-transitions/#animtype-lpcalc -impl Interpolate for LengthOrPercentage { +impl Animatable for LengthOrPercentage { #[inline] fn interpolate(&self, other: &Self, progress: f64) -> Result { match (*self, *other) { @@ -849,7 +849,7 @@ impl Interpolate for LengthOrPercentage { } /// https://drafts.csswg.org/css-transitions/#animtype-lpcalc -impl Interpolate for LengthOrPercentageOrAuto { +impl Animatable for LengthOrPercentageOrAuto { #[inline] fn interpolate(&self, other: &Self, progress: f64) -> Result { match (*self, *other) { @@ -877,7 +877,7 @@ impl Interpolate for LengthOrPercentageOrAuto { } /// https://drafts.csswg.org/css-transitions/#animtype-lpcalc -impl Interpolate for LengthOrPercentageOrNone { +impl Animatable for LengthOrPercentageOrNone { #[inline] fn interpolate(&self, other: &Self, progress: f64) -> Result { match (*self, *other) { @@ -898,7 +898,7 @@ impl Interpolate for LengthOrPercentageOrNone { } /// https://drafts.csswg.org/css-transitions/#animtype-lpcalc -impl Interpolate for MinLength { +impl Animatable for MinLength { #[inline] fn interpolate(&self, other: &Self, progress: f64) -> Result { match (*self, *other) { @@ -912,7 +912,7 @@ impl Interpolate for MinLength { } /// https://drafts.csswg.org/css-transitions/#animtype-lpcalc -impl Interpolate for MaxLength { +impl Animatable for MaxLength { #[inline] fn interpolate(&self, other: &Self, progress: f64) -> Result { match (*self, *other) { @@ -927,7 +927,7 @@ impl Interpolate for MaxLength { /// https://drafts.csswg.org/css-transitions/#animtype-number /// https://drafts.csswg.org/css-transitions/#animtype-length -impl Interpolate for LineHeight { +impl Animatable for LineHeight { #[inline] fn interpolate(&self, other: &Self, progress: f64) -> Result { match (*self, *other) { @@ -948,7 +948,7 @@ impl Interpolate for LineHeight { } /// http://dev.w3.org/csswg/css-transitions/#animtype-font-weight -impl Interpolate for FontWeight { +impl Animatable for FontWeight { #[inline] fn interpolate(&self, other: &Self, progress: f64) -> Result { let a = (*self as u32) as f64; @@ -977,7 +977,7 @@ impl Interpolate for FontWeight { } /// https://drafts.csswg.org/css-transitions/#animtype-simple-list -impl Interpolate for generic_position::Position { +impl Animatable for generic_position::Position { #[inline] fn interpolate(&self, other: &Self, progress: f64) -> Result { Ok(generic_position::Position { @@ -987,31 +987,31 @@ impl Interpolate for generic_position::Position< } } -impl RepeatableListInterpolate for generic_position::Position - where H: RepeatableListInterpolate, V: RepeatableListInterpolate {} +impl RepeatableListAnimatable for generic_position::Position + where H: RepeatableListAnimatable, V: RepeatableListAnimatable {} /// https://drafts.csswg.org/css-transitions/#animtype-simple-list -impl Interpolate for HorizontalPosition { +impl Animatable for HorizontalPosition { #[inline] fn interpolate(&self, other: &Self, progress: f64) -> Result { self.0.interpolate(&other.0, progress).map(generic_position::HorizontalPosition) } } -impl RepeatableListInterpolate for HorizontalPosition {} +impl RepeatableListAnimatable for HorizontalPosition {} /// https://drafts.csswg.org/css-transitions/#animtype-simple-list -impl Interpolate for VerticalPosition { +impl Animatable for VerticalPosition { #[inline] fn interpolate(&self, other: &Self, progress: f64) -> Result { self.0.interpolate(&other.0, progress).map(generic_position::VerticalPosition) } } -impl RepeatableListInterpolate for VerticalPosition {} +impl RepeatableListAnimatable for VerticalPosition {} /// https://drafts.csswg.org/css-transitions/#animtype-rect -impl Interpolate for ClipRect { +impl Animatable for ClipRect { #[inline] fn interpolate(&self, other: &Self, time: f64) -> Result { Ok(ClipRect { @@ -1023,8 +1023,8 @@ impl Interpolate for ClipRect { } } -<%def name="impl_interpolate_for_shadow(item, transparent_color)"> - impl Interpolate for ${item} { +<%def name="impl_animatable_for_shadow(item, transparent_color)"> + impl Animatable for ${item} { #[inline] fn interpolate(&self, other: &Self, progress: f64) -> Result { % if "Box" in item: @@ -1056,7 +1056,7 @@ impl Interpolate for ClipRect { } /// https://drafts.csswg.org/css-transitions/#animtype-shadow-list - impl Interpolate for ${item}List { + impl Animatable for ${item}List { #[inline] fn interpolate(&self, other: &Self, progress: f64) -> Result { // The inset value must change @@ -1109,8 +1109,8 @@ impl Interpolate for ClipRect { } -${impl_interpolate_for_shadow('BoxShadow', 'CSSParserColor::RGBA(RGBA::transparent())',)} -${impl_interpolate_for_shadow('TextShadow', 'CSSParserColor::RGBA(RGBA::transparent())',)} +${impl_animatable_for_shadow('BoxShadow', 'CSSParserColor::RGBA(RGBA::transparent())',)} +${impl_animatable_for_shadow('TextShadow', 'CSSParserColor::RGBA(RGBA::transparent())',)} /// Check if it's possible to do a direct numerical interpolation /// between these two transform lists. @@ -1321,7 +1321,7 @@ pub struct MatrixDecomposed2D { pub matrix: InnerMatrix2D, } -impl Interpolate for InnerMatrix2D { +impl Animatable for InnerMatrix2D { fn interpolate(&self, other: &Self, progress: f64) -> Result { Ok(InnerMatrix2D { m11: try!(self.m11.interpolate(&other.m11, progress)), @@ -1332,7 +1332,7 @@ impl Interpolate for InnerMatrix2D { } } -impl Interpolate for Translate2D { +impl Animatable for Translate2D { fn interpolate(&self, other: &Self, progress: f64) -> Result { Ok(Translate2D( try!(self.0.interpolate(&other.0, progress)), @@ -1341,7 +1341,7 @@ impl Interpolate for Translate2D { } } -impl Interpolate for Scale2D { +impl Animatable for Scale2D { fn interpolate(&self, other: &Self, progress: f64) -> Result { Ok(Scale2D( try!(self.0.interpolate(&other.0, progress)), @@ -1350,7 +1350,7 @@ impl Interpolate for Scale2D { } } -impl Interpolate for MatrixDecomposed2D { +impl Animatable for MatrixDecomposed2D { /// https://drafts.csswg.org/css-transforms/#interpolation-of-decomposed-2d-matrix-values fn interpolate(&self, other: &Self, progress: f64) -> Result { // If x-axis of one is flipped, and y-axis of the other, @@ -1396,7 +1396,7 @@ impl Interpolate for MatrixDecomposed2D { } } -impl Interpolate for ComputedMatrix { +impl Animatable for ComputedMatrix { fn interpolate(&self, other: &Self, progress: f64) -> Result { if self.is_3d() || other.is_3d() { let decomposed_from = decompose_3d_matrix(*self); @@ -1730,7 +1730,7 @@ fn cross(row1: [f32; 3], row2: [f32; 3]) -> [f32; 3] { ] } -impl Interpolate for Translate3D { +impl Animatable for Translate3D { fn interpolate(&self, other: &Self, progress: f64) -> Result { Ok(Translate3D( try!(self.0.interpolate(&other.0, progress)), @@ -1740,7 +1740,7 @@ impl Interpolate for Translate3D { } } -impl Interpolate for Scale3D { +impl Animatable for Scale3D { fn interpolate(&self, other: &Self, progress: f64) -> Result { Ok(Scale3D( try!(self.0.interpolate(&other.0, progress)), @@ -1750,7 +1750,7 @@ impl Interpolate for Scale3D { } } -impl Interpolate for Skew { +impl Animatable for Skew { fn interpolate(&self, other: &Self, progress: f64) -> Result { Ok(Skew( try!(self.0.interpolate(&other.0, progress)), @@ -1760,7 +1760,7 @@ impl Interpolate for Skew { } } -impl Interpolate for Perspective { +impl Animatable for Perspective { fn interpolate(&self, other: &Self, progress: f64) -> Result { Ok(Perspective( try!(self.0.interpolate(&other.0, progress)), @@ -1771,7 +1771,7 @@ impl Interpolate for Perspective { } } -impl Interpolate for MatrixDecomposed3D { +impl Animatable for MatrixDecomposed3D { /// https://drafts.csswg.org/css-transforms/#interpolation-of-decomposed-3d-matrix-values fn interpolate(&self, other: &Self, progress: f64) -> Result { let mut interpolated = *self; @@ -2009,7 +2009,7 @@ impl ComputedMatrix { } /// https://drafts.csswg.org/css-transforms/#interpolation-of-transforms -impl Interpolate for TransformList { +impl Animatable for TransformList { #[inline] fn interpolate(&self, other: &TransformList, progress: f64) -> Result { // http://dev.w3.org/csswg/css-transforms/#interpolation-of-transforms @@ -2038,8 +2038,8 @@ impl Interpolate for TransformList { } } -impl Interpolate for Either - where T: Interpolate + Copy, U: Interpolate + Copy, +impl Animatable for Either + where T: Animatable + Copy, U: Animatable + Copy, { #[inline] fn interpolate(&self, other: &Self, progress: f64) -> Result { @@ -2105,8 +2105,8 @@ impl IntermediateRGBA { } } -/// Unlike Interpolate for RGBA we don't clamp any component values. -impl Interpolate for IntermediateRGBA { +/// Unlike Animatable for RGBA we don't clamp any component values. +impl Animatable for IntermediateRGBA { #[inline] fn interpolate(&self, other: &IntermediateRGBA, progress: f64) -> Result { let alpha = try!(self.alpha.interpolate(&other.alpha, progress)); @@ -2803,7 +2803,7 @@ pub enum IntermediateColor { IntermediateRGBA(IntermediateRGBA), } -impl Interpolate for IntermediateColor { +impl Animatable for IntermediateColor { #[inline] fn interpolate(&self, other: &Self, progress: f64) -> Result { match (*self, *other) { @@ -2907,8 +2907,8 @@ impl <'a> From<<&'a IntermediateColor> for CSSParserColor { } } } - ${impl_interpolate_for_shadow('Intermediate%sShadow' % type, - 'IntermediateColor::IntermediateRGBA(IntermediateRGBA::transparent())')} + ${impl_animatable_for_shadow('Intermediate%sShadow' % type, + 'IntermediateColor::IntermediateRGBA(IntermediateRGBA::transparent())')} ${impl_intermediate_type_for_shadow('Box')} diff --git a/components/style/properties/longhand/background.mako.rs b/components/style/properties/longhand/background.mako.rs index 3689ea61c02..68cdb5557b8 100644 --- a/components/style/properties/longhand/background.mako.rs +++ b/components/style/properties/longhand/background.mako.rs @@ -195,7 +195,8 @@ ${helpers.single_keyword("background-origin", #[allow(missing_docs)] pub mod computed_value { use values::computed::LengthOrPercentageOrAuto; - use properties::animated_properties::{ComputeDistance, Interpolate, RepeatableListInterpolate}; + use properties::animated_properties::{Animatable, ComputeDistance, + RepeatableListAnimatable}; #[derive(PartialEq, Clone, Debug)] #[cfg_attr(feature = "servo", derive(HeapSizeOf))] @@ -212,9 +213,9 @@ ${helpers.single_keyword("background-origin", Contain, } - impl RepeatableListInterpolate for T {} + impl RepeatableListAnimatable for T {} - impl Interpolate for T { + impl Animatable for T { fn interpolate(&self, other: &Self, time: f64) -> Result { use properties::longhands::background_size::single_value::computed_value::ExplicitSize; match (self, other) { diff --git a/components/style/properties/longhand/box.mako.rs b/components/style/properties/longhand/box.mako.rs index ca8549dc10c..57236d3a0e8 100644 --- a/components/style/properties/longhand/box.mako.rs +++ b/components/style/properties/longhand/box.mako.rs @@ -2181,7 +2181,7 @@ ${helpers.single_keyword("transform-style", use values::specified::{NoCalcLength, LengthOrPercentage, Percentage}; pub mod computed_value { - use properties::animated_properties::{ComputeDistance, Interpolate}; + use properties::animated_properties::{Animatable, ComputeDistance}; use values::computed::{Length, LengthOrPercentage}; #[derive(Clone, Copy, Debug, PartialEq)] @@ -2192,7 +2192,7 @@ ${helpers.single_keyword("transform-style", pub depth: Length, } - impl Interpolate for T { + impl Animatable for T { #[inline] fn interpolate(&self, other: &Self, time: f64) -> Result { Ok(T { diff --git a/components/style/properties/longhand/font.mako.rs b/components/style/properties/longhand/font.mako.rs index 603e100a4e2..2e78c03e073 100644 --- a/components/style/properties/longhand/font.mako.rs +++ b/components/style/properties/longhand/font.mako.rs @@ -1022,7 +1022,7 @@ ${helpers.single_keyword_system("font-variant-caps", } pub mod computed_value { - use properties::animated_properties::{ComputeDistance, Interpolate}; + use properties::animated_properties::{Animatable, ComputeDistance}; use std::fmt; use style_traits::ToCss; use values::CSSFloat; @@ -1054,7 +1054,7 @@ ${helpers.single_keyword_system("font-variant-caps", } } - impl Interpolate for T { + impl Animatable for T { fn interpolate(&self, other: &Self, time: f64) -> Result { match (*self, *other) { (T::Number(ref number), T::Number(ref other)) => diff --git a/components/style/properties/longhand/inherited_table.mako.rs b/components/style/properties/longhand/inherited_table.mako.rs index 5caaa17195d..d89ddaf41ee 100644 --- a/components/style/properties/longhand/inherited_table.mako.rs +++ b/components/style/properties/longhand/inherited_table.mako.rs @@ -30,7 +30,7 @@ ${helpers.single_keyword("caption-side", "top bottom", pub mod computed_value { use app_units::Au; - use properties::animated_properties::{ComputeDistance, Interpolate}; + use properties::animated_properties::{Animatable, ComputeDistance}; #[derive(Clone, Copy, Debug, PartialEq)] #[cfg_attr(feature = "servo", derive(HeapSizeOf))] @@ -40,7 +40,7 @@ ${helpers.single_keyword("caption-side", "top bottom", } /// https://drafts.csswg.org/css-transitions/#animtype-simple-list - impl Interpolate for T { + impl Animatable for T { #[inline] fn interpolate(&self, other: &Self, time: f64) -> Result { Ok(T { diff --git a/components/style/properties/longhand/inherited_text.mako.rs b/components/style/properties/longhand/inherited_text.mako.rs index 644c9979ac1..bfc9b5ee50c 100644 --- a/components/style/properties/longhand/inherited_text.mako.rs +++ b/components/style/properties/longhand/inherited_text.mako.rs @@ -441,13 +441,13 @@ ${helpers.single_keyword("text-align-last", pub mod computed_value { use app_units::Au; - use properties::animated_properties::{ComputeDistance, Interpolate}; + use properties::animated_properties::{Animatable, ComputeDistance}; #[derive(Debug, Clone, PartialEq)] #[cfg_attr(feature = "servo", derive(HeapSizeOf))] pub struct T(pub Option); - ${helpers.impl_interpolate_for_option_tuple('Au(0)')} + ${helpers.impl_animatable_for_option_tuple('Au(0)')} ${helpers.impl_compute_distance_for_option_tuple('Au(0)')} } @@ -527,13 +527,13 @@ ${helpers.single_keyword("text-align-last", } pub mod computed_value { - use properties::animated_properties::{ComputeDistance, Interpolate}; + use properties::animated_properties::{ComputeDistance, Animatable}; use values::computed::LengthOrPercentage; #[derive(Debug, Clone, PartialEq)] #[cfg_attr(feature = "servo", derive(HeapSizeOf))] pub struct T(pub Option); - ${helpers.impl_interpolate_for_option_tuple('LengthOrPercentage::zero()')} + ${helpers.impl_animatable_for_option_tuple('LengthOrPercentage::zero()')} ${helpers.impl_compute_distance_for_option_tuple('LengthOrPercentage::zero()')} } diff --git a/components/style/properties/longhand/svg.mako.rs b/components/style/properties/longhand/svg.mako.rs index 500c8cc1460..666d50f3a80 100644 --- a/components/style/properties/longhand/svg.mako.rs +++ b/components/style/properties/longhand/svg.mako.rs @@ -99,17 +99,17 @@ ${helpers.single_keyword("mask-mode", pub use properties::longhands::background_position_x::single_value::parse; pub use properties::longhands::background_position_x::single_value::SpecifiedValue; pub use properties::longhands::background_position_x::single_value::computed_value; - use properties::animated_properties::{ComputeDistance, Interpolate, RepeatableListInterpolate}; + use properties::animated_properties::{Animatable, ComputeDistance, RepeatableListAnimatable}; use properties::longhands::mask_position_x::computed_value::T as MaskPositionX; - impl Interpolate for MaskPositionX { + impl Animatable for MaskPositionX { #[inline] fn interpolate(&self, other: &Self, progress: f64) -> Result { Ok(MaskPositionX(try!(self.0.interpolate(&other.0, progress)))) } } - impl RepeatableListInterpolate for MaskPositionX {} + impl RepeatableListAnimatable for MaskPositionX {} impl ComputeDistance for MaskPositionX { #[inline] @@ -128,17 +128,17 @@ ${helpers.single_keyword("mask-mode", pub use properties::longhands::background_position_y::single_value::parse; pub use properties::longhands::background_position_y::single_value::SpecifiedValue; pub use properties::longhands::background_position_y::single_value::computed_value; - use properties::animated_properties::{ComputeDistance, Interpolate, RepeatableListInterpolate}; + use properties::animated_properties::{Animatable, ComputeDistance, RepeatableListAnimatable}; use properties::longhands::mask_position_y::computed_value::T as MaskPositionY; - impl Interpolate for MaskPositionY { + impl Animatable for MaskPositionY { #[inline] fn interpolate(&self, other: &Self, progress: f64) -> Result { Ok(MaskPositionY(try!(self.0.interpolate(&other.0, progress)))) } } - impl RepeatableListInterpolate for MaskPositionY {} + impl RepeatableListAnimatable for MaskPositionY {} impl ComputeDistance for MaskPositionY { #[inline] diff --git a/components/style/values/mod.rs b/components/style/values/mod.rs index 01a774d138e..aa225777f11 100644 --- a/components/style/values/mod.rs +++ b/components/style/values/mod.rs @@ -11,7 +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 properties::animated_properties::{Animatable, ComputeDistance}; use std::ascii::AsciiExt; use std::borrow::Cow; use std::fmt::{self, Debug}; @@ -127,7 +127,7 @@ macro_rules! define_keyword_type { } } - impl Interpolate for $name { + impl Animatable for $name { #[inline] fn interpolate(&self, _other: &Self, _progress: f64) -> Result { Ok($name) diff --git a/ports/geckolib/glue.rs b/ports/geckolib/glue.rs index 4601d31f683..bed5c74edbf 100644 --- a/ports/geckolib/glue.rs +++ b/ports/geckolib/glue.rs @@ -75,7 +75,7 @@ use style::parser::{LengthParsingMode, ParserContext}; use style::properties::{CascadeFlags, ComputedValues, Importance, ParsedDeclaration, StyleBuilder}; use style::properties::{PropertyDeclarationBlock, PropertyId}; use style::properties::SKIP_ROOT_AND_ITEM_BASED_DISPLAY_FIXUP; -use style::properties::animated_properties::{AnimationValue, ComputeDistance, Interpolate, TransitionProperty}; +use style::properties::animated_properties::{Animatable, AnimationValue, ComputeDistance, TransitionProperty}; use style::properties::parse_one_declaration; use style::restyle_hints::{self, RestyleHint}; use style::rule_tree::{StrongRuleNode, StyleSource}; diff --git a/tests/unit/style/animated_properties.rs b/tests/unit/style/animated_properties.rs index e486f0f1474..853c2c24ae6 100644 --- a/tests/unit/style/animated_properties.rs +++ b/tests/unit/style/animated_properties.rs @@ -3,7 +3,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use cssparser::{Color, RGBA}; -use style::properties::animated_properties::Interpolate; +use style::properties::animated_properties::Animatable; #[test] fn test_rgba_color_interepolation_preserves_transparent() {