Bug 1505645 - Remove unused outparam from nsStyleTransformMatrix. r=boris
authorEmilio Cobos Álvarez <emilio@crisal.io>
Thu, 08 Nov 2018 02:25:28 +0000
changeset 445086 02d5477e7c9a3302fb1b9794a70dcbb9709fe8c8
parent 445085 49dc2c1fe213a341f5f3f643ce3720ca470ff157
child 445087 f0b33e8151a873d356ccddb9e83a37b24c649fd4
push id35010
push userbtara@mozilla.com
push dateThu, 08 Nov 2018 18:47:03 +0000
treeherdermozilla-central@c812e3810b94 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersboris
bugs1505645
milestone65.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
Bug 1505645 - Remove unused outparam from nsStyleTransformMatrix. r=boris dummy bool is dummy. Differential Revision: https://phabricator.services.mozilla.com/D11275
layout/generic/nsFrame.cpp
layout/painting/ActiveLayerTracker.cpp
layout/painting/nsDisplayList.cpp
layout/style/nsComputedDOMStyle.cpp
layout/style/nsStyleTransformMatrix.cpp
layout/style/nsStyleTransformMatrix.h
--- a/layout/generic/nsFrame.cpp
+++ b/layout/generic/nsFrame.cpp
@@ -11170,22 +11170,20 @@ nsIFrame::ComputeWidgetTransform()
     return gfx::Matrix();
   }
 
   nsStyleTransformMatrix::TransformReferenceBox refBox;
   refBox.Init(GetSize());
 
   nsPresContext* presContext = PresContext();
   int32_t appUnitsPerDevPixel = presContext->AppUnitsPerDevPixel();
-  bool dummyBool;
   gfx::Matrix4x4 matrix =
     nsStyleTransformMatrix::ReadTransforms(uiReset->mSpecifiedWindowTransform->mHead,
                                            refBox,
-                                           float(appUnitsPerDevPixel),
-                                           &dummyBool);
+                                           float(appUnitsPerDevPixel));
 
   // Apply the -moz-window-transform-origin translation to the matrix.
   Point transformOrigin =
     nsStyleTransformMatrix::Convert2DPosition(uiReset->mWindowTransformOrigin,
                                               refBox, appUnitsPerDevPixel);
   matrix.ChangeBasis(Point3D(transformOrigin.x, transformOrigin.y, 0));
 
   gfx::Matrix result2d;
--- a/layout/painting/ActiveLayerTracker.cpp
+++ b/layout/painting/ActiveLayerTracker.cpp
@@ -280,27 +280,25 @@ IncrementScaleRestyleCountIfNeeded(nsIFr
     // The transform was removed.
     aActivity->mPreviousTransformScale = Nothing();
     IncrementMutationCount(
       &aActivity->mRestyleCounts[LayerActivity::ACTIVITY_SCALE]);
     return;
   }
 
   // Compute the new scale due to the CSS transform property.
-  bool dummyBool;
   nsStyleTransformMatrix::TransformReferenceBox refBox(aFrame);
   Matrix4x4 transform = nsStyleTransformMatrix::ReadTransforms(
     display->mIndividualTransform ? display->mIndividualTransform->mHead
                                   : nullptr,
     nsLayoutUtils::ResolveMotionPath(aFrame),
     display->mSpecifiedTransform ? display->mSpecifiedTransform->mHead
                                  : nullptr,
     refBox,
-    AppUnitsPerCSSPixel(),
-    &dummyBool);
+    AppUnitsPerCSSPixel());
   Matrix transform2D;
   if (!transform.Is2D(&transform2D)) {
     // We don't attempt to handle 3D transforms; just assume the scale changed.
     aActivity->mPreviousTransformScale = Nothing();
     IncrementMutationCount(
       &aActivity->mRestyleCounts[LayerActivity::ACTIVITY_SCALE]);
     return;
   }
--- a/layout/painting/nsDisplayList.cpp
+++ b/layout/painting/nsDisplayList.cpp
@@ -363,28 +363,26 @@ AddTransformFunctions(const nsCSSValueLi
         matrix._42 = ProcessTranslatePart(
           array->Item(14), &aRefBox, &TransformReferenceBox::Height);
         matrix._43 = ProcessTranslatePart(array->Item(15), &aRefBox, nullptr);
         matrix._44 = array->Item(16).GetFloatValue();
         aFunctions.AppendElement(TransformMatrix(matrix));
         break;
       }
       case eCSSKeyword_interpolatematrix: {
-        bool dummy;
         Matrix4x4 matrix;
         nsStyleTransformMatrix::ProcessInterpolateMatrix(
-          matrix, array, aRefBox, &dummy);
+          matrix, array, aRefBox);
         aFunctions.AppendElement(TransformMatrix(matrix));
         break;
       }
       case eCSSKeyword_accumulatematrix: {
-        bool dummy;
         Matrix4x4 matrix;
         nsStyleTransformMatrix::ProcessAccumulateMatrix(
-          matrix, array, aRefBox, &dummy);
+          matrix, array, aRefBox);
         aFunctions.AppendElement(TransformMatrix(matrix));
         break;
       }
       case eCSSKeyword_perspective: {
         aFunctions.AppendElement(Perspective(array->Item(1).GetFloatValue()));
         break;
       }
       default:
