Bug 825732: Convert SVGTSpanElement to WebIDL r=bz
authorDavid Zbarsky <dzbarsky@gmail.com>
Sun, 06 Jan 2013 09:14:44 -0500
changeset 126908 c4ba770505d9067d2f7705410ff868790d751159
parent 126907 31ced8e31f8b207f77db1bf73f78395ee2cbad8c
child 126909 59ae61d1d05916c4e332867448c29df114cfee53
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
bugs825732
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 825732: Convert SVGTSpanElement to WebIDL r=bz
content/svg/content/src/Makefile.in
content/svg/content/src/SVGTSpanElement.cpp
content/svg/content/src/SVGTSpanElement.h
content/svg/content/src/nsSVGTSpanElement.cpp
dom/webidl/SVGTSpanElement.webidl
dom/webidl/WebIDL.mk
--- a/content/svg/content/src/Makefile.in
+++ b/content/svg/content/src/Makefile.in
@@ -61,17 +61,16 @@ CPPSRCS		= \
 		nsSVGPathElement.cpp \
 		nsSVGPathGeometryElement.cpp \
 		nsSVGPatternElement.cpp \
 		nsSVGPolyElement.cpp \
 		nsSVGString.cpp \
 		nsSVGRect.cpp \
 		nsSVGSVGElement.cpp \
 		nsSVGSymbolElement.cpp \
-		nsSVGTSpanElement.cpp \
 		nsSVGUnknownElement.cpp \
 		nsSVGUseElement.cpp \
 		nsSVGViewBox.cpp \
 		nsSVGViewElement.cpp \
 		SVGAngle.cpp \
 		SVGAnimatedAngle.cpp \
 		SVGAnimatedBoolean.cpp \
 		SVGAnimatedLengthList.cpp \
@@ -131,16 +130,17 @@ CPPSRCS		= \
 		SVGTextPathElement.cpp \
 		SVGTextPositioningElement.cpp \
 		SVGTitleElement.cpp \
 		SVGTransform.cpp \
 		SVGTransformableElement.cpp \
 		SVGTransformList.cpp \
 		SVGTransformListParser.cpp \
 		SVGTransformListSMILType.cpp \
+		SVGTSpanElement.cpp \
 		SVGViewBoxSMILType.cpp \
 		$(NULL)
 
 include $(topsrcdir)/config/config.mk
 
 # we don't want the shared lib, but we want to force the creation of a static lib.
 FORCE_STATIC_LIB = 1
 
@@ -181,16 +181,17 @@ EXPORTS_mozilla/dom = \
 	SVGStyleElement.h \
 	SVGSwitchElement.h \
 	SVGTextContentElement.h \
 	SVGTextElement.h \
 	SVGTextPathElement.h \
 	SVGTextPositioningElement.h \
 	SVGTitleElement.h \
 	SVGTransformableElement.h \
