Bug 824229 Part 4: Implement SVGTransformableElement r=longsonr
authorDavid Zbarsky <dzbarsky@gmail.com>
Thu, 03 Jan 2013 01:17:02 -0500
changeset 126877 9c9681d775952ab2a7d7182e02bc116f00b4e6f7
parent 126876 d82e982042c8d321222322da7e1e4c1b6948f73c
child 126878 7cfc54a3465bf14fc23bf431890f42a367f240b1
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)
reviewerslongsonr
bugs824229
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 824229 Part 4: Implement SVGTransformableElement r=longsonr
content/svg/content/src/Makefile.in
content/svg/content/src/SVGTransformableElement.cpp
content/svg/content/src/SVGTransformableElement.h
dom/bindings/Bindings.conf
dom/webidl/SVGTransformableElement.webidl
dom/webidl/WebIDL.mk
--- a/content/svg/content/src/Makefile.in
+++ b/content/svg/content/src/Makefile.in
@@ -129,16 +129,17 @@ CPPSRCS		= \
 		SVGNumberListSMILType.cpp \
 		SVGNumberPairSMILType.cpp \
 		SVGOrientSMILType.cpp \
 		SVGPathSegListSMILType.cpp \
 		SVGPointListSMILType.cpp \
 		SVGScriptElement.cpp \
 		SVGStopElement.cpp \
 		SVGStyleElement.cpp \
+		SVGTransformableElement.cpp \
 		SVGTransformListSMILType.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
@@ -158,16 +159,17 @@ EXPORTS_mozilla/dom = \
 	SVGDescElement.h \
 	SVGLocatableElement.h \
 	SVGMetadataElement.h \
 	SVGMPathElement.h \
 	SVGScriptElement.h \
 	SVGStopElement.h \
 	SVGStyleElement.h \
 	SVGTitleElement.h \
+	SVGTransformableElement.h \
 	$(NULL)
 
 include $(topsrcdir)/config/rules.mk
 
 INCLUDES += 	\
 		-I$(srcdir)/../../../xml/content/src \
 		-I$(srcdir)/../../../../dom \
 		-I$(srcdir)/../../../base/src \
