Bug 825732: Convert SVGTextPositioningElement to WebIDL r=bz
authorDavid Zbarsky <dzbarsky@gmail.com>
Sun, 06 Jan 2013 09:14:43 -0500
changeset 117804 370b247b1b7f6c554066c20e9b67307b796c253c
parent 117803 a671c210b131458936956f2d5f29cec8320d5812
child 117805 31ced8e31f8b207f77db1bf73f78395ee2cbad8c
push id24113
push userphilringnalda@gmail.com
push dateMon, 07 Jan 2013 00:40:08 +0000
treeherdermozilla-central@579c679f24f2 [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 SVGTextPositioningElement to WebIDL r=bz
content/svg/content/src/Makefile.in
content/svg/content/src/SVGTextContentElement.cpp
content/svg/content/src/SVGTextContentElement.h
content/svg/content/src/SVGTextPositioningElement.cpp
content/svg/content/src/SVGTextPositioningElement.h
content/svg/content/src/nsSVGAltGlyphElement.cpp
content/svg/content/src/nsSVGTSpanElement.cpp
content/svg/content/src/nsSVGTextElement.cpp
content/svg/content/src/nsSVGTextPositioningElement.cpp
content/svg/content/src/nsSVGTextPositioningElement.h
dom/bindings/Bindings.conf
dom/webidl/SVGTextPositioningElement.webidl
dom/webidl/WebIDL.mk
--- a/content/svg/content/src/Makefile.in
+++ b/content/svg/content/src/Makefile.in
@@ -63,17 +63,16 @@ CPPSRCS		= \
 		nsSVGPatternElement.cpp \
 		nsSVGPolyElement.cpp \
 		nsSVGString.cpp \
 		nsSVGRect.cpp \
 		nsSVGSVGElement.cpp \
 		nsSVGSymbolElement.cpp \
 		nsSVGTSpanElement.cpp \
 		nsSVGTextElement.cpp \
-		nsSVGTextPositioningElement.cpp \
 		nsSVGUnknownElement.cpp \
 		nsSVGUseElement.cpp \
 		nsSVGViewBox.cpp \
 		nsSVGViewElement.cpp \
 		SVGAngle.cpp \
 		SVGAnimatedAngle.cpp \
 		SVGAnimatedBoolean.cpp \
 		SVGAnimatedLengthList.cpp \
@@ -125,16 +124,17 @@ CPPSRCS		= \
 		SVGScriptElement.cpp \
 		SVGSetElement.cpp \
 		SVGStopElement.cpp \
 		SVGStringList.cpp \
 		SVGStyleElement.cpp \
 		SVGSwitchElement.cpp \
 		SVGTextContentElement.cpp \
 		SVGTextPathElement.cpp \
+		SVGTextPositioningElement.cpp \
 		SVGTitleElement.cpp \
 		SVGTransform.cpp \
 		SVGTransformableElement.cpp \
 		SVGTransformList.cpp \
 		SVGTransformListParser.cpp \
 		SVGTransformListSMILType.cpp \
 		SVGViewBoxSMILType.cpp \
 		$(NULL)
@@ -177,16 +177,17 @@ EXPORTS_mozilla/dom = \
 	SVGRectElement.h \
 	SVGScriptElement.h \
 	SVGSetElement.h \
 	SVGStopElement.h \
 	SVGStyleElement.h \
 	SVGSwitchElement.h \
 	SVGTextContentElement.h \
 	SVGTextPathElement.h \
+	SVGTextPositioningElement.h \
 	SVGTitleElement.h \
 	SVGTransformableElement.h \
 	$(NULL)
 
 include $(topsrcdir)/config/rules.mk
 
 INCLUDES += 	\
 		-I$(srcdir)/../../../xml/content/src \
--- a/content/svg/content/src/SVGTextContentElement.cpp
+++ b/content/svg/content/src/SVGTextContentElement.cpp
@@ -1,30 +1,23 @@
 /* -*- 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/dom/SVGTextContentElement.h"
-#include "mozilla/dom/SVGTextContentElementBinding.h"
 #include "nsISVGPoint.h"
 #include "nsSVGTextContainerFrame.h"
 #include "nsIDOMSVGAnimatedLength.h"
 #include "nsIDOMSVGRect.h"
 #include "nsIDOMSVGAnimatedEnum.h"
 
 namespace mozilla {
 namespace dom {
 
-JSObject*
-SVGTextContentElement::WrapNode(JSContext *aCx, JSObject *aScope, bool *aTriedToWrap)
-{
-  return SVGTextContentElementBinding::Wrap(aCx, aScope, this, aTriedToWrap);
-}
-
 nsSVGTextContainerFrame*
 SVGTextContentElement::GetTextContainerFrame()
 {
   return do_QueryFrame(GetPrimaryFrame(Flush_Layout));
 }
 
 //----------------------------------------------------------------------
 // nsISupports methods
--- a/content/svg/content/src/SVGTextContentElement.h
+++ b/content/svg/content/src/SVGTextContentElement.h
@@ -41,16 +41,14 @@ public:
 
 protected:
 
   SVGTextContentElement(already_AddRefed<nsINodeInfo> aNodeInfo)
     : SVGTextContentElementBase(aNodeInfo)
   {}
 
   nsSVGTextContainerFrame* GetTextContainerFrame();
-
-  virtual JSObject* WrapNode(JSContext *cx, JSObject *scope, bool *triedToWrap) MOZ_OVERRIDE;
 };
 
 } // namespace dom
 } // namespace mozilla
 
 #endif // mozilla_dom_SVGTextContentElement_h
rename from content/svg/content/src/nsSVGTextPositioningElement.cpp
rename to content/svg/content/src/SVGTextPositioningElement.cpp
--- a/content/svg/content/src/nsSVGTextPositioningElement.cpp
+++ b/content/svg/content/src/SVGTextPositioningElement.cpp
@@ -1,87 +1,127 @@
 /* -*- 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 "nsSVGTextPositioningElement.h"
+#include "mozilla/dom/SVGTextPositioningElement.h"
+#include "mozilla/dom/SVGTextPositioningElementBinding.h"
 #include "SVGAnimatedLengthList.h"
 #include "DOMSVGAnimatedLengthList.h"
 #include "DOMSVGAnimatedNumberList.h"
 #include "SVGContentUtils.h"
 #include "SVGLengthList.h"
 
-using namespace mozilla;
+namespace mozilla {
+namespace dom {
 
+JSObject*
+SVGTextPositioningElement::WrapNode(JSContext *aCx, JSObject *aScope, bool *aTriedToWrap)
+{
+  return SVGTextPositioningElementBinding::Wrap(aCx, aScope, this, aTriedToWrap);
+}
 
-nsSVGElement::LengthListInfo nsSVGTextPositioningElement::sLengthListInfo[4] =
+nsSVGElement::LengthListInfo SVGTextPositioningElement::sLengthListInfo[4] =
 {
   { &nsGkAtoms::x,  SVGContentUtils::X, false },
   { &nsGkAtoms::y,  SVGContentUtils::Y, false },
   { &nsGkAtoms::dx, SVGContentUtils::X, true },
   { &nsGkAtoms::dy, SVGContentUtils::Y, true }
 };
 
 nsSVGElement::LengthListAttributesInfo
-nsSVGTextPositioningElement::GetLengthListInfo()
+SVGTextPositioningElement::GetLengthListInfo()
 {
   return LengthListAttributesInfo(mLengthListAttributes, sLengthListInfo,
                                   ArrayLength(sLengthListInfo));
 }
 
 
-nsSVGElement::NumberListInfo nsSVGTextPositioningElement::sNumberListInfo[1] =
+nsSVGElement::NumberListInfo SVGTextPositioningElement::sNumberListInfo[1] =
 {
   { &nsGkAtoms::rotate }
 };
 
 nsSVGElement::NumberListAttributesInfo
-nsSVGTextPositioningElement::GetNumberListInfo()
+SVGTextPositioningElement::GetNumberListInfo()
 {
   return NumberListAttributesInfo(mNumberListAttributes, sNumberListInfo,
                                   ArrayLength(sNumberListInfo));
 }
 
 //----------------------------------------------------------------------
 // nsIDOMSVGTextPositioningElement methods
 
 /* readonly attribute DOMSVGAnimatedLengthList x; */
-NS_IMETHODIMP nsSVGTextPositioningElement::GetX(nsISupports * *aX)
+NS_IMETHODIMP SVGTextPositioningElement::GetX(nsISupports * *aX)
 {
-  *aX = DOMSVGAnimatedLengthList::GetDOMWrapper(&mLengthListAttributes[X],
-                                                this, X, SVGContentUtils::X).get();
+  *aX = X().get();
   return NS_OK;
 }
 
+already_AddRefed<DOMSVGAnimatedLengthList>
+SVGTextPositioningElement::X()
+{
+  return DOMSVGAnimatedLengthList::GetDOMWrapper(&mLengthListAttributes[ATTR_X],
+                                                 this, ATTR_X, SVGContentUtils::X);
+}
+
 /* readonly attribute DOMSVGAnimatedLengthList y; */
-NS_IMETHODIMP nsSVGTextPositioningElement::GetY(nsISupports * *aY)
+NS_IMETHODIMP SVGTextPositioningElement::GetY(nsISupports * *aY)
 {
-  *aY = DOMSVGAnimatedLengthList::GetDOMWrapper(&mLengthListAttributes[Y],
-                                                this, Y, SVGContentUtils::Y).get();
+  *aY = Y().get();
   return NS_OK;
 }
 
+already_AddRefed<DOMSVGAnimatedLengthList>
+SVGTextPositioningElement::Y()
+{
+  return DOMSVGAnimatedLengthList::GetDOMWrapper(&mLengthListAttributes[ATTR_Y],
+                                                 this, ATTR_Y, SVGContentUtils::Y);
+}
+
 /* readonly attribute DOMSVGAnimatedLengthList dx; */
-NS_IMETHODIMP nsSVGTextPositioningElement::GetDx(nsISupports * *aDx)
+NS_IMETHODIMP SVGTextPositioningElement::GetDx(nsISupports * *aDx)
 {
-  *aDx = DOMSVGAnimatedLengthList::GetDOMWrapper(&mLengthListAttributes[DX],
-                                                 this, DX, SVGContentUtils::X).get();
+  *aDx = Dx().get();
   return NS_OK;
 }
 
+already_AddRefed<DOMSVGAnimatedLengthList>
+SVGTextPositioningElement::Dx()
+{
+  return DOMSVGAnimatedLengthList::GetDOMWrapper(&mLengthListAttributes[ATTR_DX],
+                                                 this, ATTR_DX, SVGContentUtils::X);
+}
+
 /* readonly attribute DOMSVGAnimatedLengthList dy; */
-NS_IMETHODIMP nsSVGTextPositioningElement::GetDy(nsISupports * *aDy)
+NS_IMETHODIMP SVGTextPositioningElement::GetDy(nsISupports * *aDy)
 {
-  *aDy = DOMSVGAnimatedLengthList::GetDOMWrapper(&mLengthListAttributes[DY],
-                                                 this, DY, SVGContentUtils::Y).get();
+  *aDy = Dy().get();
   return NS_OK;
 }
 
-/* readonly attribute DOMSVGAnimatedNumberList rotate; */
-NS_IMETHODIMP nsSVGTextPositioningElement::GetRotate(nsISupports * *aRotate)
+already_AddRefed<DOMSVGAnimatedLengthList>
+SVGTextPositioningElement::Dy()
 {
-  *aRotate = DOMSVGAnimatedNumberList::GetDOMWrapper(&mNumberListAttributes[ROTATE],
-                                                     this, ROTATE).get();
+  return DOMSVGAnimatedLengthList::GetDOMWrapper(&mLengthListAttributes[ATTR_DY],
+                                                 this, ATTR_DY, SVGContentUtils::Y);
+}
+
+/* readonly attribute DOMSVGAnimatedNumberList rotate; */
+NS_IMETHODIMP SVGTextPositioningElement::GetRotate(nsISupports * *aRotate)
+{
+  *aRotate = Rotate().get();
   return NS_OK;
 }
+
+already_AddRefed<DOMSVGAnimatedNumberList>
+SVGTextPositioningElement::Rotate()
+{
+  return DOMSVGAnimatedNumberList::GetDOMWrapper(&mNumberListAttributes[ROTATE],
+                                                 this, ROTATE);
+}
+
+} // namespace dom
+} // namespace mozilla
rename from content/svg/content/src/nsSVGTextPositioningElement.h
rename to content/svg/content/src/SVGTextPositioningElement.h
--- a/content/svg/content/src/nsSVGTextPositioningElement.h
+++ b/content/svg/content/src/SVGTextPositioningElement.h
@@ -1,52 +1,65 @@
 /* -*- 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_SVGTEXTPOSITIONINGELEMENTBASE_H__
-#define __NS_SVGTEXTPOSITIONINGELEMENTBASE_H__
+#ifndef mozilla_dom_SVGTextPositioningElement_h
+#define mozilla_dom_SVGTextPositioningElement_h
 
 #include "nsIDOMSVGTextPositionElem.h"
-#include "SVGTextContentElement.h"
+#include "mozilla/dom/SVGTextContentElement.h"
 #include "SVGAnimatedLengthList.h"
 #include "SVGAnimatedNumberList.h"
 
 class nsSVGElement;
 
 namespace mozilla {
 class SVGAnimatedLengthList;
-}
+class DOMSVGAnimatedLengthList;
+class DOMSVGAnimatedNumberList;
 
-typedef mozilla::dom::SVGTextContentElement nsSVGTextPositioningElementBase;
+namespace dom {
+typedef SVGTextContentElement SVGTextPositioningElementBase;
 
 /**
  * Note that nsSVGTextElement does not inherit this class - it reimplements it
  * instead (see its documenting comment). The upshot is that any changes to
  * this class also need to be made in nsSVGTextElement.
  */
