From 8bc8a0bfa01679ea8505f7734bc05360fb491504 Mon Sep 17 00:00:00 2001 From: Brian Birtles Date: Tue, 30 Oct 2018 19:57:46 +0900 Subject: [PATCH] style: Interpolate the angle between mis-matched rotate() functions when the angle of one is zero. Bug: 1501176 Reviewed-by: hiro --- .../helpers/animated_properties.mako.rs | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/components/style/properties/helpers/animated_properties.mako.rs b/components/style/properties/helpers/animated_properties.mako.rs index b079f30b1a8..c8e72ca1df4 100644 --- a/components/style/properties/helpers/animated_properties.mako.rs +++ b/components/style/properties/helpers/animated_properties.mako.rs @@ -2351,10 +2351,21 @@ impl Animate for ComputedRotate { let from = ComputedRotate::resolve(self); let to = ComputedRotate::resolve(other); - let (fx, fy, fz, fa) = + let (mut fx, mut fy, mut fz, fa) = transform::get_normalized_vector_and_angle(from.0, from.1, from.2, from.3); - let (tx, ty, tz, ta) = + let (mut tx, mut ty, mut tz, ta) = transform::get_normalized_vector_and_angle(to.0, to.1, to.2, to.3); + + if fa == Angle::from_degrees(0.) { + fx = tx; + fy = ty; + fz = tz; + } else if ta == Angle::from_degrees(0.) { + tx = fx; + ty = fy; + tz = fz; + } + if (fx, fy, fz) == (tx, ty, tz) { return Ok(Rotate::Rotate3D(fx, fy, fz, fa.animate(&ta, procedure)?)); }