new file mode 100644
--- /dev/null
+++ b/content/svg/content/src/SVGTransformableElement.cpp
@@ -0,0 +1,46 @@
+/* -*- 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 "SVGTransformableElement.h"
+#include "DOMSVGAnimatedTransformList.h"
+
+namespace mozilla {
+namespace dom {
+
+//----------------------------------------------------------------------
+// nsISupports methods
+
+NS_IMPL_ADDREF_INHERITED(SVGTransformableElement, SVGLocatableElement)
+NS_IMPL_RELEASE_INHERITED(SVGTransformableElement, SVGLocatableElement)
+
+NS_INTERFACE_MAP_BEGIN(SVGTransformableElement)
+  NS_INTERFACE_MAP_ENTRY(nsIDOMSVGTransformable)
+NS_INTERFACE_MAP_END_INHERITING(SVGLocatableElement)
+
+
+//----------------------------------------------------------------------
+// nsIDOMSVGTransformable methods
+/* readonly attribute nsISupports transform; */
+
+NS_IMETHODIMP
+SVGTransformableElement::GetTransform(nsISupports **aTransform)
+{
+  *aTransform = Transform().get();
+  return NS_OK;
+}
+
+already_AddRefed<DOMSVGAnimatedTransformList>
+SVGTransformableElement::Transform()
+{
+  // We're creating a DOM wrapper, so we must tell GetAnimatedTransformList
+  // to allocate the SVGAnimatedTransformList if it hasn't already done so:
+  return DOMSVGAnimatedTransformList::GetDOMWrapper(
+           GetAnimatedTransformList(DO_ALLOCATE), this).get();
+
+}
+
+} // namespace dom
+} // namespace mozilla
+
new file mode 100644
--- /dev/null
+++ b/content/svg/content/src/SVGTransformableElement.h
@@ -0,0 +1,43 @@
+/* -*- 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 SVGTransformableElement_h
+#define SVGTransformableElement_h
+
+#include "SVGLocatableElement.h"
+#include "nsIDOMSVGTransformable.h"
+
+#define MOZILLA_SVGTRANSFORMABLEELEMENT_IID \
+  { 0x77888cba, 0x0b43, 0x4654, \
+    {0x96, 0x3c, 0xf5, 0x50, 0xfc, 0xb5, 0x5e, 0x32}}
+
+namespace mozilla {
+class DOMSVGAnimatedTransformList;
+
+namespace dom {
+class SVGTransformableElement : public SVGLocatableElement,
+                                public nsIDOMSVGTransformable
+{
+public:
+  SVGTransformableElement(already_AddRefed<nsINodeInfo> aNodeInfo)
+    : SVGLocatableElement(aNodeInfo) {}
+  virtual ~SVGTransformableElement() {}
+
+  NS_DECLARE_STATIC_IID_ACCESSOR(MOZILLA_SVGTRANSFORMABLEELEMENT_IID)
+  NS_DECL_ISUPPORTS_INHERITED
+  NS_DECL_NSIDOMSVGTRANSFORMABLE
+
+  // WebIDL
+  already_AddRefed<DOMSVGAnimatedTransformList> Transform();
+};
+
+NS_DEFINE_STATIC_IID_ACCESSOR(SVGTransformableElement,
+                              MOZILLA_SVGTRANSFORMABLEELEMENT_IID)
+
+} // namespace dom
+} // namespace mozilla
+
+#endif // SVGTransformableElement_h
+
--- a/dom/bindings/Bindings.conf
+++ b/dom/bindings/Bindings.conf
@@ -605,18 +605,18 @@ DOMInterfaces = {
 'SVGElement': {
     'nativeType': 'nsSVGElement',
     'hasXPConnectImpls': True,
     'hasInstanceInterface': 'nsIDOMSVGElement',
     'resultNotAddRefed': ['ownerSVGElement', 'style']
 },
 
 'SVGLocatableElement': {
-    'hasXPConnectImpls': True
-    'concrete': False,
+    'hasXPConnectImpls': True,
+    'concrete': False
 },
 
 'SVGLengthList': {
     'nativeType': 'mozilla::DOMSVGLengthList',
     'headerFile': 'DOMSVGLengthList.h',
     'resultNotAddRefed': [ 'getItem' ]
 },
 
@@ -758,16 +758,21 @@ DOMInterfaces = {
   'hasInstanceInterface': 'nsIDOMSVGTitleElement',
 },
 
 'SVGTransform': {
     'nativeType': 'mozilla::DOMSVGTransform',
     'headerFile': 'DOMSVGTransform.h'
 },
 
+'SVGTransformableElement': {
+    'hasXPConnectImpls': True,
+    'concrete': False
+},
+
 'SVGTransformList': {
     'nativeType': 'mozilla::DOMSVGTransformList',
     'headerFile': 'DOMSVGTransformList.h',
     'resultNotAddRefed': [ 'getItem' ]
 },
 
 'Text': {
     'nativeType': 'nsTextNode',
new file mode 100644
--- /dev/null
+++ b/dom/webidl/SVGTransformableElement.webidl
@@ -0,0 +1,16 @@
+/* -*- 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 SVGTransformableElement : SVGLocatableElement {
+  readonly attribute SVGAnimatedTransformList transform;
+};
+
--- a/dom/webidl/WebIDL.mk
+++ b/dom/webidl/WebIDL.mk
@@ -116,16 +116,17 @@ webidl_files = \
   SVGPoint.webidl \
   SVGPointList.webidl \
   SVGPreserveAspectRatio.webidl \
   SVGScriptElement.webidl \
   SVGStopElement.webidl \
   SVGStyleElement.webidl \
   SVGTitleElement.webidl \
   SVGTransform.webidl \
+  SVGTransformableElement.webidl \
   SVGTransformList.webidl \
   SVGURIReference.webidl \
   Text.webidl \
   TextDecoder.webidl \
   TextEncoder.webidl \
   URL.webidl \
   WebSocket.webidl \
   UndoManager.webidl \