Bug 1313554 - Use brace-initialization to ShearArray. draft
authorBoris Chiou <boris.chiou@gmail.com>
Fri, 28 Oct 2016 11:11:36 +0800
changeset 430747 a00e23f7e7914200db18963b9cee0ccd870b0cfa
parent 430701 944cb0fd05526894fcd90fbe7d1e625ee53cd73d
child 535250 3f88005ac4d4fe4b60462b42e937134c845307e2
push id33875
push userbmo:boris.chiou@gmail.com
push dateFri, 28 Oct 2016 03:16:58 +0000
bugs1313554
milestone52.0a1
Bug 1313554 - Use brace-initialization to ShearArray. MozReview-Commit-ID: 9dT7bpGpCEC
layout/style/StyleAnimationValue.cpp
--- a/layout/style/StyleAnimationValue.cpp
+++ b/layout/style/StyleAnimationValue.cpp
@@ -710,29 +710,23 @@ AddTransformLists(double aCoeff1, const 
 
 static double
 ComputeTransform2DMatrixDistance(const Matrix& aMatrix1,
                                  const Matrix& aMatrix2)
 {
   Point3D scale1(1, 1, 1);
   Point3D translate1;
   gfxQuaternion rotate1;
-  nsStyleTransformMatrix::ShearArray shear1;
-  for (auto&& s : shear1) {
-    s = 0.0f;
-  }
+  nsStyleTransformMatrix::ShearArray shear1{0.0f, 0.0f, 0.0f};
   Decompose2DMatrix(aMatrix1, scale1, shear1, rotate1, translate1);
 
   Point3D scale2(1, 1, 1);
   Point3D translate2;
   gfxQuaternion rotate2;
-  nsStyleTransformMatrix::ShearArray shear2;
-  for (auto&& s : shear2) {
-    s = 0.0f;
-  }
+  nsStyleTransformMatrix::ShearArray shear2{0.0f, 0.0f, 0.0f};
   Decompose2DMatrix(aMatrix2, scale2, shear2, rotate2, translate2);
 
   // Note:
   // 1. Shear factor is the tangent value of shear angle, so we need to
   //    call atan() to get the angle. For 2D transform, we only have XYSHEAR.
   // 2. The quaternion vector of the decomposed 2d matrix is got by
   //    "gfxQuaternion(0, 0, sin(rotate/2), cos(rotate/2))"
   //                         ^^^^^^^^^^^^^  ^^^^^^^^^^^^^
@@ -767,31 +761,25 @@ ComputeTransform2DMatrixDistance(const M
 static double
 ComputeTransform3DMatrixDistance(const Matrix4x4& aMatrix1,
                                  const Matrix4x4& aMatrix2)
 {
   Point3D scale1(1, 1, 1);
   Point3D translate1;
   Point4D perspective1(0, 0, 0, 1);
   gfxQuaternion rotate1;
-  nsStyleTransformMatrix::ShearArray shear1;
-  for (auto&& s : shear1) {
-    s = 0.0f;
-  }
+  nsStyleTransformMatrix::ShearArray shear1{0.0f, 0.0f, 0.0f};
   Decompose3DMatrix(aMatrix1, scale1, shear1, rotate1, translate1,
                     perspective1);
 
   Point3D scale2(1, 1, 1);
   Point3D translate2;
   Point4D perspective2(0, 0, 0, 1);
   gfxQuaternion rotate2;
-  nsStyleTransformMatrix::ShearArray shear2;
-  for (auto&& s : shear2) {
-    s = 0.0f;
-  }
+  nsStyleTransformMatrix::ShearArray shear2{0.0f, 0.0f, 0.0f};
   Decompose3DMatrix(aMatrix2, scale2, shear2, rotate2, translate2,
                     perspective2);
 
   // Note:
   // 1. Shear factor is the tangent value of shear angle, so we need to
   //    call atan() to get the angle.
   // 2. We use the same way to get the rotate angle of two quaternion vectors as
   //    what we do for rotate3d.
@@ -1787,28 +1775,22 @@ StyleAnimationValue::InterpolateTransfor
                                                 double aProgress)
 {
   // Decompose both matrices
 
   // TODO: What do we do if one of these returns false (singular matrix)
   Point3D scale1(1, 1, 1), translate1;
   Point4D perspective1(0, 0, 0, 1);
   gfxQuaternion rotate1;
-  nsStyleTransformMatrix::ShearArray shear1;
-  for (auto&& s : shear1) {
-    s = 0.0f;
-  }
+  nsStyleTransformMatrix::ShearArray shear1{0.0f, 0.0f, 0.0f};
 
   Point3D scale2(1, 1, 1), translate2;
   Point4D perspective2(0, 0, 0, 1);
   gfxQuaternion rotate2;
-  nsStyleTransformMatrix::ShearArray shear2;
-  for (auto&& s : shear2) {
-    s = 0.0f;
-  }
+  nsStyleTransformMatrix::ShearArray shear2{0.0f, 0.0f, 0.0f};
 
   Matrix matrix2d1, matrix2d2;
   if (aMatrix1.Is2D(&matrix2d1) && aMatrix2.Is2D(&matrix2d2)) {
     Decompose2DMatrix(matrix2d1, scale1, shear1, rotate1, translate1);
     Decompose2DMatrix(matrix2d2, scale2, shear2, rotate2, translate2);
   } else {
     Decompose3DMatrix(aMatrix1, scale1, shear1,
                       rotate1, translate1, perspective1);