Bug 827172: Move SVGPathElement to mozilla::dom r=bz
☠☠ backed out by fe51ccc53083 ☠ ☠
authorDavid Zbarsky <dzbarsky@gmail.com>
Fri, 11 Jan 2013 02:15:05 -0500
changeset 118544 7f4f96dbf94f8aa0ccf67ae242bb1fe08098617b
parent 118543 661847c6e48ba0cd1a6bb2f22c7d4055c8269548
child 118545 b40ebe8c52739232f7743b0db43c633e5f9e3754
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
reviewersbz
bugs827172
milestone21.0a1
Bug 827172: Move SVGPathElement to mozilla::dom r=bz
content/svg/content/src/Makefile.in
content/svg/content/src/SVGMPathElement.cpp
content/svg/content/src/SVGMPathElement.h
content/svg/content/src/SVGMotionSMILAnimationFunction.cpp
content/svg/content/src/SVGMotionSMILType.cpp
content/svg/content/src/SVGPathElement.cpp
content/svg/content/src/SVGPathElement.h
content/svg/content/src/nsSVGPathDataParser.cpp
content/svg/content/src/nsSVGPathElement.cpp
content/svg/content/src/nsSVGPathElement.h
layout/svg/nsSVGGeometryFrame.cpp
layout/svg/nsSVGTextFrame.cpp
layout/svg/nsSVGTextPathFrame.cpp
layout/svg/nsSVGUtils.cpp
--- a/content/svg/content/src/Makefile.in
+++ b/content/svg/content/src/Makefile.in
@@ -51,17 +51,16 @@ CPPSRCS		= \
 		nsSVGInteger.cpp \
 		nsSVGIntegerPair.cpp \
 		nsSVGLength2.cpp \
 		nsSVGMarkerElement.cpp \
 		nsSVGMaskElement.cpp \
 		nsSVGNumber2.cpp \
 		nsSVGNumberPair.cpp \
 		nsSVGPathDataParser.cpp \
-		nsSVGPathElement.cpp \
 		nsSVGPathGeometryElement.cpp \
 		nsSVGPatternElement.cpp \
 		nsSVGPolyElement.cpp \
 		nsSVGString.cpp \
 		nsSVGRect.cpp \
 		nsSVGSymbolElement.cpp \
 		nsSVGUnknownElement.cpp \
 		nsSVGUseElement.cpp \
@@ -104,16 +103,17 @@ CPPSRCS		= \
 		SVGMotionSMILAnimationFunction.cpp \
 		SVGMotionSMILPathUtils.cpp \
 		SVGMPathElement.cpp \
 		SVGNumberList.cpp \
 		SVGNumberListSMILType.cpp \
 		SVGNumberPairSMILType.cpp \
 		SVGOrientSMILType.cpp \
 		SVGPathData.cpp \
+		SVGPathElement.cpp \
 		SVGPathSegUtils.cpp \
 		SVGPathSegListSMILType.cpp \
 		SVGPointList.cpp \
 		SVGPointListSMILType.cpp \
 		SVGPolygonElement.cpp \
 		SVGPolylineElement.cpp \
 		SVGPreserveAspectRatio.cpp \
 		SVGRectElement.cpp \
@@ -169,16 +169,17 @@ EXPORTS_mozilla/dom = \
 	SVGForeignObjectElement.h \
 	SVGGElement.h \
 	SVGGraphicsElement.h \
 	SVGImageElement.h \
 	SVGLineElement.h \
 	SVGLocatableElement.h \
 	SVGMetadataElement.h \
 	SVGMPathElement.h \
+	SVGPathElement.h \
 	SVGPolygonElement.h \
 	SVGPolylineElement.h \
 	SVGRectElement.h \
 	SVGScriptElement.h \
 	SVGSetElement.h \
 	SVGStopElement.h \
 	SVGStyleElement.h \
 	SVGSVGElement.h \
--- a/content/svg/content/src/SVGMPathElement.cpp
+++ b/content/svg/content/src/SVGMPathElement.cpp
@@ -3,18 +3,18 @@
  * 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/Util.h"
 
 #include "mozilla/dom/SVGMPathElement.h"
 #include "nsAutoPtr.h"
 #include "nsDebug.h"
-#include "nsSVGPathElement.h"
 #include "mozilla/dom/SVGAnimateMotionElement.h"
+#include "mozilla/dom/SVGPathElement.h"
 #include "nsContentUtils.h"
 #include "mozilla/dom/SVGMPathElementBinding.h"
 
 DOMCI_NODE_DATA(SVGMpathElement, mozilla::dom::SVGMPathElement)
 
 NS_IMPL_NS_NEW_NAMESPACED_SVG_ELEMENT(MPath)
 
 namespace mozilla {
@@ -198,29 +198,29 @@ SVGMPathElement::AttributeChanged(nsIDoc
       NotifyParentOfMpathChange(GetParent());
     }
   }
 }
 
 //----------------------------------------------------------------------
 // Public helper methods
 
-nsSVGPathElement*
+SVGPathElement*
 SVGMPathElement::GetReferencedPath()
 {
   if (!HasAttr(kNameSpaceID_XLink, nsGkAtoms::href)) {
     NS_ABORT_IF_FALSE(!mHrefTarget.get(),
                       "We shouldn't have an xlink:href target "
                       "if we don't have an xlink:href attribute");
     return nullptr;
   }
 
   nsIContent* genericTarget = mHrefTarget.get();
   if (genericTarget && genericTarget->IsSVG(nsGkAtoms::path)) {
-    return static_cast<nsSVGPathElement*>(genericTarget);
+    return static_cast<SVGPathElement*>(genericTarget);
   }
   return nullptr;
 }
 
 //----------------------------------------------------------------------
 // Protected helper methods
 
 void
