Bug 830181: Move SVGSymbolElement to mozilla::dom r=bz
authorDavid Zbarsky <dzbarsky@gmail.com>
Wed, 16 Jan 2013 15:50:59 -0500
changeset 119062 53b31a85dbcf529953afeafad3ef6016c116ab33
parent 119061 d00c3bba992903596b151abdf253c858269541b8
child 119063 459a4d696fd8e704d138c555310582b2c0ca2af9
push id24189
push useremorley@mozilla.com
push dateThu, 17 Jan 2013 10:42:06 +0000
treeherdermozilla-central@712eca11a04e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbz
bugs830181
milestone21.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 830181: Move SVGSymbolElement to mozilla::dom r=bz
content/svg/content/src/Makefile.in
content/svg/content/src/SVGSymbolElement.cpp
content/svg/content/src/SVGSymbolElement.h
content/svg/content/src/nsSVGSymbolElement.cpp
--- a/content/svg/content/src/Makefile.in
+++ b/content/svg/content/src/Makefile.in
@@ -54,17 +54,16 @@ CPPSRCS		= \
 		nsSVGNumber2.cpp \
 		nsSVGNumberPair.cpp \
 		nsSVGPathDataParser.cpp \
 		nsSVGPathGeometryElement.cpp \
 		nsSVGPatternElement.cpp \
 		nsSVGPolyElement.cpp \
 		nsSVGString.cpp \
 		nsSVGRect.cpp \
-		nsSVGSymbolElement.cpp \
 		nsSVGUnknownElement.cpp \
 		nsSVGViewBox.cpp \
 		SVGAElement.cpp \
 		SVGAltGlyphElement.cpp \
 		SVGAngle.cpp \
 		SVGAnimatedAngle.cpp \
 		SVGAnimatedBoolean.cpp \
 		SVGAnimatedLengthList.cpp \
@@ -116,16 +115,17 @@ CPPSRCS		= \
 		SVGPolylineElement.cpp \
 		SVGPreserveAspectRatio.cpp \
 		SVGRectElement.cpp \
 		SVGScriptElement.cpp \
 		SVGSetElement.cpp \
 		SVGStopElement.cpp \
 		SVGStringList.cpp \
 		SVGStyleElement.cpp \
+		SVGSymbolElement.cpp \
 		SVGSVGElement.cpp \
 		SVGSwitchElement.cpp \
 		SVGTextContentElement.cpp \
 		SVGTextElement.cpp \
 		SVGTextPathElement.cpp \
 		SVGTextPositioningElement.cpp \
 		SVGTitleElement.cpp \
 		SVGTransform.cpp \
@@ -179,16 +179,17 @@ EXPORTS_mozilla/dom = \
 	SVGPathElement.h \
 	SVGPolygonElement.h \
 	SVGPolylineElement.h \
 	SVGRectElement.h \
 	SVGScriptElement.h \
 	SVGSetElement.h \
 	SVGStopElement.h \
 	SVGStyleElement.h \
+	SVGSymbolElement.h \
 	SVGSVGElement.h \
 	SVGSwitchElement.h \
 	SVGTextContentElement.h \
 	SVGTextElement.h \
 	SVGTextPathElement.h \
 	SVGTextPositioningElement.h \
 	SVGTitleElement.h \
 	SVGTransformableElement.h \