@@ -8371,17 +8369,16 @@ nsDisplayTransform::GetResultingTransfor
   if (aBoundsOverride &&
       (!frame || !(frame->GetStateBits() & NS_FRAME_SVG_LAYOUT))) {
     refBox.Init(aBoundsOverride->Size());
   } else {
     refBox.Init(frame);
   }
 
   /* Get the matrix, then change its basis to factor in the origin. */
-  bool dummyBool;
   Matrix4x4 result;
   // Call IsSVGTransformed() regardless of the value of
   // disp->mSpecifiedTransform, since we still need any
   // parentsChildrenOnlyTransform.
   Matrix svgTransform, parentsChildrenOnlyTransform;
   bool hasSVGTransforms =
     frame &&
     frame->IsSVGTransformed(&svgTransform, &parentsChildrenOnlyTransform);
@@ -8390,18 +8387,17 @@ nsDisplayTransform::GetResultingTransfor
   if (aProperties.HasTransform()) {
     result = nsStyleTransformMatrix::ReadTransforms(
       aProperties.mIndividualTransformList
         ? aProperties.mIndividualTransformList->mHead
         : nullptr,
       aProperties.mMotion,
       aProperties.mTransformList ? aProperties.mTransformList->mHead : nullptr,
       refBox,
-      aAppUnitsPerPixel,
-      &dummyBool);
+      aAppUnitsPerPixel);
   } else if (hasSVGTransforms) {
     // Correct the translation components for zoom:
     float pixelsPerCSSPx = AppUnitsPerCSSPixel() / aAppUnitsPerPixel;
     svgTransform._31 *= pixelsPerCSSPx;
     svgTransform._32 *= pixelsPerCSSPx;
     result = Matrix4x4::From2D(svgTransform);
   }
 
