Bug 824327: Convert SVGDescElement to WebIDL r=bz
authorDavid Zbarsky <dzbarsky@gmail.com>
Fri, 04 Jan 2013 17:28:05 -0500
changeset 126784 60c936f77dce372d976ac429bc54aa75d57a2860
parent 126783 68ded29fc68e26d2a0f7a20c6375d03d8e38b4b8
child 126785 2a2fdd3161f8eba414362e6daf9899b60542e0b4
push id2151
push userlsblakk@mozilla.com
push dateTue, 19 Feb 2013 18:06:57 +0000
treeherdermozilla-beta@4952e88741ec [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbz
bugs824327
milestone20.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 824327: Convert SVGDescElement to WebIDL r=bz
content/svg/content/src/Makefile.in
content/svg/content/src/SVGDescElement.cpp
content/svg/content/src/SVGDescElement.h
content/svg/content/src/nsSVGDescElement.cpp
dom/webidl/SVGDescElement.webidl
dom/webidl/WebIDL.mk
--- a/content/svg/content/src/Makefile.in
+++ b/content/svg/content/src/Makefile.in
@@ -40,17 +40,16 @@ CPPSRCS		= \
 		nsSVGAltGlyphElement.cpp \
 		nsSVGAngle.cpp \
 		nsSVGBoolean.cpp \
 		nsSVGCircleElement.cpp \
 		nsSVGClass.cpp \
 		nsSVGClipPathElement.cpp \
 		nsSVGDataParser.cpp \
 		nsSVGDefsElement.cpp \
-		nsSVGDescElement.cpp \
 		nsSVGElement.cpp \
 		nsSVGElementFactory.cpp \
 		nsSVGEllipseElement.cpp \
 		nsSVGEnum.cpp \
 		nsSVGFeatures.cpp \
 		nsSVGFilterElement.cpp \
 		nsSVGFilters.cpp \
 		nsSVGForeignObjectElement.cpp \
@@ -117,16 +116,17 @@ CPPSRCS		= \
 		nsSVGAnimateElement.cpp \
 		nsSVGAnimateTransformElement.cpp \
 		nsSVGAnimateMotionElement.cpp \
 		nsSVGAnimationElement.cpp \
 		nsSVGMpathElement.cpp \
 		nsSVGSetElement.cpp \
 		SVGAttrValueWrapper.cpp \
 		SVGContentUtils.cpp \
+		SVGDescElement.cpp \
 		SVGIntegerPairSMILType.cpp \
 		SVGLengthListSMILType.cpp \
 		SVGMotionSMILType.cpp \
 		SVGMotionSMILAttr.cpp \
 		SVGMotionSMILAnimationFunction.cpp \
 		SVGMotionSMILPathUtils.cpp \
 		SVGNumberListSMILType.cpp \
 		SVGNumberPairSMILType.cpp \
@@ -149,16 +149,17 @@ EXPORTS =  			\
 	$(NULL)
 
 EXPORTS_NAMESPACES = mozilla/dom
 
 EXPORTS_mozilla/dom = \
 	SVGAngle.h \
 	SVGAnimatedAngle.h \
 	SVGAnimatedBoolean.h \
+	SVGDescElement.h \
 	$(NULL)
 
 include $(topsrcdir)/config/rules.mk
 
 INCLUDES += 	\
 		-I$(srcdir)/../../../xml/content/src \
 		-I$(srcdir)/../../../../dom \
 		-I$(srcdir)/../../../base/src \
rename from content/svg/content/src/nsSVGDescElement.cpp
rename to content/svg/content/src/SVGDescElement.cpp
--- a/content/svg/content/src/nsSVGDescElement.cpp
+++ b/content/svg/content/src/SVGDescElement.cpp
@@ -1,76 +1,50 @@
 /* -*- 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 "nsSVGElement.h"
-#include "nsIDOMSVGDescElement.h"
-
-typedef nsSVGElement nsSVGDescElementBase;
+#include "mozilla/dom/SVGDescElement.h"
+#include "mozilla/dom/SVGDescElementBinding.h"
 
-class nsSVGDescElement : public nsSVGDescElementBase,
-                         public nsIDOMSVGDescElement
-{
-protected:
-  friend nsresult NS_NewSVGDescElement(nsIContent **aResult,
-                                       already_AddRefed<nsINodeInfo> aNodeInfo);
-  nsSVGDescElement(already_AddRefed<nsINodeInfo> aNodeInfo);
-  nsresult Init();
+DOMCI_NODE_DATA(SVGDescElement, mozilla::dom::SVGDescElement)
 
-public:
-  // interfaces:
+NS_IMPL_NS_NEW_NAMESPACED_SVG_ELEMENT(Desc)
 
-  NS_DECL_ISUPPORTS_INHERITED
-  NS_DECL_NSIDOMSVGDESCELEMENT
-
-  // xxx I wish we could use virtual inheritance
-  NS_FORWARD_NSIDOMNODE_TO_NSINODE
-  NS_FORWARD_NSIDOMELEMENT_TO_GENERIC
-  NS_FORWARD_NSIDOMSVGELEMENT(nsSVGDescElementBase::)
+namespace mozilla {
+namespace dom {
 
-  virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
-
-  virtual nsXPCClassInfo* GetClassInfo();
-
-  virtual nsIDOMNode* AsDOMNode() { return this; }
-};
-
-NS_IMPL_NS_NEW_SVG_ELEMENT(Desc)
-
+JSObject*
+SVGDescElement::WrapNode(JSContext *aCx, JSObject *aScope, bool *aTriedToWrap)
+{
+  return SVGDescElementBinding::Wrap(aCx, aScope, this, aTriedToWrap);
+}
 
 //----------------------------------------------------------------------
 // nsISupports methods
 
-NS_IMPL_ADDREF_INHERITED(nsSVGDescElement, nsSVGDescElementBase)
-NS_IMPL_RELEASE_INHERITED(nsSVGDescElement, nsSVGDescElementBase)
+NS_IMPL_ADDREF_INHERITED(SVGDescElement, SVGDescElementBase)
+NS_IMPL_RELEASE_INHERITED(SVGDescElement, SVGDescElementBase)
 
-DOMCI_NODE_DATA(SVGDescElement, nsSVGDescElement)
-
-NS_INTERFACE_TABLE_HEAD(nsSVGDescElement)
-  NS_NODE_INTERFACE_TABLE4(nsSVGDescElement, nsIDOMNode, nsIDOMElement,
+NS_INTERFACE_TABLE_HEAD(SVGDescElement)
+  NS_NODE_INTERFACE_TABLE4(SVGDescElement, nsIDOMNode, nsIDOMElement,
                            nsIDOMSVGElement, nsIDOMSVGDescElement)
   NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(SVGDescElement)
-NS_INTERFACE_MAP_END_INHERITING(nsSVGDescElementBase)
-
+NS_INTERFACE_MAP_END_INHERITING(SVGDescElementBase)
 
 //----------------------------------------------------------------------
 // Implementation
 
-nsSVGDescElement::nsSVGDescElement(already_AddRefed<nsINodeInfo> aNodeInfo)
-  : nsSVGDescElementBase(aNodeInfo)
+SVGDescElement::SVGDescElement(already_AddRefed<nsINodeInfo> aNodeInfo)
+  : SVGDescElementBase(aNodeInfo)
 {
+  SetIsDOMBinding();
 }
 
-
-nsresult
-nsSVGDescElement::Init()
-{
-  return nsSVGDescElementBase::Init();
-}
-
-
 //----------------------------------------------------------------------
 // nsIDOMNode methods
 
-NS_IMPL_ELEMENT_CLONE_WITH_INIT(nsSVGDescElement)
+NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGDescElement)
 
+} // namespace dom
+} // namespace mozilla
+
copy from content/svg/content/src/nsSVGDescElement.cpp
copy to content/svg/content/src/SVGDescElement.h
--- a/content/svg/content/src/nsSVGDescElement.cpp
+++ b/content/svg/content/src/SVGDescElement.h
@@ -1,76 +1,52 @@
 /* -*- 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 mozilla_dom_SVGDescElement_h
+#define mozilla_dom_SVGDescElement_h
+
 #include "nsSVGElement.h"
 #include "nsIDOMSVGDescElement.h"
 
-typedef nsSVGElement nsSVGDescElementBase;
+nsresult NS_NewSVGDescElement(nsIContent **aResult,
+                              already_AddRefed<nsINodeInfo> aNodeInfo);
+
+typedef nsSVGElement SVGDescElementBase;
 
-class nsSVGDescElement : public nsSVGDescElementBase,
-                         public nsIDOMSVGDescElement
+namespace mozilla {
+namespace dom {
+
+class SVGDescElement MOZ_FINAL : public SVGDescElementBase,
+                                 public nsIDOMSVGDescElement
 {
 protected:
-  friend nsresult NS_NewSVGDescElement(nsIContent **aResult,
-                                       already_AddRefed<nsINodeInfo> aNodeInfo);
-  nsSVGDescElement(already_AddRefed<nsINodeInfo> aNodeInfo);
-  nsresult Init();
+  friend nsresult (::NS_NewSVGDescElement(nsIContent **aResult,
+                                          already_AddRefed<nsINodeInfo> aNodeInfo));
+  SVGDescElement(already_AddRefed<nsINodeInfo> aNodeInfo);
+
+  virtual JSObject* WrapNode(JSContext *aCx, JSObject *aScope, bool *aTriedToWrap) MOZ_OVERRIDE;
 
 public:
   // interfaces:
 
   NS_DECL_ISUPPORTS_INHERITED
   NS_DECL_NSIDOMSVGDESCELEMENT
 
   // xxx I wish we could use virtual inheritance
   NS_FORWARD_NSIDOMNODE_TO_NSINODE
   NS_FORWARD_NSIDOMELEMENT_TO_GENERIC
-  NS_FORWARD_NSIDOMSVGELEMENT(nsSVGDescElementBase::)
+  NS_FORWARD_NSIDOMSVGELEMENT(SVGDescElementBase::)
 
   virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
 
   virtual nsXPCClassInfo* GetClassInfo();
 
   virtual nsIDOMNode* AsDOMNode() { return this; }
 };
 
-NS_IMPL_NS_NEW_SVG_ELEMENT(Desc)
-
-
-//----------------------------------------------------------------------
-// nsISupports methods
-
-NS_IMPL_ADDREF_INHERITED(nsSVGDescElement, nsSVGDescElementBase)
-NS_IMPL_RELEASE_INHERITED(nsSVGDescElement, nsSVGDescElementBase)
-
-DOMCI_NODE_DATA(SVGDescElement, nsSVGDescElement)
-
-NS_INTERFACE_TABLE_HEAD(nsSVGDescElement)
-  NS_NODE_INTERFACE_TABLE4(nsSVGDescElement, nsIDOMNode, nsIDOMElement,
-                           nsIDOMSVGElement, nsIDOMSVGDescElement)
-  NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(SVGDescElement)
-NS_INTERFACE_MAP_END_INHERITING(nsSVGDescElementBase)
-
+} // namespace dom
+} // namespace mozilla
 
-//----------------------------------------------------------------------
-// Implementation
-
-nsSVGDescElement::nsSVGDescElement(already_AddRefed<nsINodeInfo> aNodeInfo)
-  : nsSVGDescElementBase(aNodeInfo)
-{
-}
-
+#endif // mozilla_dom_SVGDescElement_h
 
-nsresult
-nsSVGDescElement::Init()
-{
-  return nsSVGDescElementBase::Init();
-}
-
-
-//----------------------------------------------------------------------
-// nsIDOMNode methods
-
-NS_IMPL_ELEMENT_CLONE_WITH_INIT(nsSVGDescElement)
-
new file mode 100644
--- /dev/null
+++ b/dom/webidl/SVGDescElement.webidl
@@ -0,0 +1,15 @@
+/* -*- Mode: IDL; 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/.
+ *
+ * The origin of this IDL file is
+ * http://www.w3.org/TR/SVG2/
+ *
+ * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C
+ * liability, trademark and document use rules apply.
+ */
+
+interface SVGDescElement : SVGElement {
+};
+
--- a/dom/webidl/WebIDL.mk
+++ b/dom/webidl/WebIDL.mk
@@ -91,16 +91,17 @@ webidl_files = \
   Screen.webidl \
   SVGAngle.webidl \
   SVGAnimatedAngle.webidl \
   SVGAnimatedBoolean.webidl \
   SVGAnimatedLengthList.webidl \
   SVGAnimatedNumberList.webidl \
   SVGAnimatedPreserveAspectRatio.webidl \
   SVGAnimatedTransformList.webidl \
+  SVGDescElement.webidl \
   SVGElement.webidl \
   SVGLengthList.webidl \
   SVGMatrix.webidl \
   SVGNumberList.webidl \
   SVGPathSeg.webidl \
   SVGPathSegList.webidl \
   SVGPoint.webidl \
   SVGPointList.webidl \