--- a/content/svg/content/src/SVGMPathElement.h
+++ b/content/svg/content/src/SVGMPathElement.h
@@ -5,27 +5,27 @@
 
 #ifndef mozilla_dom_SVGMPathElement_h
 #define mozilla_dom_SVGMPathElement_h
 
 #include "nsIDOMSVGMpathElement.h"
 #include "nsIDOMSVGURIReference.h"
 #include "nsSVGElement.h"
 #include "nsStubMutationObserver.h"
-#include "nsSVGPathElement.h"
 #include "nsSVGString.h"
 #include "nsReferencedElement.h"
 
 nsresult NS_NewSVGMPathElement(nsIContent **aResult,
                                already_AddRefed<nsINodeInfo> aNodeInfo);
 
 typedef nsSVGElement SVGMPathElementBase;
 
 namespace mozilla {
 namespace dom {
+class SVGPathElement;
 
 class SVGMPathElement MOZ_FINAL : public SVGMPathElementBase,
                                   public nsIDOMSVGMpathElement,
                                   public nsIDOMSVGURIReference,
                                   public nsStubMutationObserver
 {
 protected:
   friend nsresult (::NS_NewSVGMPathElement(nsIContent **aResult,
@@ -64,17 +64,17 @@ public:
   virtual bool ParseAttribute(int32_t aNamespaceID,
                                 nsIAtom* aAttribute,
                                 const nsAString& aValue,
                                 nsAttrValue& aResult);
 
   // Public helper method: If our xlink:href attribute links to a <path>
   // element, this method returns a pointer to that element. Otherwise,
   // this returns nullptr.
-  nsSVGPathElement* GetReferencedPath();
+  SVGPathElement* GetReferencedPath();
 
   virtual nsXPCClassInfo* GetClassInfo();
 
   virtual nsIDOMNode* AsDOMNode() { return this; }
 
   // WebIDL
   already_AddRefed<nsIDOMSVGAnimatedString> Href();
 
--- a/content/svg/content/src/SVGMotionSMILAnimationFunction.cpp
+++ b/content/svg/content/src/SVGMotionSMILAnimationFunction.cpp
@@ -5,18 +5,18 @@
 
 #include "SVGMotionSMILAnimationFunction.h"
 #include "nsISMILAnimationElement.h"
 #include "nsSMILParserUtils.h"
 #include "nsSVGAngle.h"
 #include "SVGMotionSMILType.h"
 #include "SVGMotionSMILPathUtils.h"
 #include "nsSVGPathDataParser.h"
-#include "nsSVGPathElement.h" // for nsSVGPathList
-#include "SVGMPathElement.h"
+#include "mozilla/dom/SVGPathElement.h" // for nsSVGPathList
+#include "mozilla/dom/SVGMPathElement.h"
 #include "nsAttrValueInlines.h"
 
 namespace mozilla {
 
 using namespace dom;
 
 SVGMotionSMILAnimationFunction::SVGMotionSMILAnimationFunction()
   : mRotateType(eRotateType_Explicit),
@@ -212,17 +212,17 @@ SVGMotionSMILAnimationFunction::
 
 void
 SVGMotionSMILAnimationFunction::
   RebuildPathAndVerticesFromMpathElem(SVGMPathElement* aMpathElem)
 {
   mPathSourceType = ePathSourceType_Mpath;
 
   // Use the path that's the target of our chosen <mpath> child.
-  nsSVGPathElement* pathElem = aMpathElem->GetReferencedPath();
+  SVGPathElement* pathElem = aMpathElem->GetReferencedPath();
   if (pathElem) {
     const SVGPathData &path = pathElem->GetAnimPathSegList()->GetAnimValue();
     // Path data must contain of at least one path segment (if the path data
     // doesn't begin with a valid "M", then it's invalid).
     if (path.Length()) {
       bool ok =
         path.GetDistancesFromOriginToEndsOfVisibleSegments(&mPathVertices);
       if (ok && mPathVertices.Length()) {
--- a/content/svg/content/src/SVGMotionSMILType.cpp
+++ b/content/svg/content/src/SVGMotionSMILType.cpp
@@ -3,18 +3,20 @@
  * 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/. */
 
 /* implementation of nsISMILType for use by <animateMotion> element */
 
 #include "SVGMotionSMILType.h"
 #include "nsSMILValue.h"
 #include "nsDebug.h"
-#include "nsSVGPathElement.h"
 #include "nsMathUtils.h"
+#include "nsISupportsUtils.h"
+#include "gfxPath.h"
+#include "nsTArray.h"
 #include <math.h>
 
 namespace mozilla {
 
 /*static*/ SVGMotionSMILType SVGMotionSMILType::sSingleton;
 
 
 // Helper enum, for distinguishing between types of MotionSegment structs
rename from content/svg/content/src/nsSVGPathElement.cpp
rename to content/svg/content/src/SVGPathElement.cpp
--- a/content/svg/content/src/nsSVGPathElement.cpp
+++ b/content/svg/content/src/SVGPathElement.cpp
@@ -5,84 +5,85 @@
 
 #include "mozilla/Util.h"
 
 #include "nsGkAtoms.h"
 #include "DOMSVGPathSeg.h"
 #include "DOMSVGPathSegList.h"
 #include "nsCOMPtr.h"
 #include "nsContentUtils.h"
-#include "nsSVGPathElement.h"
+#include "mozilla/dom/SVGPathElement.h"
 #include "DOMSVGPoint.h"
 #include "gfxContext.h"
 
-using namespace mozilla;
+DOMCI_NODE_DATA(SVGPathElement, mozilla::dom::SVGPathElement)
+
+NS_IMPL_NS_NEW_NAMESPACED_SVG_ELEMENT(Path)
 
-nsSVGElement::NumberInfo nsSVGPathElement::sNumberInfo = 
+namespace mozilla {
+namespace dom {
+
+nsSVGElement::NumberInfo SVGPathElement::sNumberInfo = 
 { &nsGkAtoms::pathLength, 0, false };
 
-NS_IMPL_NS_NEW_SVG_ELEMENT(Path)
-
 //----------------------------------------------------------------------
 // nsISupports methods
 
-NS_IMPL_ADDREF_INHERITED(nsSVGPathElement,nsSVGPathElementBase)
-NS_IMPL_RELEASE_INHERITED(nsSVGPathElement,nsSVGPathElementBase)
+NS_IMPL_ADDREF_INHERITED(SVGPathElement,SVGPathElementBase)
+NS_IMPL_RELEASE_INHERITED(SVGPathElement,SVGPathElementBase)
 
-DOMCI_NODE_DATA(SVGPathElement, nsSVGPathElement)
-
-NS_INTERFACE_TABLE_HEAD(nsSVGPathElement)
-  NS_NODE_INTERFACE_TABLE5(nsSVGPathElement, nsIDOMNode, nsIDOMElement,
+NS_INTERFACE_TABLE_HEAD(SVGPathElement)
+  NS_NODE_INTERFACE_TABLE5(SVGPathElement, nsIDOMNode, nsIDOMElement,
                            nsIDOMSVGElement,
                            nsIDOMSVGPathElement, nsIDOMSVGAnimatedPathData)
   NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(SVGPathElement)
-NS_INTERFACE_MAP_END_INHERITING(nsSVGPathElementBase)
+NS_INTERFACE_MAP_END_INHERITING(SVGPathElementBase)
 
 //----------------------------------------------------------------------
 // Implementation
 
-nsSVGPathElement::nsSVGPathElement(already_AddRefed<nsINodeInfo> aNodeInfo)
-  : nsSVGPathElementBase(aNodeInfo)
+SVGPathElement::SVGPathElement(already_AddRefed<nsINodeInfo> aNodeInfo)
+  : SVGPathElementBase(aNodeInfo)
 {
 }
 
 //----------------------------------------------------------------------
 // nsIDOMNode methods
 
-NS_IMPL_ELEMENT_CLONE_WITH_INIT(nsSVGPathElement)
+NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGPathElement)
 
 //----------------------------------------------------------------------
 // nsIDOMSVGPathElement methods:
 
 /* readonly attribute nsIDOMSVGAnimatedNumber pathLength; */
 NS_IMETHODIMP
-nsSVGPathElement::GetPathLength(nsIDOMSVGAnimatedNumber * *aPathLength)
+SVGPathElement::GetPathLength(nsIDOMSVGAnimatedNumber * *aPathLength)
 {
   return mPathLength.ToDOMAnimatedNumber(aPathLength, this);
 }
 
 /* float getTotalLength (); */
 NS_IMETHODIMP
-nsSVGPathElement::GetTotalLength(float *_retval)
+SVGPathElement::GetTotalLength(float *_retval)
 {
   *_retval = 0;
 
   nsRefPtr<gfxFlattenedPath> flat = GetFlattenedPath(gfxMatrix());
 
   if (!flat)
     return NS_ERROR_FAILURE;
 
   *_retval = flat->GetLength();
 
   return NS_OK;
 }
 
 /* DOMSVGPoint getPointAtLength (in float distance); */
 NS_IMETHODIMP
-nsSVGPathElement::GetPointAtLength(float distance, nsISupports **_retval)
+SVGPathElement::GetPointAtLength(float distance, nsISupports **_retval)
 {
   NS_ENSURE_FINITE(distance, NS_ERROR_ILLEGAL_VALUE);
 
   nsRefPtr<gfxFlattenedPath> flat = GetFlattenedPath(gfxMatrix());
   if (!flat)
     return NS_ERROR_FAILURE;
 
   float totalLength = flat->GetLength();
@@ -97,299 +98,299 @@ nsSVGPathElement::GetPointAtLength(float
   distance = NS_MIN(totalLength, distance);
 
   NS_ADDREF(*_retval = new DOMSVGPoint(flat->FindPoint(gfxPoint(distance, 0))));
   return NS_OK;
 }
 
 /* unsigned long getPathSegAtLength (in float distance); */
 NS_IMETHODIMP
-nsSVGPathElement::GetPathSegAtLength(float distance, uint32_t *_retval)
+SVGPathElement::GetPathSegAtLength(float distance, uint32_t *_retval)
 {
   NS_ENSURE_FINITE(distance, NS_ERROR_ILLEGAL_VALUE);
   *_retval = mD.GetAnimValue().GetPathSegAtLength(distance);
   return NS_OK;
 }
 
 /* nsISupports createSVGPathSegClosePath (); */
 NS_IMETHODIMP
-nsSVGPathElement::CreateSVGPathSegClosePath(nsISupports **_retval)
+SVGPathElement::CreateSVGPathSegClosePath(nsISupports **_retval)
 {
   nsISupports* seg = NS_NewSVGPathSegClosePath();
   NS_ENSURE_TRUE(seg, NS_ERROR_OUT_OF_MEMORY);
   return CallQueryInterface(seg, _retval);
 }
 
 /* nsISupports createSVGPathSegMovetoAbs (in float x, in float y); */
 NS_IMETHODIMP
-nsSVGPathElement::CreateSVGPathSegMovetoAbs(float x, float y, nsISupports **_retval)
+SVGPathElement::CreateSVGPathSegMovetoAbs(float x, float y, nsISupports **_retval)
 {
   NS_ENSURE_FINITE2(x, y, NS_ERROR_ILLEGAL_VALUE);
   nsISupports* seg = NS_NewSVGPathSegMovetoAbs(x, y);
   NS_ENSURE_TRUE(seg, NS_ERROR_OUT_OF_MEMORY);
   return CallQueryInterface(seg, _retval);
 }
 
 /* nsISupports createSVGPathSegMovetoRel (in float x, in float y); */
 NS_IMETHODIMP
-nsSVGPathElement::CreateSVGPathSegMovetoRel(float x, float y, nsISupports **_retval)
+SVGPathElement::CreateSVGPathSegMovetoRel(float x, float y, nsISupports **_retval)
 {
   NS_ENSURE_FINITE2(x, y, NS_ERROR_ILLEGAL_VALUE);
   nsISupports* seg = NS_NewSVGPathSegMovetoRel(x, y);
   NS_ENSURE_TRUE(seg, NS_ERROR_OUT_OF_MEMORY);
   return CallQueryInterface(seg, _retval);
 }
 
 /* nsISupports createSVGPathSegLinetoAbs (in float x, in float y); */
 NS_IMETHODIMP
-nsSVGPathElement::CreateSVGPathSegLinetoAbs(float x, float y, nsISupports **_retval)
+SVGPathElement::CreateSVGPathSegLinetoAbs(float x, float y, nsISupports **_retval)
 {
   NS_ENSURE_FINITE2(x, y, NS_ERROR_ILLEGAL_VALUE);
   nsISupports* seg = NS_NewSVGPathSegLinetoAbs(x, y);
   NS_ENSURE_TRUE(seg, NS_ERROR_OUT_OF_MEMORY);
   return CallQueryInterface(seg, _retval);
 }
 
 /* nsISupports createSVGPathSegLinetoRel (in float x, in float y); */
 NS_IMETHODIMP
-nsSVGPathElement::CreateSVGPathSegLinetoRel(float x, float y, nsISupports **_retval)
+SVGPathElement::CreateSVGPathSegLinetoRel(float x, float y, nsISupports **_retval)
 {
   NS_ENSURE_FINITE2(x, y, NS_ERROR_ILLEGAL_VALUE);
   nsISupports* seg = NS_NewSVGPathSegLinetoRel(x, y);
   NS_ENSURE_TRUE(seg, NS_ERROR_OUT_OF_MEMORY);
   return CallQueryInterface(seg, _retval);
 }
 
 /* nsISupports createSVGPathSegCurvetoCubicAbs (in float x, in float y, in float x1, in float y1, in float x2, in float y2); */
 NS_IMETHODIMP
-nsSVGPathElement::CreateSVGPathSegCurvetoCubicAbs(float x, float y, float x1, float y1, float x2, float y2, nsISupports **_retval)
+SVGPathElement::CreateSVGPathSegCurvetoCubicAbs(float x, float y, float x1, float y1, float x2, float y2, nsISupports **_retval)
 {
   NS_ENSURE_FINITE6(x, y, x1, y1, x2, y2, NS_ERROR_ILLEGAL_VALUE);
   nsISupports* seg = NS_NewSVGPathSegCurvetoCubicAbs(x, y, x1, y1, x2, y2);
   NS_ENSURE_TRUE(seg, NS_ERROR_OUT_OF_MEMORY);
   return CallQueryInterface(seg, _retval);
 }
 
 /* nsISupports createSVGPathSegCurvetoCubicRel (in float x, in float y, in float x1, in float y1, in float x2, in float y2); */
 NS_IMETHODIMP
-nsSVGPathElement::CreateSVGPathSegCurvetoCubicRel(float x, float y, float x1, float y1, float x2, float y2, nsISupports **_retval)
+SVGPathElement::CreateSVGPathSegCurvetoCubicRel(float x, float y, float x1, float y1, float x2, float y2, nsISupports **_retval)
 {
   NS_ENSURE_FINITE6(x, y, x1, y1, x2, y2, NS_ERROR_ILLEGAL_VALUE);
   nsISupports* seg = NS_NewSVGPathSegCurvetoCubicRel(x, y, x1, y1, x2, y2);
   NS_ENSURE_TRUE(seg, NS_ERROR_OUT_OF_MEMORY);
   return CallQueryInterface(seg, _retval);
 }
 
 /* nsISupports createSVGPathSegCurvetoQuadraticAbs (in float x, in float y, in float x1, in float y1); */
 NS_IMETHODIMP
-nsSVGPathElement::CreateSVGPathSegCurvetoQuadraticAbs(float x, float y, float x1, float y1, nsISupports **_retval)
+SVGPathElement::CreateSVGPathSegCurvetoQuadraticAbs(float x, float y, float x1, float y1, nsISupports **_retval)
 {
   NS_ENSURE_FINITE4(x, y, x1, y1, NS_ERROR_ILLEGAL_VALUE);
   nsISupports* seg = NS_NewSVGPathSegCurvetoQuadraticAbs(x, y, x1, y1);
   NS_ENSURE_TRUE(seg, NS_ERROR_OUT_OF_MEMORY);
   return CallQueryInterface(seg, _retval);
 }
 
 /* nsISupports createSVGPathSegCurvetoQuadraticRel (in float x, in float y, in float x1, in float y1); */
 NS_IMETHODIMP
-nsSVGPathElement::CreateSVGPathSegCurvetoQuadraticRel(float x, float y, float x1, float y1, nsISupports **_retval)
+SVGPathElement::CreateSVGPathSegCurvetoQuadraticRel(float x, float y, float x1, float y1, nsISupports **_retval)
 {
   NS_ENSURE_FINITE4(x, y, x1, y1, NS_ERROR_ILLEGAL_VALUE);
   nsISupports* seg = NS_NewSVGPathSegCurvetoQuadraticRel(x, y, x1, y1);
   NS_ENSURE_TRUE(seg, NS_ERROR_OUT_OF_MEMORY);
   return CallQueryInterface(seg, _retval);
 }
 
 /* nsISupports createSVGPathSegArcAbs (in float x, in float y, in float r1, in float r2, in float angle, in boolean largeArcFlag, in boolean sweepFlag); */
 NS_IMETHODIMP
-nsSVGPathElement::CreateSVGPathSegArcAbs(float x, float y, float r1, float r2, float angle, bool largeArcFlag, bool sweepFlag, nsISupports **_retval)
+SVGPathElement::CreateSVGPathSegArcAbs(float x, float y, float r1, float r2, float angle, bool largeArcFlag, bool sweepFlag, nsISupports **_retval)
 {
   NS_ENSURE_FINITE5(x, y, r1, r2, angle, NS_ERROR_ILLEGAL_VALUE);
   nsISupports* seg = NS_NewSVGPathSegArcAbs(x, y, r1, r2, angle,
                                                  largeArcFlag, sweepFlag);
   NS_ENSURE_TRUE(seg, NS_ERROR_OUT_OF_MEMORY);
   return CallQueryInterface(seg, _retval);
 }
 
 /* nsISupports createSVGPathSegArcRel (in float x, in float y, in float r1, in float r2, in float angle, in boolean largeArcFlag, in boolean sweepFlag); */
 NS_IMETHODIMP
-nsSVGPathElement::CreateSVGPathSegArcRel(float x, float y, float r1, float r2, float angle, bool largeArcFlag, bool sweepFlag, nsISupports **_retval)
+SVGPathElement::CreateSVGPathSegArcRel(float x, float y, float r1, float r2, float angle, bool largeArcFlag, bool sweepFlag, nsISupports **_retval)
 {
   NS_ENSURE_FINITE5(x, y, r1, r2, angle, NS_ERROR_ILLEGAL_VALUE);
   nsISupports* seg = NS_NewSVGPathSegArcRel(x, y, r1, r2, angle,
                                                  largeArcFlag, sweepFlag);
   NS_ENSURE_TRUE(seg, NS_ERROR_OUT_OF_MEMORY);
   return CallQueryInterface(seg, _retval);
 }
 
 /* nsISupports createSVGPathSegLinetoHorizontalAbs (in float x); */
 NS_IMETHODIMP
-nsSVGPathElement::CreateSVGPathSegLinetoHorizontalAbs(float x, nsISupports **_retval)
+SVGPathElement::CreateSVGPathSegLinetoHorizontalAbs(float x, nsISupports **_retval)
 {
   NS_ENSURE_FINITE(x, NS_ERROR_ILLEGAL_VALUE);
   nsISupports* seg = NS_NewSVGPathSegLinetoHorizontalAbs(x);
   NS_ENSURE_TRUE(seg, NS_ERROR_OUT_OF_MEMORY);
   return CallQueryInterface(seg, _retval);
 }
 
 /* nsISupports createSVGPathSegLinetoHorizontalRel (in float x); */
 NS_IMETHODIMP
-nsSVGPathElement::CreateSVGPathSegLinetoHorizontalRel(float x, nsISupports **_retval)
+SVGPathElement::CreateSVGPathSegLinetoHorizontalRel(float x, nsISupports **_retval)
 {
   NS_ENSURE_FINITE(x, NS_ERROR_ILLEGAL_VALUE);
   nsISupports* seg = NS_NewSVGPathSegLinetoHorizontalRel(x);
   NS_ENSURE_TRUE(seg, NS_ERROR_OUT_OF_MEMORY);
   return CallQueryInterface(seg, _retval);
 }
 
 /* nsISupports createSVGPathSegLinetoVerticalAbs (in float y); */
 NS_IMETHODIMP
-nsSVGPathElement::CreateSVGPathSegLinetoVerticalAbs(float y, nsISupports **_retval)
+SVGPathElement::CreateSVGPathSegLinetoVerticalAbs(float y, nsISupports **_retval)
 {
   NS_ENSURE_FINITE(y, NS_ERROR_ILLEGAL_VALUE);
   nsISupports* seg = NS_NewSVGPathSegLinetoVerticalAbs(y);
   NS_ENSURE_TRUE(seg, NS_ERROR_OUT_OF_MEMORY);
   return CallQueryInterface(seg, _retval);
 }
 
 /* nsISupports createSVGPathSegLinetoVerticalRel (in float y); */
 NS_IMETHODIMP
-nsSVGPathElement::CreateSVGPathSegLinetoVerticalRel(float y, nsISupports **_retval)
+SVGPathElement::CreateSVGPathSegLinetoVerticalRel(float y, nsISupports **_retval)
 {
   NS_ENSURE_FINITE(y, NS_ERROR_ILLEGAL_VALUE);
   nsISupports* seg = NS_NewSVGPathSegLinetoVerticalRel(y);
   NS_ENSURE_TRUE(seg, NS_ERROR_OUT_OF_MEMORY);
   return CallQueryInterface(seg, _retval);
 }
 
 /* nsISupports createSVGPathSegCurvetoCubicSmoothAbs (in float x, in float y, in float x2, in float y2); */
 NS_IMETHODIMP
-nsSVGPathElement::CreateSVGPathSegCurvetoCubicSmoothAbs(float x, float y, float x2, float y2, nsISupports **_retval)
+SVGPathElement::CreateSVGPathSegCurvetoCubicSmoothAbs(float x, float y, float x2, float y2, nsISupports **_retval)
 {
   NS_ENSURE_FINITE4(x, y, x2, y2, NS_ERROR_ILLEGAL_VALUE);
   nsISupports* seg = NS_NewSVGPathSegCurvetoCubicSmoothAbs(x, y, x2, y2);
   NS_ENSURE_TRUE(seg, NS_ERROR_OUT_OF_MEMORY);
   return CallQueryInterface(seg, _retval);
 }
 
 /* nsISupports createSVGPathSegCurvetoCubicSmoothRel (in float x, in float y, in float x2, in float y2); */
 NS_IMETHODIMP
-nsSVGPathElement::CreateSVGPathSegCurvetoCubicSmoothRel(float x, float y, float x2, float y2, nsISupports **_retval)
+SVGPathElement::CreateSVGPathSegCurvetoCubicSmoothRel(float x, float y, float x2, float y2, nsISupports **_retval)
 {
   NS_ENSURE_FINITE4(x, y, x2, y2, NS_ERROR_ILLEGAL_VALUE);
   nsISupports* seg = NS_NewSVGPathSegCurvetoCubicSmoothRel(x, y, x2, y2);
   NS_ENSURE_TRUE(seg, NS_ERROR_OUT_OF_MEMORY);
   return CallQueryInterface(seg, _retval);
 }
 
 /* nsISupports createSVGPathSegCurvetoQuadraticSmoothAbs (in float x, in float y); */
 NS_IMETHODIMP
-nsSVGPathElement::CreateSVGPathSegCurvetoQuadraticSmoothAbs(float x, float y, nsISupports **_retval)
+SVGPathElement::CreateSVGPathSegCurvetoQuadraticSmoothAbs(float x, float y, nsISupports **_retval)
 {
   NS_ENSURE_FINITE2(x, y, NS_ERROR_ILLEGAL_VALUE);
   nsISupports* seg = NS_NewSVGPathSegCurvetoQuadraticSmoothAbs(x, y);
   NS_ENSURE_TRUE(seg, NS_ERROR_OUT_OF_MEMORY);
   return CallQueryInterface(seg, _retval);
 }
 
 /* nsISupports createSVGPathSegCurvetoQuadraticSmoothRel (in float x, in float y); */
 NS_IMETHODIMP
-nsSVGPathElement::CreateSVGPathSegCurvetoQuadraticSmoothRel(float x, float y, nsISupports **_retval)
+SVGPathElement::CreateSVGPathSegCurvetoQuadraticSmoothRel(float x, float y, nsISupports **_retval)
 {
   NS_ENSURE_FINITE2(x, y, NS_ERROR_ILLEGAL_VALUE);
   nsISupports* seg = NS_NewSVGPathSegCurvetoQuadraticSmoothRel(x, y);
   NS_ENSURE_TRUE(seg, NS_ERROR_OUT_OF_MEMORY);
   return CallQueryInterface(seg, _retval);
 }
 
 //----------------------------------------------------------------------
 // nsSVGElement methods
 
 /* virtual */ bool
-nsSVGPathElement::HasValidDimensions() const
+SVGPathElement::HasValidDimensions() const
 {
   return !mD.GetAnimValue().IsEmpty();
 }
 
 nsSVGElement::NumberAttributesInfo
-nsSVGPathElement::GetNumberInfo()
+SVGPathElement::GetNumberInfo()
 {
   return NumberAttributesInfo(&mPathLength, &sNumberInfo, 1);
 }
 
 //----------------------------------------------------------------------
 // nsIDOMSVGAnimatedPathData methods:
 
 /* readonly attribute DOMSVGPathSegList pathSegList; */
-NS_IMETHODIMP nsSVGPathElement::GetPathSegList(nsISupports * *aPathSegList)
+NS_IMETHODIMP SVGPathElement::GetPathSegList(nsISupports * *aPathSegList)
 {
   void *key = mD.GetBaseValKey();
   *aPathSegList = DOMSVGPathSegList::GetDOMWrapper(key, this, false).get();
   return *aPathSegList ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
 }
 
 /* readonly attribute DOMSVGPathSegList animatedPathSegList; */
-NS_IMETHODIMP nsSVGPathElement::GetAnimatedPathSegList(nsISupports * *aAnimatedPathSegList)
+NS_IMETHODIMP SVGPathElement::GetAnimatedPathSegList(nsISupports * *aAnimatedPathSegList)
 {
   void *key = mD.GetAnimValKey();
   *aAnimatedPathSegList =
     DOMSVGPathSegList::GetDOMWrapper(key, this, true).get();
   return *aAnimatedPathSegList ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
 }
 
 //----------------------------------------------------------------------
 // nsIContent methods
 
 NS_IMETHODIMP_(bool)
-nsSVGPathElement::IsAttributeMapped(const nsIAtom* name) const
+SVGPathElement::IsAttributeMapped(const nsIAtom* name) const
 {
   static const MappedAttributeEntry* const map[] = {
     sMarkersMap
   };
 
   return FindAttributeDependence(name, map) ||
-    nsSVGPathElementBase::IsAttributeMapped(name);
+    SVGPathElementBase::IsAttributeMapped(name);
 }
 
 already_AddRefed<gfxFlattenedPath>
-nsSVGPathElement::GetFlattenedPath(const gfxMatrix &aMatrix)
+SVGPathElement::GetFlattenedPath(const gfxMatrix &aMatrix)
 {
   return mD.GetAnimValue().ToFlattenedPath(aMatrix);
 }
 
 //----------------------------------------------------------------------
 // nsSVGPathGeometryElement methods
 
 bool
-nsSVGPathElement::AttributeDefinesGeometry(const nsIAtom *aName)
+SVGPathElement::AttributeDefinesGeometry(const nsIAtom *aName)
 {
   return aName == nsGkAtoms::d ||
          aName == nsGkAtoms::pathLength;
 }
 
 bool
-nsSVGPathElement::IsMarkable()
+SVGPathElement::IsMarkable()
 {
   return true;
 }
 
 void
-nsSVGPathElement::GetMarkPoints(nsTArray<nsSVGMark> *aMarks)
+SVGPathElement::GetMarkPoints(nsTArray<nsSVGMark> *aMarks)
 {
   mD.GetAnimValue().GetMarkerPositioningData(aMarks);
 }
 
 void
-nsSVGPathElement::ConstructPath(gfxContext *aCtx)
+SVGPathElement::ConstructPath(gfxContext *aCtx)
 {
   mD.GetAnimValue().ConstructPath(aCtx);
 }
 
 gfxFloat
-nsSVGPathElement::GetPathLengthScale(PathLengthScaleForType aFor)
+SVGPathElement::GetPathLengthScale(PathLengthScaleForType aFor)
 {
   NS_ABORT_IF_FALSE(aFor == eForTextPath || aFor == eForStroking,
                     "Unknown enum");
   if (mPathLength.IsExplicitlySet()) {
     float authorsPathLengthEstimate = mPathLength.GetAnimValue();
     if (authorsPathLengthEstimate > 0) {
       gfxMatrix matrix;
       if (aFor == eForTextPath) {
@@ -401,8 +402,11 @@ nsSVGPathElement::GetPathLengthScale(Pat
       nsRefPtr<gfxFlattenedPath> path = GetFlattenedPath(matrix);
       if (path) {
         return path->GetLength() / authorsPathLengthEstimate;
       }
     }
   }
   return 1.0;
 }
+
+} // namespace dom
+} // namespace mozilla
rename from content/svg/content/src/nsSVGPathElement.h
rename to content/svg/content/src/SVGPathElement.h
--- a/content/svg/content/src/nsSVGPathElement.h
+++ b/content/svg/content/src/SVGPathElement.h
@@ -1,49 +1,55 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* 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/. */
 
-#ifndef __NS_SVGPATHELEMENT_H__
-#define __NS_SVGPATHELEMENT_H__
+#ifndef mozilla_dom_SVGPathElement_h
+#define mozilla_dom_SVGPathElement_h
 
 #include "nsIDOMSVGAnimatedPathData.h"
 #include "nsIDOMSVGPathElement.h"
 #include "nsSVGNumber2.h"
 #include "nsSVGPathGeometryElement.h"
 #include "SVGAnimatedPathSegList.h"
 
+nsresult NS_NewSVGPathElement(nsIContent **aResult,
+                              already_AddRefed<nsINodeInfo> aNodeInfo);
+
 class gfxContext;
 
-typedef nsSVGPathGeometryElement nsSVGPathElementBase;
+typedef nsSVGPathGeometryElement SVGPathElementBase;
 
-class nsSVGPathElement : public nsSVGPathElementBase,
-                         public nsIDOMSVGPathElement,
-                         public nsIDOMSVGAnimatedPathData
+namespace mozilla {
+namespace dom {
+
+class SVGPathElement MOZ_FINAL : public SVGPathElementBase,
+                                 public nsIDOMSVGPathElement,
+                                 public nsIDOMSVGAnimatedPathData
 {
 friend class nsSVGPathFrame;
 
 protected:
-  friend nsresult NS_NewSVGPathElement(nsIContent **aResult,
-                                       already_AddRefed<nsINodeInfo> aNodeInfo);
-  nsSVGPathElement(already_AddRefed<nsINodeInfo> aNodeInfo);
+  friend nsresult (::NS_NewSVGPathElement(nsIContent **aResult,
+                                          already_AddRefed<nsINodeInfo> aNodeInfo));
+  SVGPathElement(already_AddRefed<nsINodeInfo> aNodeInfo);
 
 public:
-  typedef mozilla::SVGAnimatedPathSegList SVGAnimatedPathSegList;
+  typedef SVGAnimatedPathSegList SVGAnimatedPathSegList;
   // interfaces:
 
   NS_DECL_ISUPPORTS_INHERITED
   NS_DECL_NSIDOMSVGPATHELEMENT
   NS_DECL_NSIDOMSVGANIMATEDPATHDATA
 
   // xxx I wish we could use virtual inheritance
   NS_FORWARD_NSIDOMNODE_TO_NSINODE
   NS_FORWARD_NSIDOMELEMENT_TO_GENERIC
-  NS_FORWARD_NSIDOMSVGELEMENT(nsSVGPathElementBase::)
+  NS_FORWARD_NSIDOMSVGELEMENT(SVGPathElementBase::)
 
   // nsIContent interface
   NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom* name) const;
 
   // nsSVGSVGElement methods:
   virtual bool HasValidDimensions() const;
 
   // nsSVGPathGeometryElement methods:
@@ -86,9 +92,12 @@ protected:
   // nsSVGElement method
   virtual NumberAttributesInfo GetNumberInfo();
 
   SVGAnimatedPathSegList mD;
   nsSVGNumber2 mPathLength;
   static NumberInfo sNumberInfo;
 };
 
-#endif
+} // namespace dom
+} // namespace mozilla
+
+#endif // mozilla_dom_SVGPathElement_h
--- a/content/svg/content/src/nsSVGPathDataParser.cpp
+++ b/content/svg/content/src/nsSVGPathDataParser.cpp
@@ -1,16 +1,15 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* 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 "nsSVGPathDataParser.h"
 #include "nsSVGDataParser.h"
-#include "nsSVGPathElement.h"
 #include "prdtoa.h"
 #include "DOMSVGPathSeg.h"
 #include <stdlib.h>
 #include <math.h>
 
 using namespace mozilla;
 
 nsresult nsSVGPathDataParser::Match()
--- a/layout/svg/nsSVGGeometryFrame.cpp
+++ b/layout/svg/nsSVGGeometryFrame.cpp
@@ -7,17 +7,16 @@
 #include "nsSVGGeometryFrame.h"
 
 // Keep others in (case-insensitive) order:
 #include "gfxContext.h"
 #include "gfxSVGGlyphs.h"
 #include "nsPresContext.h"
 #include "nsSVGEffects.h"
 #include "nsSVGPaintServerFrame.h"
-#include "nsSVGPathElement.h"
 #include "nsSVGUtils.h"
 
 NS_IMPL_FRAMEARENA_HELPERS(nsSVGGeometryFrame)
 
 //----------------------------------------------------------------------
 // nsIFrame methods
 
 NS_IMETHODIMP
--- a/layout/svg/nsSVGTextFrame.cpp
+++ b/layout/svg/nsSVGTextFrame.cpp
@@ -7,17 +7,16 @@
 #include "nsSVGTextFrame.h"
 
 // Keep others in (case-insensitive) order:
 #include "nsGkAtoms.h"
 #include "nsIDOMSVGRect.h"
 #include "nsISVGGlyphFragmentNode.h"
 #include "nsSVGGlyphFrame.h"
 #include "nsSVGIntegrationUtils.h"
-#include "nsSVGPathElement.h"
 #include "nsSVGTextPathFrame.h"
 #include "nsSVGUtils.h"
 #include "SVGGraphicsElement.h"
 #include "SVGLengthList.h"
 
 using namespace mozilla;
 
 //----------------------------------------------------------------------
--- a/layout/svg/nsSVGTextPathFrame.cpp
+++ b/layout/svg/nsSVGTextPathFrame.cpp
@@ -5,17 +5,17 @@
 
 // Main header first:
 #include "nsSVGTextPathFrame.h"
 
 // Keep others in (case-insensitive) order:
 #include "nsContentUtils.h"
 #include "nsSVGEffects.h"
 #include "nsSVGLength2.h"
-#include "nsSVGPathElement.h"
+#include "mozilla/dom/SVGPathElement.h"
 #include "mozilla/dom/SVGTextPathElement.h"
 #include "SVGLengthList.h"
 
 using namespace mozilla;
 using namespace mozilla::dom;
 
 //----------------------------------------------------------------------
 // Implementation
@@ -139,18 +139,18 @@ nsSVGTextPathFrame::GetStartOffset()
 
 gfxFloat
 nsSVGTextPathFrame::GetOffsetScale()
 {
   nsIFrame *pathFrame = GetPathFrame();
   if (!pathFrame)
     return 1.0;
 
-  return static_cast<nsSVGPathElement*>(pathFrame->GetContent())->
-    GetPathLengthScale(nsSVGPathElement::eForTextPath);
+  return static_cast<SVGPathElement*>(pathFrame->GetContent())->
+    GetPathLengthScale(SVGPathElement::eForTextPath);
 }
 
 //----------------------------------------------------------------------
 // nsIFrame methods
 
 NS_IMETHODIMP
 nsSVGTextPathFrame::AttributeChanged(int32_t         aNameSpaceID,
                                      nsIAtom*        aAttribute,
--- a/layout/svg/nsSVGUtils.cpp
+++ b/layout/svg/nsSVGUtils.cpp
@@ -39,17 +39,17 @@
 #include "nsSVGForeignObjectFrame.h"
 #include "nsSVGGeometryFrame.h"
 #include "nsSVGGlyphFrame.h"
 #include "nsSVGInnerSVGFrame.h"
 #include "nsSVGIntegrationUtils.h"
 #include "nsSVGLength2.h"
 #include "nsSVGMaskFrame.h"
 #include "nsSVGOuterSVGFrame.h"
-#include "nsSVGPathElement.h"
+#include "mozilla/dom/SVGPathElement.h"
 #include "nsSVGPathGeometryElement.h"
 #include "nsSVGPathGeometryFrame.h"
 #include "nsSVGPaintServerFrame.h"
 #include "mozilla/dom/SVGSVGElement.h"
 #include "nsSVGTextContainerFrame.h"
 #include "nsTextFrame.h"
 #include "SVGContentUtils.h"
 #include "mozilla/unused.h"
@@ -1728,18 +1728,18 @@ GetStrokeDashData(nsIFrame* aFrame,
     uint32_t count = style->mStrokeDasharrayLength;
     if (!count || !aDashes.SetLength(count)) {
       return false;
     }
 
     gfxFloat pathScale = 1.0;
 
     if (content->Tag() == nsGkAtoms::path) {
-      pathScale = static_cast<nsSVGPathElement*>(content)->
-        GetPathLengthScale(nsSVGPathElement::eForStroking);
+      pathScale = static_cast<SVGPathElement*>(content)->
+        GetPathLengthScale(SVGPathElement::eForStroking);
       if (pathScale <= 0) {
         return false;
       }
     }
 
     const nsStyleCoord *dasharray = style->mStrokeDasharray;
 
     for (uint32_t i = 0; i < count; i++) {