From 6e2cf9edf4e926297b4ebd1ae5eecca862c170e2 Mon Sep 17 00:00:00 2001 From: Manish Goregaokar Date: Mon, 18 Dec 2017 20:46:31 -0600 Subject: [PATCH] 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 --HG-- extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear extra : subtree_revision : e88c7957592ff4b343d51f4d6cda72ae96e21722 --- .../helpers/animated_properties.mako.rs | 41 ++++++++++++++++++- 1 file changed, 39 insertions(+), 2 deletions(-) diff --git a/servo/components/style/properties/helpers/animated_properties.mako.rs b/servo/components/style/properties/helpers/animated_properties.mako.rs index 8839a58cda85..1bde83e7b02f 100644 --- a/servo/components/style/properties/helpers/animated_properties.mako.rs +++ b/servo/components/style/properties/helpers/animated_properties.mako.rs @@ -12,6 +12,7 @@ use cssparser::Parser; #[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; @@ -1041,13 +1042,22 @@ impl Animate for ComputedTransformOperation { 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)?) )) }, ( @@ -1076,13 +1086,22 @@ impl Animate for ComputedTransformOperation { 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)?) )) }, ( @@ -1143,6 +1162,24 @@ impl Animate for ComputedTransformOperation { 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),