servo: Merge #17911 - Fix rotate_to_matrix (from hiikezoe:rotate-to-matrix); r=canaltinova
authorHiroyuki Ikezoe <hikezoe@mozilla.com>
Sat, 29 Jul 2017 01:01:10 -0500
changeset 420515 f83e9b59ab26a20e6a981566a7e262a4b7ef39b4
parent 420514 57339111e7b97390b5094c082fe314dbeb9a6f6e
child 420516 cce87afe39049f1f332ef27a4c02359b41d6ec15
push id7566
push usermtabara@mozilla.com
push dateWed, 02 Aug 2017 08:25:16 +0000
treeherdermozilla-beta@86913f512c3c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerscanaltinova
milestone56.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 #17911 - Fix rotate_to_matrix (from hiikezoe:rotate-to-matrix); r=canaltinova <!-- Please describe your changes on the following line: --> https://bugzilla.mozilla.org/show_bug.cgi?id=1384410 --- - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors Source-Repo: https://github.com/servo/servo Source-Revision: dde1f46e16faf36be940348f4c0306c1dbc8b467
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
@@ -1733,35 +1733,35 @@ fn add_weighted_transform_lists(from_lis
             TransformOperation::InterpolateMatrix { from_list: from_transform_list,
                                                     to_list: to_transform_list,
                                                     progress: Percentage(other_portion as f32) });
     }
 
     TransformList(Some(result))
 }
 
-/// https://drafts.csswg.org/css-transforms/#Rotate3dDefined
+/// https://www.w3.org/TR/css-transforms-1/#Rotate3dDefined
 fn rotate_to_matrix(x: f32, y: f32, z: f32, a: Angle) -> ComputedMatrix {
     let half_rad = a.radians() / 2.0;
     let sc = (half_rad).sin() * (half_rad).cos();
     let sq = (half_rad).sin().powi(2);
 
     ComputedMatrix {
         m11: 1.0 - 2.0 * (y * y + z * z) * sq,
-        m12: 2.0 * (x * y * sq - z * sc),
-        m13: 2.0 * (x * z * sq + y * sc),
+        m12: 2.0 * (x * y * sq + z * sc),
+        m13: 2.0 * (x * z * sq - y * sc),
         m14: 0.0,
 
-        m21: 2.0 * (x * y * sq + z * sc),
+        m21: 2.0 * (x * y * sq - z * sc),
         m22: 1.0 - 2.0 * (x * x + z * z) * sq,
-        m23: 2.0 * (y * z * sq - x * sc),
+        m23: 2.0 * (y * z * sq + x * sc),
         m24: 0.0,
 
-        m31: 2.0 * (x * z * sq - y * sc),
-        m32: 2.0 * (y * z * sq + x * sc),
+        m31: 2.0 * (x * z * sq + y * sc),
+        m32: 2.0 * (y * z * sq - x * sc),
         m33: 1.0 - 2.0 * (x * x + y * y) * sq,
         m34: 0.0,
 
         m41: 0.0,
         m42: 0.0,
         m43: 0.0,
         m44: 1.0
     }
@@ -2392,29 +2392,29 @@ impl From<MatrixDecomposed3D> for Comput
         rotation_matrix.m33 = 1.0 - 2.0 * (x * x + y * y);
 
         matrix = multiply(rotation_matrix, matrix);
 
         // Apply skew
         let mut temp = ComputedMatrix::identity();
         if decomposed.skew.2 != 0.0 {
             temp.m32 = decomposed.skew.2;
-            matrix = multiply(matrix, temp);
+            matrix = multiply(temp, matrix);
         }
 
         if decomposed.skew.1 != 0.0 {
             temp.m32 = 0.0;
             temp.m31 = decomposed.skew.1;
-            matrix = multiply(matrix, temp);
+            matrix = multiply(temp, matrix);
         }
 
         if decomposed.skew.0 != 0.0 {
             temp.m31 = 0.0;
             temp.m21 = decomposed.skew.0;
-            matrix = multiply(matrix, temp);
+            matrix = multiply(temp, matrix);
         }
 
         // Apply scale
         % for i in range(1, 4):
             % for j in range(1, 4):
                 matrix.m${i}${j} *= decomposed.scale.${i - 1};
             % endfor
         % endfor