--- a/layout/style/nsComputedDOMStyle.cpp
+++ b/layout/style/nsComputedDOMStyle.cpp
@@ -4007,22 +4007,20 @@ nsComputedDOMStyle::GetTransformValue(ns
    * the transform based on the size of the element.  However, this poses a
    * problem, because only two of these values can be explicitly referenced
    * using the named transforms.  Until a real solution is found, we'll just
    * use this approach.
    */
   nsStyleTransformMatrix::TransformReferenceBox refBox(mInnerFrame,
                                                        nsSize(0, 0));
 
-   bool dummyBool;
    gfx::Matrix4x4 matrix =
      nsStyleTransformMatrix::ReadTransforms(aSpecifiedTransform->mHead,
                                             refBox,
-                                            float(mozilla::AppUnitsPerCSSPixel()),
-                                            &dummyBool);
+                                            float(mozilla::AppUnitsPerCSSPixel()));
 
   return MatrixToCSSValue(matrix);
 }
 
 already_AddRefed<CSSValue>
 nsComputedDOMStyle::DoGetFill()
 {
   return GetSVGPaintFor(true);
--- a/layout/style/nsStyleTransformMatrix.cpp
+++ b/layout/style/nsStyleTransformMatrix.cpp
@@ -464,18 +464,17 @@ OperateTransformMatrixByServo(const Matr
 {
   return Operator::operateByServo(aMatrix1, aMatrix2, aProgress);
 }
 
 template <typename Operator>
 static void
 ProcessMatrixOperator(Matrix4x4& aMatrix,
                       const nsCSSValue::Array* aData,
-                      TransformReferenceBox& aRefBox,
-                      bool* aContains3dTransform)
+                      TransformReferenceBox& aRefBox)
 {
   MOZ_ASSERT(aData->Count() == 4, "Invalid array!");
 
   auto readTransform = [&](const nsCSSValue& aValue) -> Matrix4x4 {
     const nsCSSValueList* list = nullptr;
     switch (aValue.GetUnit()) {
       case eCSSUnit_List:
         // For Gecko style backend.
@@ -495,18 +494,17 @@ ProcessMatrixOperator(Matrix4x4& aMatrix
     Matrix4x4 matrix;
     if (!list) {
       return matrix;
     }
 
     float appUnitPerCSSPixel = AppUnitsPerCSSPixel();
     matrix = nsStyleTransformMatrix::ReadTransforms(list,
                                                     aRefBox,
-                                                    appUnitPerCSSPixel,
-                                                    aContains3dTransform);
+                                                    appUnitPerCSSPixel);
     return matrix;
   };
 
   Matrix4x4 matrix1 = readTransform(aData->Item(1));
   Matrix4x4 matrix2 = readTransform(aData->Item(2));
   double progress = aData->Item(3).GetPercentValue();
 
   // We cannot use GeckoComputedStyle to check if we use Servo backend because
@@ -522,32 +520,27 @@ ProcessMatrixOperator(Matrix4x4& aMatrix
   aMatrix =
     OperateTransformMatrix<Operator>(matrix1, matrix2, progress) * aMatrix;
 }
 
 /* Helper function to process two matrices that we need to interpolate between */
 void
 ProcessInterpolateMatrix(Matrix4x4& aMatrix,
                          const nsCSSValue::Array* aData,
-                         TransformReferenceBox& aRefBox,
-                         bool* aContains3dTransform)
+                         TransformReferenceBox& aRefBox)
 {
-  ProcessMatrixOperator<Interpolate>(aMatrix, aData,
-                                     aRefBox,
-                                     aContains3dTransform);
+  ProcessMatrixOperator<Interpolate>(aMatrix, aData, aRefBox);
 }
 
 void
 ProcessAccumulateMatrix(Matrix4x4& aMatrix,
                         const nsCSSValue::Array* aData,
-                        TransformReferenceBox& aRefBox,
-                        bool* aContains3dTransform)
+                        TransformReferenceBox& aRefBox)
 {
-  ProcessMatrixOperator<Accumulate>(aMatrix, aData, aRefBox,
-                                    aContains3dTransform);
+  ProcessMatrixOperator<Accumulate>(aMatrix, aData, aRefBox);
 }
 
 /* Helper function to process a translatex function. */
 static void
 ProcessTranslateX(Matrix4x4& aMatrix,
                   const nsCSSValue::Array* aData,
                   TransformReferenceBox& aRefBox)
 {
@@ -780,102 +773,88 @@ ProcessPerspective(Matrix4x4& aMatrix, c
 
 /**
  * SetToTransformFunction is essentially a giant switch statement that fans
  * out to many smaller helper functions.
  */
 static void
 MatrixForTransformFunction(Matrix4x4& aMatrix,
                            const nsCSSValue::Array * aData,
-                           TransformReferenceBox& aRefBox,
-                           bool* aContains3dTransform)
+                           TransformReferenceBox& aRefBox)
 {
-  MOZ_ASSERT(aContains3dTransform);
   MOZ_ASSERT(aData, "Why did you want to get data from a null array?");
 
   /* Get the keyword for the transform. */
   switch (TransformFunctionOf(aData)) {
   case eCSSKeyword_translatex:
     ProcessTranslateX(aMatrix, aData, aRefBox);
     break;
   case eCSSKeyword_translatey:
     ProcessTranslateY(aMatrix, aData, aRefBox);
     break;
   case eCSSKeyword_translatez:
-    *aContains3dTransform = true;
     ProcessTranslateZ(aMatrix, aData);
     break;
   case eCSSKeyword_translate:
     ProcessTranslate(aMatrix, aData, aRefBox);
     break;
   case eCSSKeyword_translate3d:
-    *aContains3dTransform = true;
     ProcessTranslate3D(aMatrix, aData, aRefBox);
     break;
   case eCSSKeyword_scalex:
     ProcessScaleX(aMatrix, aData);
     break;
   case eCSSKeyword_scaley:
     ProcessScaleY(aMatrix, aData);
     break;
   case eCSSKeyword_scalez:
-    *aContains3dTransform = true;
     ProcessScaleZ(aMatrix, aData);
     break;
   case eCSSKeyword_scale:
     ProcessScale(aMatrix, aData);
     break;
   case eCSSKeyword_scale3d:
-    *aContains3dTransform = true;
     ProcessScale3D(aMatrix, aData);
     break;
   case eCSSKeyword_skewx:
     ProcessSkewX(aMatrix, aData);
     break;
   case eCSSKeyword_skewy:
     ProcessSkewY(aMatrix, aData);
     break;
   case eCSSKeyword_skew:
     ProcessSkew(aMatrix, aData);
     break;
   case eCSSKeyword_rotatex:
-    *aContains3dTransform = true;
     ProcessRotateX(aMatrix, aData);
     break;
   case eCSSKeyword_rotatey:
-    *aContains3dTransform = true;
     ProcessRotateY(aMatrix, aData);
     break;
   case eCSSKeyword_rotatez:
-    *aContains3dTransform = true;
     MOZ_FALLTHROUGH;
   case eCSSKeyword_rotate:
     ProcessRotateZ(aMatrix, aData);
     break;
   case eCSSKeyword_rotate3d:
-    *aContains3dTransform = true;
     ProcessRotate3D(aMatrix, aData);
     break;
   case eCSSKeyword_matrix:
     ProcessMatrix(aMatrix, aData, aRefBox);
     break;
   case eCSSKeyword_matrix3d:
-    *aContains3dTransform = true;
     ProcessMatrix3D(aMatrix, aData, aRefBox);
     break;
   case eCSSKeyword_interpolatematrix:
-    ProcessMatrixOperator<Interpolate>(aMatrix, aData, aRefBox,
-                                       aContains3dTransform);
+    ProcessMatrixOperator<Interpolate>(aMatrix, aData, aRefBox);
     break;
   case eCSSKeyword_accumulatematrix:
-    ProcessMatrixOperator<Accumulate>(aMatrix, aData, aRefBox,
-                                      aContains3dTransform);
+    ProcessMatrixOperator<Accumulate>(aMatrix, aData, aRefBox);
     break;
   case eCSSKeyword_perspective:
-    *aContains3dTransform = true;
     ProcessPerspective(aMatrix, aData);
     break;
   default:
     MOZ_ASSERT_UNREACHABLE("Unknown transform function!");
   }
 }
 
 /**
@@ -913,80 +892,75 @@ SetIdentityMatrix(nsCSSValue::Array* aMa
   for (size_t i = 0; i < 16; ++i) {
     aMatrix->Item(i + 1).SetFloatValue(m.components[i], eCSSUnit_Number);
   }
 }
 
 static void
 ReadTransformsImpl(Matrix4x4& aMatrix,
                    const nsCSSValueList* aList,
-                   TransformReferenceBox& aRefBox,
-                   bool* aContains3dTransform)
+                   TransformReferenceBox& aRefBox)
 {
   for (const nsCSSValueList* curr = aList; curr != nullptr; curr = curr->mNext) {
     const nsCSSValue &currElem = curr->mValue;
     if (currElem.GetUnit() != eCSSUnit_Function) {
       NS_ASSERTION(currElem.GetUnit() == eCSSUnit_None &&
                    !aList->mNext,
                    "stream should either be a list of functions or a "
                    "lone None");
       continue;
     }
     NS_ASSERTION(currElem.GetArrayValue()->Count() >= 1,
                  "Incoming function is too short!");
 
     /* Read in a single transform matrix. */
-    MatrixForTransformFunction(aMatrix, currElem.GetArrayValue(), aRefBox,
-                               aContains3dTransform);
+    MatrixForTransformFunction(aMatrix, currElem.GetArrayValue(), aRefBox);
   }
 }
 
 Matrix4x4
 ReadTransforms(const nsCSSValueList* aList,
                TransformReferenceBox& aRefBox,
-               float aAppUnitsPerMatrixUnit,
-               bool* aContains3dTransform)
+               float aAppUnitsPerMatrixUnit)
 {
   Matrix4x4 result;
-  ReadTransformsImpl(result, aList, aRefBox, aContains3dTransform);
+  ReadTransformsImpl(result, aList, aRefBox);
 
   float scale = float(AppUnitsPerCSSPixel()) / aAppUnitsPerMatrixUnit;
   result.PreScale(1/scale, 1/scale, 1/scale);
   result.PostScale(scale, scale, scale);
 
   return result;
 }
 
 Matrix4x4
 ReadTransforms(const nsCSSValueList* aIndividualTransforms,
                const Maybe<MotionPathData>& aMotion,
                const nsCSSValueList* aTransform,
                TransformReferenceBox& aRefBox,
-               float aAppUnitsPerMatrixUnit,
-               bool* aContains3dTransform)
+               float aAppUnitsPerMatrixUnit)
 {
   Matrix4x4 result;
 
   if (aIndividualTransforms) {
-    ReadTransformsImpl(result, aIndividualTransforms, aRefBox,
-                       aContains3dTransform);
+    ReadTransformsImpl(result, aIndividualTransforms, aRefBox);
   }
 
   if (aMotion.isSome()) {
     // Create the equivalent translate and rotate function, according to the
     // order in spec. We combine the translate and then the rotate.
     // https://drafts.fxtf.org/motion-1/#calculating-path-transform
     result.PreTranslate(aMotion->mTranslate.x, aMotion->mTranslate.y, 0.0);
     if (aMotion->mRotate != 0.0) {
       result.RotateZ(aMotion->mRotate);
     }
   }
 
   if (aTransform) {
-    ReadTransformsImpl(result, aTransform, aRefBox, aContains3dTransform);
+    ReadTransformsImpl(result, aTransform, aRefBox);
   }
 
   float scale = float(AppUnitsPerCSSPixel()) / aAppUnitsPerMatrixUnit;
   result.PreScale(1/scale, 1/scale, 1/scale);
   result.PostScale(scale, scale, scale);
 
   return result;
 }
