Bug 1375812 - Build an identity matrix for InterpolateMatrix. draft
authorBoris Chiou <boris.chiou@gmail.com>
Fri, 23 Jun 2017 18:29:55 +0800
changeset 600603 f135f7f93277c3719b0be34b33ac269cbe829c47
parent 600597 53477d584130945864c4491632f88da437353356
child 600604 a6051e8dd690b2667af8e3bed6b324b0b1649b7a
child 600787 f32d4cc166c16da897282613c3d68f2ba69cf8ef
push id65800
push userbmo:boris.chiou@gmail.com
push dateTue, 27 Jun 2017 15:36:32 +0000
bugs1375812
milestone56.0a1
Bug 1375812 - Build an identity matrix for InterpolateMatrix. We have to build an identity matrix while add_weighted() between InterpolateMatrix and none transform in some cases, e.g. trigger a transition from a mid-point of another transition to none. MozReview-Commit-ID: 7QXe1Q3epE4
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
@@ -1609,30 +1609,29 @@ fn build_identity_transform_list(list: &
             }
             TransformOperation::Scale(..) => {
                 result.push(TransformOperation::Scale(1.0, 1.0, 1.0));
             }
             TransformOperation::Rotate(..) => {
                 result.push(TransformOperation::Rotate(0.0, 0.0, 1.0, Angle::zero()));
             }
             TransformOperation::Perspective(..) |
-            TransformOperation::AccumulateMatrix { .. } => {
+            TransformOperation::AccumulateMatrix { .. } |
+            TransformOperation::InterpolateMatrix { .. } => {
                 // Perspective: We convert a perspective function into an equivalent
                 //     ComputedMatrix, and then decompose/interpolate/recompose these matrices.
-                // AccumulateMatrix: We do interpolation on AccumulateMatrix by reading it as a
-                //     ComputedMatrix (with layout information), and then do matrix interpolation.
+                // AccumulateMatrix/InterpolateMatrix: We do interpolation on
+                //     AccumulateMatrix/InterpolateMatrix by reading it as a ComputedMatrix
+                //     (with layout information), and then do matrix interpolation.
                 //
                 // Therefore, we use an identity matrix to represent the identity transform list.
                 // http://dev.w3.org/csswg/css-transforms/#identity-transform-function
                 let identity = ComputedMatrix::identity();
                 result.push(TransformOperation::Matrix(identity));
             }
-            TransformOperation::InterpolateMatrix { .. } => {
-                panic!("Building the identity matrix for InterpolateMatrix is not supported");
-            }
         }
     }
 
     result
 }
 
 /// A wrapper for calling add_weighted that interpolates the distance of the two values from
 /// an initial_value and uses that to produce an interpolated value.