rename from content/svg/content/src/nsSVGSymbolElement.cpp
rename to content/svg/content/src/SVGSymbolElement.cpp
--- a/content/svg/content/src/nsSVGSymbolElement.cpp
+++ b/content/svg/content/src/SVGSymbolElement.cpp
@@ -1,147 +1,102 @@
 /* -*- 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 "mozilla/Util.h"
-
-#include "nsIDOMSVGSymbolElement.h"
-#include "DOMSVGTests.h"
-#include "nsSVGElement.h"
-#include "nsSVGViewBox.h"
-#include "SVGAnimatedPreserveAspectRatio.h"
-#include "nsIDOMSVGFitToViewBox.h"
-#include "nsGkAtoms.h"
+#include "mozilla/dom/SVGSymbolElement.h"
 
-using namespace mozilla;
-using namespace mozilla::dom;
-
-typedef nsSVGElement nsSVGSymbolElementBase;
-
-class nsSVGSymbolElement : public nsSVGSymbolElementBase,
-                           public nsIDOMSVGSymbolElement,
-                           public DOMSVGTests,
-                           public nsIDOMSVGFitToViewBox
-{
-protected:
-  friend nsresult NS_NewSVGSymbolElement(nsIContent **aResult,
-                                         already_AddRefed<nsINodeInfo> aNodeInfo);
-  nsSVGSymbolElement(already_AddRefed<nsINodeInfo> aNodeInfo);
+NS_IMPL_NS_NEW_NAMESPACED_SVG_ELEMENT(Symbol)
 
-public:
-  // interfaces:
-
-  NS_DECL_ISUPPORTS_INHERITED
-  NS_DECL_NSIDOMSVGSYMBOLELEMENT
-  NS_DECL_NSIDOMSVGFITTOVIEWBOX
-
-  // xxx I wish we could use virtual inheritance
-  NS_FORWARD_NSIDOMNODE_TO_NSINODE
-  NS_FORWARD_NSIDOMELEMENT_TO_GENERIC
-  NS_FORWARD_NSIDOMSVGELEMENT(nsSVGElement::)
-
-  // nsIContent interface
-  NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom* name) const;
+DOMCI_NODE_DATA(SVGSymbolElement, mozilla::dom::SVGSymbolElement)
 
-  virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
-
-  virtual nsXPCClassInfo* GetClassInfo();
-
-  virtual nsIDOMNode* AsDOMNode() { return this; }
-protected:
-  virtual nsSVGViewBox *GetViewBox();
-  virtual SVGAnimatedPreserveAspectRatio *GetPreserveAspectRatio();
-
-  nsSVGViewBox mViewBox;
-  SVGAnimatedPreserveAspectRatio mPreserveAspectRatio;
-};
-
-NS_IMPL_NS_NEW_SVG_ELEMENT(Symbol)
+namespace mozilla {
+namespace dom {
 
 //----------------------------------------------------------------------
 // nsISupports methods
 
-NS_IMPL_ADDREF_INHERITED(nsSVGSymbolElement,nsSVGSymbolElementBase)
-NS_IMPL_RELEASE_INHERITED(nsSVGSymbolElement,nsSVGSymbolElementBase)
+NS_IMPL_ADDREF_INHERITED(SVGSymbolElement,SVGSymbolElementBase)
+NS_IMPL_RELEASE_INHERITED(SVGSymbolElement,SVGSymbolElementBase)
 
-DOMCI_NODE_DATA(SVGSymbolElement, nsSVGSymbolElement)
-
-NS_INTERFACE_TABLE_HEAD(nsSVGSymbolElement)
-  NS_NODE_INTERFACE_TABLE5(nsSVGSymbolElement, nsIDOMNode, nsIDOMElement,
+NS_INTERFACE_TABLE_HEAD(SVGSymbolElement)
+  NS_NODE_INTERFACE_TABLE5(SVGSymbolElement, nsIDOMNode, nsIDOMElement,
                            nsIDOMSVGElement, nsIDOMSVGFitToViewBox,
                            nsIDOMSVGSymbolElement)
   NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(SVGSymbolElement)
-NS_INTERFACE_MAP_END_INHERITING(nsSVGSymbolElementBase)
+NS_INTERFACE_MAP_END_INHERITING(SVGSymbolElementBase)
 
 //----------------------------------------------------------------------
 // Implementation
 
-nsSVGSymbolElement::nsSVGSymbolElement(already_AddRefed<nsINodeInfo> aNodeInfo)
-  : nsSVGSymbolElementBase(aNodeInfo)
+SVGSymbolElement::SVGSymbolElement(already_AddRefed<nsINodeInfo> aNodeInfo)
+  : SVGSymbolElementBase(aNodeInfo)
 {
 }
 
 
 //----------------------------------------------------------------------
 // nsIDOMNode methods
 
-NS_IMPL_ELEMENT_CLONE_WITH_INIT(nsSVGSymbolElement)
+NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGSymbolElement)
 
 //----------------------------------------------------------------------
 // nsIDOMSVGFitToViewBox methods
 
 /* readonly attribute nsIDOMSVGAnimatedRect viewBox; */
-NS_IMETHODIMP nsSVGSymbolElement::GetViewBox(nsIDOMSVGAnimatedRect * *aViewBox)
+NS_IMETHODIMP SVGSymbolElement::GetViewBox(nsIDOMSVGAnimatedRect * *aViewBox)
 {
   return mViewBox.ToDOMAnimatedRect(aViewBox, this);
 }
 
 /* readonly attribute SVGPreserveAspectRatio preserveAspectRatio; */
 NS_IMETHODIMP