+	SVGTSpanElement.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/nsSVGTSpanElement.cpp
rename to content/svg/content/src/SVGTSpanElement.cpp
--- a/content/svg/content/src/nsSVGTSpanElement.cpp
+++ b/content/svg/content/src/SVGTSpanElement.cpp
@@ -1,122 +1,87 @@
 /* -*- 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 "mozilla/dom/SVGTSpanElement.h"
+#include "mozilla/dom/SVGTSpanElementBinding.h"
+
+DOMCI_NODE_DATA(SVGTSpanElement, mozilla::dom::SVGTSpanElement)
 
-#include "nsGkAtoms.h"
-#include "nsIDOMSVGTSpanElement.h"
-#include "nsSVGSVGElement.h"
-#include "SVGTextPositioningElement.h"
-#include "nsContentUtils.h"
+NS_IMPL_NS_NEW_NAMESPACED_SVG_ELEMENT(TSpan)
 
-using namespace mozilla;
+namespace mozilla {
+namespace dom {
 
-typedef dom::SVGTextPositioningElement nsSVGTSpanElementBase;
-
-class nsSVGTSpanElement : public nsSVGTSpanElementBase, // = nsIDOMSVGTextPositioningElement
-                          public nsIDOMSVGTSpanElement
+JSObject*
+SVGTSpanElement::WrapNode(JSContext *aCx, JSObject *aScope, bool *aTriedToWrap)
 {
-protected:
-  friend nsresult NS_NewSVGTSpanElement(nsIContent **aResult,
-                                        already_AddRefed<nsINodeInfo> aNodeInfo);
-  nsSVGTSpanElement(already_AddRefed<nsINodeInfo> aNodeInfo);
-  
-public:
-  // interfaces:
-  
-  NS_DECL_ISUPPORTS_INHERITED
-  NS_DECL_NSIDOMSVGTSPANELEMENT
-
-  // xxx If xpcom allowed virtual inheritance we wouldn't need to
-  // forward here :-(
-  NS_FORWARD_NSIDOMNODE_TO_NSINODE
-  NS_FORWARD_NSIDOMELEMENT_TO_GENERIC
-  NS_FORWARD_NSIDOMSVGELEMENT(nsSVGTSpanElementBase::)
-  NS_FORWARD_NSIDOMSVGTEXTCONTENTELEMENT(nsSVGTSpanElementBase::)
-  NS_FORWARD_NSIDOMSVGTEXTPOSITIONINGELEMENT(nsSVGTSpanElementBase::)
-
-  // nsIContent interface
-  NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom* aAttribute) const;
-
-  virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
-
-  virtual nsXPCClassInfo* GetClassInfo();
-
-  virtual nsIDOMNode* AsDOMNode() { return this; }
-
-  virtual bool IsEventAttributeName(nsIAtom* aName) MOZ_OVERRIDE;
-};
-
-
-NS_IMPL_NS_NEW_SVG_ELEMENT(TSpan)
+  return SVGTSpanElementBinding::Wrap(aCx, aScope, this, aTriedToWrap);
+}
 
 
 //----------------------------------------------------------------------
 // nsISupports methods
 
-NS_IMPL_ADDREF_INHERITED(nsSVGTSpanElement,nsSVGTSpanElementBase)
-NS_IMPL_RELEASE_INHERITED(nsSVGTSpanElement,nsSVGTSpanElementBase)
+NS_IMPL_ADDREF_INHERITED(SVGTSpanElement,SVGTSpanElementBase)
+NS_IMPL_RELEASE_INHERITED(SVGTSpanElement,SVGTSpanElementBase)
 
-DOMCI_NODE_DATA(SVGTSpanElement, nsSVGTSpanElement)
-
-NS_INTERFACE_TABLE_HEAD(nsSVGTSpanElement)
-  NS_NODE_INTERFACE_TABLE6(nsSVGTSpanElement, nsIDOMNode, nsIDOMElement,
+NS_INTERFACE_TABLE_HEAD(SVGTSpanElement)
+  NS_NODE_INTERFACE_TABLE6(SVGTSpanElement, nsIDOMNode, nsIDOMElement,
                            nsIDOMSVGElement, nsIDOMSVGTSpanElement,
                            nsIDOMSVGTextPositioningElement,
                            nsIDOMSVGTextContentElement)
   NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(SVGTSpanElement)
-NS_INTERFACE_MAP_END_INHERITING(nsSVGTSpanElementBase)
+NS_INTERFACE_MAP_END_INHERITING(SVGTSpanElementBase)
 
 //----------------------------------------------------------------------
 // Implementation
 
-nsSVGTSpanElement::nsSVGTSpanElement(already_AddRefed<nsINodeInfo> aNodeInfo)
-  : nsSVGTSpanElementBase(aNodeInfo)
+SVGTSpanElement::SVGTSpanElement(already_AddRefed<nsINodeInfo> aNodeInfo)
+  : SVGTSpanElementBase(aNodeInfo)
 {
-
+  SetIsDOMBinding();
 }
 
-  
+
 //----------------------------------------------------------------------
 // nsIDOMNode methods
 
 
-NS_IMPL_ELEMENT_CLONE_WITH_INIT(nsSVGTSpanElement)
+NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGTSpanElement)
 
 
 //----------------------------------------------------------------------
 // nsIDOMSVGTSpanElement methods
 
 // - no methods -
 
 //----------------------------------------------------------------------
 // nsIContent methods
 
 NS_IMETHODIMP_(bool)
-nsSVGTSpanElement::IsAttributeMapped(const nsIAtom* name) const
+SVGTSpanElement::IsAttributeMapped(const nsIAtom* name) const
 {
   static const MappedAttributeEntry* const map[] = {
     sColorMap,
     sFillStrokeMap,
     sFontSpecificationMap,
     sGraphicsMap,
     sTextContentElementsMap
   };
-  
+
   return FindAttributeDependence(name, map) ||
-    nsSVGTSpanElementBase::IsAttributeMapped(name);
-}
-
-
-bool
-nsSVGTSpanElement::IsEventAttributeName(nsIAtom* aName)
-{
-  return nsContentUtils::IsEventAttributeName(aName, EventNameType_SVGGraphic);
+    SVGTSpanElementBase::IsAttributeMapped(name);
 }
 
 //----------------------------------------------------------------------
 // nsSVGElement overrides
 
-// - no methods -
+bool
+SVGTSpanElement::IsEventName(nsIAtom* aName)
+{
+  return nsContentUtils::IsEventAttributeName(aName, EventNameType_SVGGraphic);
+}
+
+} // namespace dom
+} // namespace mozilla
copy from content/svg/content/src/nsSVGTSpanElement.cpp
copy to content/svg/content/src/SVGTSpanElement.h
--- a/content/svg/content/src/nsSVGTSpanElement.cpp
+++ b/content/svg/content/src/SVGTSpanElement.h
@@ -1,122 +1,60 @@
 /* -*- 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_SVGTSpanElement_h
+#define mozilla_dom_SVGTSpanElement_h
 
-#include "nsGkAtoms.h"
+#include "mozilla/dom/SVGTextPositioningElement.h"
 #include "nsIDOMSVGTSpanElement.h"
-#include "nsSVGSVGElement.h"
-#include "SVGTextPositioningElement.h"
-#include "nsContentUtils.h"
+
+nsresult NS_NewSVGTSpanElement(nsIContent **aResult,
+                               already_AddRefed<nsINodeInfo> aNodeInfo);
 
-using namespace mozilla;
+namespace mozilla {
+namespace dom {
 
-typedef dom::SVGTextPositioningElement nsSVGTSpanElementBase;
+typedef SVGTextPositioningElement SVGTSpanElementBase;
 
-class nsSVGTSpanElement : public nsSVGTSpanElementBase, // = nsIDOMSVGTextPositioningElement
-                          public nsIDOMSVGTSpanElement
+class SVGTSpanElement MOZ_FINAL : public SVGTSpanElementBase, // = nsIDOMSVGTextPositioningElement
+                                  public nsIDOMSVGTSpanElement
 {
 protected:
-  friend nsresult NS_NewSVGTSpanElement(nsIContent **aResult,
-                                        already_AddRefed<nsINodeInfo> aNodeInfo);
-  nsSVGTSpanElement(already_AddRefed<nsINodeInfo> aNodeInfo);
-  
+  friend nsresult (::NS_NewSVGTSpanElement(nsIContent **aResult,
+                                           already_AddRefed<nsINodeInfo> aNodeInfo));
+  SVGTSpanElement(already_AddRefed<nsINodeInfo> aNodeInfo);
+  virtual JSObject* WrapNode(JSContext *cx, JSObject *scope, bool *triedToWrap) MOZ_OVERRIDE;
+
 public:
   // interfaces:
-  
+
   NS_DECL_ISUPPORTS_INHERITED
   NS_DECL_NSIDOMSVGTSPANELEMENT
 
   // xxx If xpcom allowed virtual inheritance we wouldn't need to
   // forward here :-(
   NS_FORWARD_NSIDOMNODE_TO_NSINODE
   NS_FORWARD_NSIDOMELEMENT_TO_GENERIC
-  NS_FORWARD_NSIDOMSVGELEMENT(nsSVGTSpanElementBase::)
-  NS_FORWARD_NSIDOMSVGTEXTCONTENTELEMENT(nsSVGTSpanElementBase::)
-  NS_FORWARD_NSIDOMSVGTEXTPOSITIONINGELEMENT(nsSVGTSpanElementBase::)
+  NS_FORWARD_NSIDOMSVGELEMENT(SVGTSpanElementBase::)
+  NS_FORWARD_NSIDOMSVGTEXTCONTENTELEMENT(SVGTSpanElementBase::)
+  NS_FORWARD_NSIDOMSVGTEXTPOSITIONINGELEMENT(SVGTSpanElementBase::)
 
   // nsIContent interface
   NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom* aAttribute) const;
 
   virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
 
   virtual nsXPCClassInfo* GetClassInfo();
 
   virtual nsIDOMNode* AsDOMNode() { return this; }
+protected:
 
-  virtual bool IsEventAttributeName(nsIAtom* aName) MOZ_OVERRIDE;
+  // nsSVGElement overrides
+  virtual bool IsEventName(nsIAtom* aName);
 };
 
-
-NS_IMPL_NS_NEW_SVG_ELEMENT(TSpan)
-
-
-//----------------------------------------------------------------------
-// nsISupports methods
-
-NS_IMPL_ADDREF_INHERITED(nsSVGTSpanElement,nsSVGTSpanElementBase)
-NS_IMPL_RELEASE_INHERITED(nsSVGTSpanElement,nsSVGTSpanElementBase)
-
-DOMCI_NODE_DATA(SVGTSpanElement, nsSVGTSpanElement)
-
-NS_INTERFACE_TABLE_HEAD(nsSVGTSpanElement)
-  NS_NODE_INTERFACE_TABLE6(nsSVGTSpanElement, nsIDOMNode, nsIDOMElement,
-                           nsIDOMSVGElement, nsIDOMSVGTSpanElement,
-                           nsIDOMSVGTextPositioningElement,
-                           nsIDOMSVGTextContentElement)
-  NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(SVGTSpanElement)
-NS_INTERFACE_MAP_END_INHERITING(nsSVGTSpanElementBase)
-
-//----------------------------------------------------------------------
-// Implementation
-
-nsSVGTSpanElement::nsSVGTSpanElement(already_AddRefed<nsINodeInfo> aNodeInfo)
-  : nsSVGTSpanElementBase(aNodeInfo)
-{
-
-}
-
-  
-//----------------------------------------------------------------------
-// nsIDOMNode methods
-
-
-NS_IMPL_ELEMENT_CLONE_WITH_INIT(nsSVGTSpanElement)
+} // namespace dom
+} // namespace mozilla
 
-
-//----------------------------------------------------------------------
-// nsIDOMSVGTSpanElement methods
-
-// - no methods -
-
-//----------------------------------------------------------------------
-// nsIContent methods
-
-NS_IMETHODIMP_(bool)
-nsSVGTSpanElement::IsAttributeMapped(const nsIAtom* name) const
-{
-  static const MappedAttributeEntry* const map[] = {
-    sColorMap,
-    sFillStrokeMap,
-    sFontSpecificationMap,
-    sGraphicsMap,
-    sTextContentElementsMap
-  };
-  
-  return FindAttributeDependence(name, map) ||
-    nsSVGTSpanElementBase::IsAttributeMapped(name);
-}
-
-
-bool
-nsSVGTSpanElement::IsEventAttributeName(nsIAtom* aName)
-{
-  return nsContentUtils::IsEventAttributeName(aName, EventNameType_SVGGraphic);
-}
-
-//----------------------------------------------------------------------
-// nsSVGElement overrides
-
-// - no methods -
+#endif // mozilla_dom_SVGTSpanElement_h
new file mode 100644
--- /dev/null
+++ b/dom/webidl/SVGTSpanElement.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 SVGTSpanElement : SVGTextPositioningElement {
+};
+
--- a/dom/webidl/WebIDL.mk
+++ b/dom/webidl/WebIDL.mk
@@ -141,16 +141,17 @@ webidl_files = \
   SVGTextContentElement.webidl \
   SVGTextElement.webidl \
   SVGTextPathElement.webidl \
   SVGTextPositioningElement.webidl \
   SVGTitleElement.webidl \
   SVGTransform.webidl \
   SVGTransformableElement.webidl \
   SVGTransformList.webidl \
+  SVGTSpanElement.webidl \
   SVGURIReference.webidl \
   Text.webidl \
   TextDecoder.webidl \
   TextEncoder.webidl \
   URL.webidl \
   WebSocket.webidl \
   UndoManager.webidl \
   XMLHttpRequest.webidl \