servo: Merge #19604 - stylo: Correctly handle interpolation where optional second argument for translate(), skew(), scale() exists in one but not the other (from Manishearth:animate-second); r=emilio
authorManish Goregaokar <manishearth@gmail.com>
Mon, 18 Dec 2017 20:46:31 -0600
changeset 448555 ba242fe9760e1744c2bdb463bbc679a741254cd5
parent 448554 251fb7b394132abe8947b526def1318a59fd65e3
child 448556 bf4b28e3e513fd29caf81d3bfdfe694008ef8877
push id8527
push userCallek@gmail.com
push dateThu, 11 Jan 2018 21:05:50 +0000
treeherdermozilla-beta@95342d212a7a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersemilio
milestone59.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
servo: Merge #19604 - stylo: Correctly handle interpolation where optional second argument for translate(), skew(), scale() exists in one but not the other (from Manishearth:animate-second); r=emilio r=emilio https://bugzilla.mozilla.org/show_bug.cgi?id=1424798 Source-Repo: https://github.com/servo/servo Source-Revision: 861ceb10eadcd8e73c54a85336d081432813b2b1
servo/components/style/properties/helpers/animated_properties.mako.rs
--- a/servo/components/style/properties/helpers/animated_properties.mako.rs
+++ b/servo/components/style/properties/helpers/animated_properties.mako.rs
@@ -7,16 +7,17 @@
 <% from data import to_idl_name, SYSTEM_FONT_LONGHANDS %>
 
 use cssparser::Parser;
 #[cfg(feature = "gecko")] use gecko_bindings::bindings::RawServoAnimationValueMap;
 #[cfg(feature = "gecko")] use gecko_bindings::structs::RawGeckoGfxMatrix4x4;
 #[cfg(feature = "gecko")] use gecko_bindings::structs::nsCSSPropertyID;
 #[cfg(feature = "gecko")] use gecko_bindings::sugar::ownership::{HasFFI, HasSimpleFFI};
 use itertools::{EitherOrBoth, Itertools};
+use num_traits::Zero;
 use properties::{CSSWideKeyword, PropertyDeclaration};
 use properties::longhands;
 use properties::longhands::font_weight::computed_value::T as FontWeight;
 use properties::longhands::font_stretch::computed_value::T as FontStretch;
 #[cfg(feature = "gecko")]
 use properties::longhands::font_variation_settings::computed_value::T as FontVariationSettings;
 use properties::longhands::visibility::computed_value::T as Visibility;
 #[cfg(feature = "gecko")]
@@ -1037,22 +1038,31 @@ impl Animate for ComputedTransformOperat
                 &TransformOperation::Matrix(ref this),
                 &TransformOperation::Matrix(ref other),
             ) => {
                 Ok(TransformOperation::Matrix(
                     this.animate(other, procedure)?,
                 ))
             },
             (
+                &TransformOperation::Skew(ref fx, None),
+                &TransformOperation::Skew(ref tx, None),
+            ) => {
+                Ok(TransformOperation::Skew(
+                    fx.animate(tx, procedure)?,
+                    None,
+                ))
+            },
+            (
                 &TransformOperation::Skew(ref fx, ref fy),
                 &TransformOperation::Skew(ref tx, ref ty),
             ) => {
                 Ok(TransformOperation::Skew(
                     fx.animate(tx, procedure)?,
-                    fy.animate(ty, procedure)?,
+                    Some(fy.unwrap_or(Angle::zero()).animate(&ty.unwrap_or(Angle::zero()), procedure)?)
                 ))
             },
             (
                 &TransformOperation::SkewX(ref f),
                 &TransformOperation::SkewX(ref t),
             ) => {
                 Ok(TransformOperation::SkewX(
                     f.animate(t, procedure)?,
@@ -1072,22 +1082,31 @@ impl Animate for ComputedTransformOperat
             ) => {
                 Ok(TransformOperation::Translate3D(
                     fx.animate(tx, procedure)?,
                     fy.animate(ty, procedure)?,
                     fz.animate(tz, procedure)?,
                 ))
             },
             (
+                &TransformOperation::Translate(ref fx, None),
+                &TransformOperation::Translate(ref tx, None),
+            ) => {
+                Ok(TransformOperation::Translate(
+                    fx.animate(tx, procedure)?,
+                    None
+                ))
+            },
+            (
                 &TransformOperation::Translate(ref fx, ref fy),
                 &TransformOperation::Translate(ref tx, ref ty),
             ) => {
                 Ok(TransformOperation::Translate(
                     fx.animate(tx, procedure)?,
-                    fy.animate(ty, procedure)?
+                    Some(fy.unwrap_or(*fx).animate(&ty.unwrap_or(*tx), procedure)?)
                 ))
             },
             (
                 &TransformOperation::TranslateX(ref f),
                 &TransformOperation::TranslateX(ref t),
             ) => {
                 Ok(TransformOperation::TranslateX(
                     f.animate(t, procedure)?
@@ -1139,16 +1158,34 @@ impl Animate for ComputedTransformOperat
                 &TransformOperation::ScaleZ(ref f),
                 &TransformOperation::ScaleZ(ref t),
             ) => {
                 Ok(TransformOperation::ScaleZ(
                     animate_multiplicative_factor(*f, *t, procedure)?
                 ))
             },
             (
+                &TransformOperation::Scale(ref f, None),
+                &TransformOperation::Scale(ref t, None),
+            ) => {
+                Ok(TransformOperation::Scale(
+                    animate_multiplicative_factor(*f, *t, procedure)?,
+                    None
+                ))
+            },
+            (
+                &TransformOperation::Scale(ref fx, ref fy),
+                &TransformOperation::Scale(ref tx, ref ty),
+            ) => {
+                Ok(TransformOperation::Scale(
+                    animate_multiplicative_factor(*fx, *tx, procedure)?,
+                    Some(animate_multiplicative_factor(fy.unwrap_or(*fx), ty.unwrap_or(*tx), procedure)?),
+                ))
+            },
+            (
                 &TransformOperation::Rotate3D(fx, fy, fz, fa),
                 &TransformOperation::Rotate3D(tx, ty, tz, ta),
             ) => {
                 let (fx, fy, fz, fa) = transform::get_normalized_vector_and_angle(fx, fy, fz, fa);
                 let (tx, ty, tz, ta) = transform::get_normalized_vector_and_angle(tx, ty, tz, ta);
                 if (fx, fy, fz) == (tx, ty, tz) {
                     let ia = fa.animate(&ta, procedure)?;
                     Ok(TransformOperation::Rotate3D(fx, fy, fz, ia))