-nsSVGSymbolElement::GetPreserveAspectRatio(nsISupports
-                                           **aPreserveAspectRatio)
+SVGSymbolElement::GetPreserveAspectRatio(nsISupports
+                                         **aPreserveAspectRatio)
 {
   nsRefPtr<DOMSVGAnimatedPreserveAspectRatio> ratio;
   mPreserveAspectRatio.ToDOMAnimatedPreserveAspectRatio(getter_AddRefs(ratio), this);
   ratio.forget(aPreserveAspectRatio);
   return NS_OK;
 }
 
 //----------------------------------------------------------------------
 // nsIContent methods
 
 NS_IMETHODIMP_(bool)
-nsSVGSymbolElement::IsAttributeMapped(const nsIAtom* name) const
+SVGSymbolElement::IsAttributeMapped(const nsIAtom* name) const
 {
   static const MappedAttributeEntry* const map[] = {
     sColorMap,
     sFEFloodMap,
     sFillStrokeMap,
     sFiltersMap,
     sFontSpecificationMap,
     sGradientStopMap,
     sGraphicsMap,
     sLightingEffectsMap,
     sMarkersMap,
     sTextContentElementsMap,
     sViewportsMap
    };
 
   return FindAttributeDependence(name, map) ||
-    nsSVGSymbolElementBase::IsAttributeMapped(name);
+    SVGSymbolElementBase::IsAttributeMapped(name);
 }
 
 //----------------------------------------------------------------------
 // nsSVGElement methods
 
 nsSVGViewBox *
-nsSVGSymbolElement::GetViewBox()
+SVGSymbolElement::GetViewBox()
 {
   return &mViewBox;
 }
 
 SVGAnimatedPreserveAspectRatio *
-nsSVGSymbolElement::GetPreserveAspectRatio()
+SVGSymbolElement::GetPreserveAspectRatio()
 {
   return &mPreserveAspectRatio;
 }