@@ -1343,23 +1317,21 @@ CSSValueArrayTo3DMatrix(nsCSSValue::Arra
 
 Size
 GetScaleValue(const nsCSSValueSharedList* aList,
               const nsIFrame* aForFrame)
 {
   MOZ_ASSERT(aList && aList->mHead);
   MOZ_ASSERT(aForFrame);
 
-  bool dontCareBool;
   TransformReferenceBox refBox(aForFrame);
   Matrix4x4 transform = ReadTransforms(
                           aList->mHead,
                           refBox,
-                          aForFrame->PresContext()->AppUnitsPerDevPixel(),
-                          &dontCareBool);
+                          aForFrame->PresContext()->AppUnitsPerDevPixel());
   Matrix transform2d;
   bool canDraw2D = transform.CanDraw2D(&transform2d);
   if (!canDraw2D) {
     return Size();
   }
 
   return transform2d.ScaleFactors(true);
 }
--- a/layout/style/nsStyleTransformMatrix.h
+++ b/layout/style/nsStyleTransformMatrix.h
@@ -171,53 +171,46 @@ namespace nsStyleTransformMatrix {
 
   float ProcessTranslatePart(const nsCSSValue& aValue,
                              TransformReferenceBox* aRefBox,
                              TransformReferenceBox::DimensionGetter aDimensionGetter = nullptr);
 
   void
   ProcessInterpolateMatrix(mozilla::gfx::Matrix4x4& aMatrix,
                            const nsCSSValue::Array* aData,
-                           TransformReferenceBox& aBounds,
-                           bool* aContains3dTransform);
+                           TransformReferenceBox& aBounds);
 
   void
   ProcessAccumulateMatrix(mozilla::gfx::Matrix4x4& aMatrix,
                           const nsCSSValue::Array* aData,
-                          TransformReferenceBox& aBounds,
-                          bool* aContains3dTransform);
+                          TransformReferenceBox& aBounds);
 
 
   /**
    * Given an nsCSSValueList containing -moz-transform functions,
    * returns a matrix containing the value of those functions.
    *
    * @param aData The nsCSSValueList containing the transform functions
    * @param aBounds The frame's bounding rectangle.
    * @param aAppUnitsPerMatrixUnit The number of app units per device pixel.
-   * @param aContains3dTransform [out] Set to true if aList contains at least
-   *   one 3d transform function (as defined in the CSS transforms
-   *   specification), false otherwise.
    *
    * eCSSUnit_Pixel (as they are in an StyleAnimationValue)
    */
   mozilla::gfx::Matrix4x4 ReadTransforms(const nsCSSValueList* aList,
                                          TransformReferenceBox& aBounds,
-                                         float aAppUnitsPerMatrixUnit,
-                                         bool* aContains3dTransform);
+                                         float aAppUnitsPerMatrixUnit);
 
   // Generate the gfx::Matrix for CSS Transform Module Level 2.
   // https://drafts.csswg.org/css-transforms-2/#ctm
   mozilla::gfx::Matrix4x4
   ReadTransforms(const nsCSSValueList* aIndividualTransforms,
                  const mozilla::Maybe<mozilla::MotionPathData>& aMotion,
                  const nsCSSValueList* aTransform,
                  TransformReferenceBox& aRefBox,
-                 float aAppUnitsPerMatrixUnit,
-                 bool* aContains3dTransform);
+                 float aAppUnitsPerMatrixUnit);
 
   /**
    * Given two nsStyleCoord values, compute the 2d position with respect to the
    * given TransformReferenceBox that these values describe, in device pixels.
    */
   mozilla::gfx::Point Convert2DPosition(nsStyleCoord const (&aValue)[2],
                                         TransformReferenceBox& aRefBox,
                                         int32_t aAppUnitsPerDevPixel);