diff --git a/components/style/properties/helpers/animated_properties.mako.rs b/components/style/properties/helpers/animated_properties.mako.rs index 7563dc3979e..5a8e766b7e2 100644 --- a/components/style/properties/helpers/animated_properties.mako.rs +++ b/components/style/properties/helpers/animated_properties.mako.rs @@ -1226,7 +1226,12 @@ impl Animate for ComputedTransformOperation { fd_matrix.animate(&td_matrix, procedure)?, )) }, - // XXXManishearth handle crossover between translate and scale functions + (ref f, ref t) if f.is_translate() && t.is_translate() => { + f.to_translate_3d().animate(&t.to_translate_3d(), procedure) + } + (ref f, ref t) if f.is_scale() && t.is_scale() => { + f.to_scale_3d().animate(&t.to_scale_3d(), procedure) + } _ => Err(()), } } diff --git a/components/style/values/computed/length.rs b/components/style/values/computed/length.rs index 8cb69b65b17..ece797dd224 100644 --- a/components/style/values/computed/length.rs +++ b/components/style/values/computed/length.rs @@ -706,6 +706,11 @@ impl CSSPixelLength { pub fn abs(self) -> Self { CSSPixelLength::new(self.0.abs()) } + + /// Zero value + pub fn zero() -> Self { + CSSPixelLength::new(0.) + } } impl ToCss for CSSPixelLength { diff --git a/components/style/values/generics/transform.rs b/components/style/values/generics/transform.rs index b663babf279..2bbf641b834 100644 --- a/components/style/values/generics/transform.rs +++ b/components/style/values/generics/transform.rs @@ -249,7 +249,6 @@ pub struct Transform(pub Vec); impl TransformOperation { - /// Check if it is any translate function pub fn is_translate(&self) -> bool { use self::TransformOperation::*; diff --git a/components/style/values/specified/transform.rs b/components/style/values/specified/transform.rs index b7e83cf4e3b..14bd00a1af5 100644 --- a/components/style/values/specified/transform.rs +++ b/components/style/values/specified/transform.rs @@ -10,8 +10,8 @@ use selectors::parser::SelectorParseErrorKind; use style_traits::{ParseError, StyleParseErrorKind}; use values::computed::{Context, LengthOrPercentage as ComputedLengthOrPercentage}; use values::computed::{Percentage as ComputedPercentage, ToComputedValue}; -use values::generics::transform::{Matrix3D, Transform as GenericTransform}; use values::computed::transform::TimingFunction as ComputedTimingFunction; +use values::generics::transform::{Matrix3D, Transform as GenericTransform}; use values::generics::transform::{StepPosition, TimingFunction as GenericTimingFunction, Matrix}; use values::generics::transform::{TimingKeyword, TransformOrigin as GenericTransformOrigin}; use values::generics::transform::TransformOperation as GenericTransformOperation;