+
+} // namespace dom
+} // namespace mozilla
copy from content/svg/content/src/nsSVGSymbolElement.cpp
copy to content/svg/content/src/SVGSymbolElement.h
--- a/content/svg/content/src/nsSVGSymbolElement.cpp
+++ b/content/svg/content/src/SVGSymbolElement.h
@@ -1,37 +1,41 @@
 /* -*- 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 "mozilla/Util.h"
+#ifndef mozilla_dom_SVGSymbolElement_h
+#define mozilla_dom_SVGSymbolElement_h
 
 #include "nsIDOMSVGSymbolElement.h"
 #include "DOMSVGTests.h"
 #include "nsSVGElement.h"
 #include "nsSVGViewBox.h"
 #include "SVGAnimatedPreserveAspectRatio.h"
 #include "nsIDOMSVGFitToViewBox.h"
 #include "nsGkAtoms.h"
 
-using namespace mozilla;
-using namespace mozilla::dom;
+nsresult NS_NewSVGSymbolElement(nsIContent **aResult,
+                                already_AddRefed<nsINodeInfo> aNodeInfo);
 
-typedef nsSVGElement nsSVGSymbolElementBase;
+namespace mozilla {
+namespace dom {
 
-class nsSVGSymbolElement : public nsSVGSymbolElementBase,
-                           public nsIDOMSVGSymbolElement,
-                           public DOMSVGTests,
-                           public nsIDOMSVGFitToViewBox
+typedef nsSVGElement SVGSymbolElementBase;
+
+class SVGSymbolElement MOZ_FINAL : public SVGSymbolElementBase,
+                                   public nsIDOMSVGSymbolElement,
+                                   public DOMSVGTests,
+                                   public nsIDOMSVGFitToViewBox
 {
 protected:
-  friend nsresult NS_NewSVGSymbolElement(nsIContent **aResult,
-                                         already_AddRefed<nsINodeInfo> aNodeInfo);
-  nsSVGSymbolElement(already_AddRefed<nsINodeInfo> aNodeInfo);
+  friend nsresult (::NS_NewSVGSymbolElement(nsIContent **aResult,
+                                            already_AddRefed<nsINodeInfo> aNodeInfo));
+  SVGSymbolElement(already_AddRefed<nsINodeInfo> aNodeInfo);
 
 public:
   // interfaces:
 
   NS_DECL_ISUPPORTS_INHERITED
   NS_DECL_NSIDOMSVGSYMBOLELEMENT
   NS_DECL_NSIDOMSVGFITTOVIEWBOX
 
@@ -51,97 +55,12 @@ public:
 protected:
   virtual nsSVGViewBox *GetViewBox();
   virtual SVGAnimatedPreserveAspectRatio *GetPreserveAspectRatio();
 
   nsSVGViewBox mViewBox;
   SVGAnimatedPreserveAspectRatio mPreserveAspectRatio;
 };
 
-NS_IMPL_NS_NEW_SVG_ELEMENT(Symbol)
-
-//----------------------------------------------------------------------
-// nsISupports methods
-
-NS_IMPL_ADDREF_INHERITED(nsSVGSymbolElement,nsSVGSymbolElementBase)
-NS_IMPL_RELEASE_INHERITED(nsSVGSymbolElement,nsSVGSymbolElementBase)
-
-DOMCI_NODE_DATA(SVGSymbolElement, nsSVGSymbolElement)
-
-NS_INTERFACE_TABLE_HEAD(nsSVGSymbolElement)
-  NS_NODE_INTERFACE_TABLE5(nsSVGSymbolElement, nsIDOMNode, nsIDOMElement,
-                           nsIDOMSVGElement, nsIDOMSVGFitToViewBox,
-                           nsIDOMSVGSymbolElement)
-  NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(SVGSymbolElement)
-NS_INTERFACE_MAP_END_INHERITING(nsSVGSymbolElementBase)
-
-//----------------------------------------------------------------------
-// Implementation
-
-nsSVGSymbolElement::nsSVGSymbolElement(already_AddRefed<nsINodeInfo> aNodeInfo)
-  : nsSVGSymbolElementBase(aNodeInfo)
-{
-}
-
-
-//----------------------------------------------------------------------
-// nsIDOMNode methods
-
-NS_IMPL_ELEMENT_CLONE_WITH_INIT(nsSVGSymbolElement)
-
-//----------------------------------------------------------------------
-// nsIDOMSVGFitToViewBox methods
-
-/* readonly attribute nsIDOMSVGAnimatedRect viewBox; */
-NS_IMETHODIMP nsSVGSymbolElement::GetViewBox(nsIDOMSVGAnimatedRect * *aViewBox)
-{
-  return mViewBox.ToDOMAnimatedRect(aViewBox, this);
-}
+} // namespace dom
+} // namespace mozilla
 
-/* readonly attribute SVGPreserveAspectRatio preserveAspectRatio; */
-NS_IMETHODIMP
-nsSVGSymbolElement::GetPreserveAspectRatio(nsISupports
-                                           **aPreserveAspectRatio)
-{
-  nsRefPtr<DOMSVGAnimatedPreserveAspectRatio> ratio;
-  mPreserveAspectRatio.ToDOMAnimatedPreserveAspectRatio(getter_AddRefs(ratio), this);
-  ratio.forget(aPreserveAspectRatio);
-  return NS_OK;
-}
-
-//----------------------------------------------------------------------
-// nsIContent methods
-
-NS_IMETHODIMP_(bool)
-nsSVGSymbolElement::IsAttributeMapped(const nsIAtom* name) const
-{
-  static const MappedAttributeEntry* const map[] = {
-    sColorMap,
-    sFEFloodMap,
-    sFillStrokeMap,
-    sFiltersMap,
-    sFontSpecificationMap,
-    sGradientStopMap,
-    sGraphicsMap,
-    sLightingEffectsMap,
-    sMarkersMap,
-    sTextContentElementsMap,
-    sViewportsMap
-   };
-
-  return FindAttributeDependence(name, map) ||
-    nsSVGSymbolElementBase::IsAttributeMapped(name);
-}
-
-//----------------------------------------------------------------------
-// nsSVGElement methods
-
-nsSVGViewBox *
-nsSVGSymbolElement::GetViewBox()
-{
-  return &mViewBox;
-}
-
-SVGAnimatedPreserveAspectRatio *
-nsSVGSymbolElement::GetPreserveAspectRatio()
-{
-  return &mPreserveAspectRatio;
-}
+#endif // mozilla_dom_SVGSymbolElement_h