diff --git a/layout/base/ShapeUtils.cpp b/layout/base/ShapeUtils.cpp index ea41617e7cb9..e671d1bbbd60 100644 --- a/layout/base/ShapeUtils.cpp +++ b/layout/base/ShapeUtils.cpp @@ -8,9 +8,6 @@ #include -#include "nsCSSRendering.h" -#include "nsStyleStruct.h" - namespace mozilla { nscoord @@ -33,16 +30,4 @@ ShapeUtils::ComputeShapeRadius(const StyleShapeRadius aType, 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 diff --git a/layout/base/ShapeUtils.h b/layout/base/ShapeUtils.h index e763fec8c3d1..3f051c2d0ff6 100644 --- a/layout/base/ShapeUtils.h +++ b/layout/base/ShapeUtils.h @@ -10,11 +10,7 @@ #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. @@ -32,14 +28,6 @@ struct ShapeUtils final 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 diff --git a/layout/svg/nsCSSClipPathInstance.cpp b/layout/svg/nsCSSClipPathInstance.cpp index a8440908f675..d51d074c26d9 100644 --- a/layout/svg/nsCSSClipPathInstance.cpp +++ b/layout/svg/nsCSSClipPathInstance.cpp @@ -113,8 +113,12 @@ nsCSSClipPathInstance::CreateClipPathCircle(DrawTarget* aDrawTarget, RefPtr 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& coords = basicShape->Coordinates(); MOZ_ASSERT(coords.Length() == 1, "wrong number of arguments"); @@ -159,8 +163,12 @@ nsCSSClipPathInstance::CreateClipPathEllipse(DrawTarget* aDrawTarget, RefPtr 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& coords = basicShape->Coordinates(); MOZ_ASSERT(coords.Length() == 2, "wrong number of arguments");