-class nsSVGTextPositioningElement : public nsSVGTextPositioningElementBase
+class SVGTextPositioningElement : public SVGTextPositioningElementBase
 {
 public:
   NS_DECL_NSIDOMSVGTEXTPOSITIONINGELEMENT
 
+  // WebIDL
+  already_AddRefed<DOMSVGAnimatedLengthList> X();
+  already_AddRefed<DOMSVGAnimatedLengthList> Y();
+  already_AddRefed<DOMSVGAnimatedLengthList> Dx();
+  already_AddRefed<DOMSVGAnimatedLengthList> Dy();
+  already_AddRefed<DOMSVGAnimatedNumberList> Rotate();
+
 protected:
 
-  nsSVGTextPositioningElement(already_AddRefed<nsINodeInfo> aNodeInfo)
-    : nsSVGTextPositioningElementBase(aNodeInfo)
+  SVGTextPositioningElement(already_AddRefed<nsINodeInfo> aNodeInfo)
+    : SVGTextPositioningElementBase(aNodeInfo)
   {}
+  virtual JSObject* WrapNode(JSContext *cx, JSObject *scope, bool *triedToWrap) MOZ_OVERRIDE;
 
   virtual LengthListAttributesInfo GetLengthListInfo();
   virtual NumberListAttributesInfo GetNumberListInfo();
 
   // nsIDOMSVGTextPositioning properties:
 
-  enum { X, Y, DX, DY };
+  enum { ATTR_X, ATTR_Y, ATTR_DX, ATTR_DY };
   SVGAnimatedLengthList mLengthListAttributes[4];
   static LengthListInfo sLengthListInfo[4];
 
   enum { ROTATE };
   SVGAnimatedNumberList mNumberListAttributes[1];
   static NumberListInfo sNumberListInfo[1];
 };
 
