Backed out changeset 61d064c78aa2 (bug 1311244)
authorCarsten "Tomcat" Book <cbook@mozilla.com>
Thu, 12 Jan 2017 14:19:24 +0100
changeset 329108 a89f21c7063895c61067492f62663fafc2e60505
parent 329107 e87193dc451d0b88637e61b6e591aaad30a69041
child 329109 fa7b1eb59660d91513ed88ae1ad01e34c32892d1
push id31198
push userkwierso@gmail.com
push dateThu, 12 Jan 2017 23:39:49 +0000
treeherdermozilla-central@721c28b39396 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1311244
milestone53.0a1
backs out61d064c78aa2026194a6531f2d94ccbb9f0f7ac3
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
Backed out changeset 61d064c78aa2 (bug 1311244)
layout/base/ShapeUtils.cpp
layout/base/ShapeUtils.h
layout/svg/nsCSSClipPathInstance.cpp
--- a/layout/base/ShapeUtils.cpp
+++ b/layout/base/ShapeUtils.cpp
@@ -3,19 +3,16 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "mozilla/ShapeUtils.h"
 
 #include <cstdlib>
 
-#include "nsCSSRendering.h"
-#include "nsStyleStruct.h"
-
 namespace mozilla {
 
 nscoord
 ShapeUtils::ComputeShapeRadius(const StyleShapeRadius aType,
                                const nscoord aCenter,
                                const nscoord aPosMin,
                                const nscoord aPosMax)
 {
@@ -28,21 +25,9 @@ ShapeUtils::ComputeShapeRadius(const Sty
       break;
     case StyleShapeRadius::ClosestSide:
       length = dist1 > dist2 ? dist2 : dist1;
       break;
   }
   return length;
 }
 
-nsPoint
-ShapeUtils::ComputeCircleOrEllipseCenter(StyleBasicShape* const aBasicShape,
-                                         const nsRect& aRefBox)
-{
-  nsPoint topLeft, anchor;
-  nsSize size(aRefBox.Size());
-  nsImageRenderer::ComputeObjectAnchorPoint(aBasicShape->GetPosition(),
-                                            size, size,
-                                            &topLeft, &anchor);
-  return nsPoint(anchor.x + aRefBox.x, anchor.y + aRefBox.y);
-}
-
 } // namespace mozilla
--- a/layout/base/ShapeUtils.h
+++ b/layout/base/ShapeUtils.h
@@ -5,21 +5,17 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef mozilla_ShapeUtils_h
 #define mozilla_ShapeUtils_h
 
 #include "nsCoord.h"
 #include "nsStyleConsts.h"
 
-struct nsPoint;
-struct nsRect;
-
 namespace mozilla {
-class StyleBasicShape;
 
 // ShapeUtils is a namespace class containing utility functions related to
 // processing basic shapes in the CSS Shapes Module.
 // https://drafts.csswg.org/css-shapes/#basic-shape-functions
 //
 struct ShapeUtils final
 {
   // Compute the length of a keyword <shape-radius>, i.e. closest-side or
@@ -27,21 +23,13 @@ struct ShapeUtils final
   // caller needs to call for both dimensions and combine the result.
   // https://drafts.csswg.org/css-shapes/#typedef-shape-radius.
   //
   // @return The length of the radius in app units.
   static nscoord ComputeShapeRadius(const StyleShapeRadius aType,
                                     const nscoord aCenter,
                                     const nscoord aPosMin,
                                     const nscoord aPosMax);
-
-  // Compute the center of a circle or an ellipse.
-  //
-  // @param aRefBox The reference box of the basic shape.
-  // @return The point of the center.
-  static nsPoint ComputeCircleOrEllipseCenter(
-    StyleBasicShape* const aBasicShape,
-    const nsRect& aRefBox);
 };
 
 } // namespace mozilla
 
 #endif // mozilla_ShapeUtils_h
--- a/layout/svg/nsCSSClipPathInstance.cpp
+++ b/layout/svg/nsCSSClipPathInstance.cpp
@@ -108,18 +108,22 @@ nsCSSClipPathInstance::CreateClipPath(Dr
 already_AddRefed<Path>
 nsCSSClipPathInstance::CreateClipPathCircle(DrawTarget* aDrawTarget,
                                             const nsRect& aRefBox)
 {
   StyleBasicShape* basicShape = mClipPathStyle.GetBasicShape();
 
   RefPtr<PathBuilder> builder = aDrawTarget->CreatePathBuilder();
 
-  nsPoint center =
-    ShapeUtils::ComputeCircleOrEllipseCenter(basicShape, aRefBox);
+  nsPoint topLeft, anchor;
+  nsSize size = nsSize(aRefBox.width, aRefBox.height);
+  nsImageRenderer::ComputeObjectAnchorPoint(basicShape->GetPosition(),
+                                            size, size,
+                                            &topLeft, &anchor);
+  nsPoint center(anchor.x + aRefBox.x, anchor.y + aRefBox.y);
 
   const nsTArray<nsStyleCoord>& coords = basicShape->Coordinates();
   MOZ_ASSERT(coords.Length() == 1, "wrong number of arguments");
   nscoord r = 0;
   if (coords[0].GetUnit() == eStyleUnit_Enumerated) {
     const auto styleShapeRadius = coords[0].GetEnumValue<StyleShapeRadius>();
     nscoord horizontal =
       ShapeUtils::ComputeShapeRadius(styleShapeRadius, center.x, aRefBox.x,
@@ -154,18 +158,22 @@ nsCSSClipPathInstance::CreateClipPathCir
 already_AddRefed<Path>
 nsCSSClipPathInstance::CreateClipPathEllipse(DrawTarget* aDrawTarget,
                                              const nsRect& aRefBox)
 {
   StyleBasicShape* basicShape = mClipPathStyle.GetBasicShape();
 
   RefPtr<PathBuilder> builder = aDrawTarget->CreatePathBuilder();
 
-  nsPoint center =
-    ShapeUtils::ComputeCircleOrEllipseCenter(basicShape, aRefBox);
+  nsPoint topLeft, anchor;
+  nsSize size = nsSize(aRefBox.width, aRefBox.height);
+  nsImageRenderer::ComputeObjectAnchorPoint(basicShape->GetPosition(),
+                                            size, size,
+                                            &topLeft, &anchor);
+  nsPoint center(anchor.x + aRefBox.x, anchor.y + aRefBox.y);
 
   const nsTArray<nsStyleCoord>& coords = basicShape->Coordinates();
   MOZ_ASSERT(coords.Length() == 2, "wrong number of arguments");
   nscoord rx = 0, ry = 0;
   if (coords[0].GetUnit() == eStyleUnit_Enumerated) {
     rx = ShapeUtils::ComputeShapeRadius(coords[0].GetEnumValue<StyleShapeRadius>(),
                                         center.x,
                                         aRefBox.x,