Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
stylo: Correctly handle interpolation where optional second argument …
…for translate(), skew(), scale() exists in one but not the other

MozReview-Commit-ID: 59rNRAXBEN9
  • Loading branch information
Manishearth committed Dec 19, 2017
1 parent d6797db commit 82e0249
Showing 1 changed file with 39 additions and 2 deletions.
41 changes: 39 additions & 2 deletions components/style/properties/helpers/animated_properties.mako.rs
Expand Up @@ -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;
Expand Down Expand Up @@ -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)?)
))
},
(
Expand Down Expand Up @@ -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)?)
))
},
(
Expand Down Expand Up @@ -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),
Expand Down

0 comments on commit 82e0249

Please sign in to comment.