-#endif
+} // namespace dom
+} // namespace mozilla
+
+#endif // mozilla_dom_SVGTextPositioningElement_h
--- a/content/svg/content/src/nsSVGAltGlyphElement.cpp
+++ b/content/svg/content/src/nsSVGAltGlyphElement.cpp
@@ -4,22 +4,22 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "mozilla/Util.h"
 
 #include "nsGkAtoms.h"
 #include "nsIDOMSVGAltGlyphElement.h"
 #include "nsIDOMSVGURIReference.h"
 #include "nsSVGString.h"
-#include "nsSVGTextPositioningElement.h"
+#include "SVGTextPositioningElement.h"
 #include "nsContentUtils.h"
 
 using namespace mozilla;
 
-typedef nsSVGTextPositioningElement nsSVGAltGlyphElementBase;
+typedef dom::SVGTextPositioningElement nsSVGAltGlyphElementBase;
 
 class nsSVGAltGlyphElement : public nsSVGAltGlyphElementBase, // = nsIDOMSVGTextPositioningElement
                              public nsIDOMSVGAltGlyphElement,
                              public nsIDOMSVGURIReference
 {
 protected:
   friend nsresult NS_NewSVGAltGlyphElement(nsIContent **aResult,
                                            already_AddRefed<nsINodeInfo> aNodeInfo);
--- a/content/svg/content/src/nsSVGTSpanElement.cpp
+++ b/content/svg/content/src/nsSVGTSpanElement.cpp
@@ -3,22 +3,22 @@
  * 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 "nsGkAtoms.h"
 #include "nsIDOMSVGTSpanElement.h"
 #include "nsSVGSVGElement.h"
-#include "nsSVGTextPositioningElement.h"
+#include "SVGTextPositioningElement.h"
 #include "nsContentUtils.h"
 
 using namespace mozilla;
 
-typedef nsSVGTextPositioningElement nsSVGTSpanElementBase;
+typedef dom::SVGTextPositioningElement nsSVGTSpanElementBase;
 
 class nsSVGTSpanElement : public nsSVGTSpanElementBase, // = nsIDOMSVGTextPositioningElement
                           public nsIDOMSVGTSpanElement
 {
 protected:
   friend nsresult NS_NewSVGTSpanElement(nsIContent **aResult,
                                         already_AddRefed<nsINodeInfo> aNodeInfo);
   nsSVGTSpanElement(already_AddRefed<nsINodeInfo> aNodeInfo);
--- a/content/svg/content/src/nsSVGTextElement.cpp
+++ b/content/svg/content/src/nsSVGTextElement.cpp
@@ -5,17 +5,17 @@
 
 #include "mozilla/Util.h"
 
 #include "SVGGraphicsElement.h"
 #include "nsGkAtoms.h"
 #include "nsIDOMSVGTextElement.h"
 #include "nsCOMPtr.h"
 #include "nsSVGSVGElement.h"
-#include "nsSVGTextPositioningElement.h"
+#include "SVGTextPositioningElement.h"
 #include "nsError.h"
 #include "SVGAnimatedLengthList.h"
 #include "DOMSVGAnimatedLengthList.h"
 #include "SVGLengthList.h"
 #include "SVGNumberList.h"
 #include "SVGAnimatedNumberList.h"
 #include "DOMSVGAnimatedNumberList.h"
 #include "DOMSVGPoint.h"
--- a/dom/bindings/Bindings.conf
+++ b/dom/bindings/Bindings.conf
@@ -763,16 +763,20 @@ DOMInterfaces = {
     'resultNotAddRefed': [ 'getItem' ]
 },
 
 'SVGPreserveAspectRatio': {
     'nativeType': 'mozilla::dom::DOMSVGPreserveAspectRatio',
     'headerFile': 'SVGPreserveAspectRatio.h'
 },
 
+'SVGTextContentElement': {
+    'concrete': False
+},
+
 'SVGTitleElement': {
   'hasInstanceInterface': 'nsIDOMSVGTitleElement',
 },
 
 'SVGTransform': {
     'nativeType': 'mozilla::DOMSVGTransform',
     'headerFile': 'DOMSVGTransform.h'
 },
new file mode 100644
--- /dev/null
+++ b/dom/webidl/SVGTextPositioningElement.webidl
@@ -0,0 +1,20 @@
+/* -*- 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 SVGTextPositioningElement : SVGTextContentElement {
+  readonly attribute SVGAnimatedLengthList x;
+  readonly attribute SVGAnimatedLengthList y;
+  readonly attribute SVGAnimatedLengthList dx;
+  readonly attribute SVGAnimatedLengthList dy;
+  readonly attribute SVGAnimatedNumberList rotate;
+};
+
--- a/dom/webidl/WebIDL.mk
+++ b/dom/webidl/WebIDL.mk
@@ -135,16 +135,17 @@ webidl_files = \
   SVGScriptElement.webidl \
   SVGSetElement.webidl \
   SVGStopElement.webidl \
   SVGStyleElement.webidl \
   SVGSwitchElement.webidl \
   SVGTests.webidl \
   SVGTextContentElement.webidl \
   SVGTextPathElement.webidl \
+  SVGTextPositioningElement.webidl \
   SVGTitleElement.webidl \
   SVGTransform.webidl \
   SVGTransformableElement.webidl \
   SVGTransformList.webidl \
   SVGURIReference.webidl \
   Text.webidl \
   TextDecoder.webidl \
   TextEncoder.webidl \