From a7a5adb71a9da4b8682887a78082f57b3848786a Mon Sep 17 00:00:00 2001 From: Manish Goregaokar Date: Wed, 13 Sep 2017 15:37:52 -0700 Subject: [PATCH] stylo: Fix TransformOperation.animate() implementation --- .../helpers/animated_properties.mako.rs | 66 +++++++++++++++++++ components/style/values/computed/transform.rs | 2 +- 2 files changed, 67 insertions(+), 1 deletion(-) diff --git a/components/style/properties/helpers/animated_properties.mako.rs b/components/style/properties/helpers/animated_properties.mako.rs index 51f9d9c362e..df28b675db8 100644 --- a/components/style/properties/helpers/animated_properties.mako.rs +++ b/components/style/properties/helpers/animated_properties.mako.rs @@ -1230,6 +1230,30 @@ impl Animate for TransformOperation { fz.animate(tz, procedure)?, )) }, + ( + &TransformOperation::TranslateX(ref from), + &TransformOperation::TranslateX(ref to), + ) => { + Ok(TransformOperation::TranslateX( + from.animate(to, procedure)?, + )) + }, + ( + &TransformOperation::TranslateY(ref from), + &TransformOperation::TranslateY(ref to), + ) => { + Ok(TransformOperation::TranslateY( + from.animate(to, procedure)?, + )) + }, + ( + &TransformOperation::TranslateZ(ref from), + &TransformOperation::TranslateZ(ref to), + ) => { + Ok(TransformOperation::TranslateZ( + from.animate(to, procedure)?, + )) + }, ( &TransformOperation::Scale(ref fx, ref fy, ref fz), &TransformOperation::Scale(ref tx, ref ty, ref tz), @@ -1240,6 +1264,48 @@ impl Animate for TransformOperation { animate_multiplicative_factor(*fz, *tz, procedure)?, )) }, + ( + &TransformOperation::ScaleX(ref from), + &TransformOperation::ScaleX(ref to), + ) => { + Ok(TransformOperation::ScaleX( + animate_multiplicative_factor(*from, *to, procedure)?, + )) + }, + ( + &TransformOperation::ScaleY(ref from), + &TransformOperation::ScaleY(ref to), + ) => { + Ok(TransformOperation::ScaleY( + animate_multiplicative_factor(*from, *to, procedure)?, + )) + }, + ( + &TransformOperation::ScaleZ(ref from), + &TransformOperation::ScaleZ(ref to), + ) => { + Ok(TransformOperation::ScaleZ( + animate_multiplicative_factor(*from, *to, procedure)?, + )) + }, + ( + &TransformOperation::RotateX(ref from), + &TransformOperation::RotateX(ref to), + ) => { + Ok(TransformOperation::RotateX(from.animate(to, procedure)?)) + }, + ( + &TransformOperation::RotateY(ref from), + &TransformOperation::RotateY(ref to), + ) => { + Ok(TransformOperation::RotateY(from.animate(to, procedure)?)) + }, + ( + &TransformOperation::RotateZ(ref from), + &TransformOperation::RotateZ(ref to), + ) => { + Ok(TransformOperation::RotateZ(from.animate(to, procedure)?)) + }, ( &TransformOperation::Rotate(fx, fy, fz, fa), &TransformOperation::Rotate(tx, ty, tz, ta), diff --git a/components/style/values/computed/transform.rs b/components/style/values/computed/transform.rs index 244055ba408..90d9459e700 100644 --- a/components/style/values/computed/transform.rs +++ b/components/style/values/computed/transform.rs @@ -128,7 +128,7 @@ impl TransformList { Transform3D::create_translation(0., ty, 0.) } ComputedOperation::TranslateZ(tz) => { - Transform3D::create_translation(0., 0., tz.to_f32_px()) + Transform3D::create_translation(0., 0., tz.px()) } ComputedOperation::Translate(tx, ty, tz) => { let (tx, ty) = match reference_box {