From 1c06c28cc9e36eab7cb403e8f6a984aae9a99cca Mon Sep 17 00:00:00 2001 From: David Zbarsky Date: Fri, 4 Jan 2013 20:50:21 -0500 Subject: [PATCH] Bug 824327: Convert SVGMetadataElement to WebIDL r=bz --HG-- rename : content/svg/content/src/nsSVGMetadataElement.cpp => content/svg/content/src/SVGMetadataElement.cpp rename : content/svg/content/src/nsSVGMetadataElement.cpp => content/svg/content/src/SVGMetadataElement.h --- content/svg/content/src/Makefile.in | 3 +- .../svg/content/src/SVGMetadataElement.cpp | 59 +++++++++++++++ content/svg/content/src/SVGMetadataElement.h | 52 +++++++++++++ .../svg/content/src/nsSVGMetadataElement.cpp | 75 ------------------- dom/webidl/SVGMetadataElement.webidl | 15 ++++ dom/webidl/WebIDL.mk | 1 + 6 files changed, 129 insertions(+), 76 deletions(-) create mode 100644 content/svg/content/src/SVGMetadataElement.cpp create mode 100644 content/svg/content/src/SVGMetadataElement.h delete mode 100644 content/svg/content/src/nsSVGMetadataElement.cpp create mode 100644 dom/webidl/SVGMetadataElement.webidl diff --git a/content/svg/content/src/Makefile.in b/content/svg/content/src/Makefile.in index cababe8b1d0..7740ba24f97 100644 --- a/content/svg/content/src/Makefile.in +++ b/content/svg/content/src/Makefile.in @@ -63,7 +63,6 @@ CPPSRCS = \ nsSVGLineElement.cpp \ nsSVGMarkerElement.cpp \ nsSVGMaskElement.cpp \ - nsSVGMetadataElement.cpp \ nsSVGNumber2.cpp \ nsSVGNumberPair.cpp \ nsSVGPathDataParser.cpp \ @@ -122,6 +121,7 @@ CPPSRCS = \ SVGDescElement.cpp \ SVGIntegerPairSMILType.cpp \ SVGLengthListSMILType.cpp \ + SVGMetadataElement.cpp \ SVGMotionSMILType.cpp \ SVGMotionSMILAttr.cpp \ SVGMotionSMILAnimationFunction.cpp \ @@ -155,6 +155,7 @@ EXPORTS_mozilla/dom = \ SVGAnimatedAngle.h \ SVGAnimatedBoolean.h \ SVGDescElement.h \ + SVGMetadataElement.h \ SVGStopElement.h \ SVGStyleElement.h \ SVGTitleElement.h \ diff --git a/content/svg/content/src/SVGMetadataElement.cpp b/content/svg/content/src/SVGMetadataElement.cpp new file mode 100644 index 00000000000..036113b0468 --- /dev/null +++ b/content/svg/content/src/SVGMetadataElement.cpp @@ -0,0 +1,59 @@ +/* -*- 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/SVGMetadataElement.h" +#include "mozilla/dom/SVGMetadataElementBinding.h" + +DOMCI_NODE_DATA(SVGMetadataElement, mozilla::dom::SVGMetadataElement) + +NS_IMPL_NS_NEW_NAMESPACED_SVG_ELEMENT(Metadata) + +namespace mozilla { +namespace dom { + +JSObject* +SVGMetadataElement::WrapNode(JSContext *aCx, JSObject *aScope, bool *aTriedToWrap) +{ + return SVGMetadataElementBinding::Wrap(aCx, aScope, this, aTriedToWrap); +} + +//---------------------------------------------------------------------- +// nsISupports methods + +NS_IMPL_ADDREF_INHERITED(SVGMetadataElement, SVGMetadataElementBase) +NS_IMPL_RELEASE_INHERITED(SVGMetadataElement, SVGMetadataElementBase) + +NS_INTERFACE_TABLE_HEAD(SVGMetadataElement) + NS_NODE_INTERFACE_TABLE4(SVGMetadataElement, nsIDOMNode, nsIDOMElement, + nsIDOMSVGElement, nsIDOMSVGMetadataElement) + NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(SVGMetadataElement) +NS_INTERFACE_MAP_END_INHERITING(SVGMetadataElementBase) + + +//---------------------------------------------------------------------- +// Implementation + +SVGMetadataElement::SVGMetadataElement(already_AddRefed aNodeInfo) + : SVGMetadataElementBase(aNodeInfo) +{ + SetIsDOMBinding(); +} + + +nsresult +SVGMetadataElement::Init() +{ + return NS_OK; +} + + +//---------------------------------------------------------------------- +// nsIDOMNode methods + +NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGMetadataElement) + +} // namespace dom +} // namespace mozilla + diff --git a/content/svg/content/src/SVGMetadataElement.h b/content/svg/content/src/SVGMetadataElement.h new file mode 100644 index 00000000000..7a6d1baf545 --- /dev/null +++ b/content/svg/content/src/SVGMetadataElement.h @@ -0,0 +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_SVGMetadataElement_h +#define mozilla_dom_SVGMetadataElement_h + +#include "nsSVGElement.h" +#include "nsIDOMSVGMetadataElement.h" + +nsresult NS_NewSVGMetadataElement(nsIContent **aResult, + already_AddRefed aNodeInfo); + +typedef nsSVGElement SVGMetadataElementBase; + +namespace mozilla { +namespace dom { + +class SVGMetadataElement MOZ_FINAL : public SVGMetadataElementBase, + public nsIDOMSVGMetadataElement +{ +protected: + friend nsresult (::NS_NewSVGMetadataElement(nsIContent **aResult, + already_AddRefed aNodeInfo)); + SVGMetadataElement(already_AddRefed aNodeInfo); + + virtual JSObject* WrapNode(JSContext *aCx, JSObject *aScope, bool *aTriedToWrap) MOZ_OVERRIDE; + nsresult Init(); + +public: + // interfaces: + + NS_DECL_ISUPPORTS_INHERITED + NS_DECL_NSIDOMSVGMETADATAELEMENT + + // xxx I wish we could use virtual inheritance + NS_FORWARD_NSIDOMNODE_TO_NSINODE + NS_FORWARD_NSIDOMELEMENT_TO_GENERIC + NS_FORWARD_NSIDOMSVGELEMENT(nsSVGElement::) + + virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const; + + virtual nsXPCClassInfo* GetClassInfo(); + + virtual nsIDOMNode* AsDOMNode() { return this; } +}; + +} // namespace dom +} // namespace mozilla + +#endif // mozilla_dom_SVGMetadataElement_h diff --git a/content/svg/content/src/nsSVGMetadataElement.cpp b/content/svg/content/src/nsSVGMetadataElement.cpp deleted file mode 100644 index af52ffae835..00000000000 --- a/content/svg/content/src/nsSVGMetadataElement.cpp +++ /dev/null @@ -1,75 +0,0 @@ -/* -*- 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 "nsIDOMSVGMetadataElement.h" - -typedef nsSVGElement nsSVGMetadataElementBase; - -class nsSVGMetadataElement : public nsSVGMetadataElementBase, - public nsIDOMSVGMetadataElement -{ -protected: - friend nsresult NS_NewSVGMetadataElement(nsIContent **aResult, - already_AddRefed aNodeInfo); - nsSVGMetadataElement(already_AddRefed aNodeInfo); - nsresult Init(); - -public: - // interfaces: - - NS_DECL_ISUPPORTS_INHERITED - NS_DECL_NSIDOMSVGMETADATAELEMENT - - // xxx I wish we could use virtual inheritance - NS_FORWARD_NSIDOMNODE_TO_NSINODE - NS_FORWARD_NSIDOMELEMENT_TO_GENERIC - NS_FORWARD_NSIDOMSVGELEMENT(nsSVGElement::) - - virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const; - - virtual nsXPCClassInfo* GetClassInfo(); - - virtual nsIDOMNode* AsDOMNode() { return this; } -}; - -NS_IMPL_NS_NEW_SVG_ELEMENT(Metadata) - - -//---------------------------------------------------------------------- -// nsISupports methods - -NS_IMPL_ADDREF_INHERITED(nsSVGMetadataElement, nsSVGMetadataElementBase) -NS_IMPL_RELEASE_INHERITED(nsSVGMetadataElement, nsSVGMetadataElementBase) - -DOMCI_NODE_DATA(SVGMetadataElement, nsSVGMetadataElement) - -NS_INTERFACE_TABLE_HEAD(nsSVGMetadataElement) - NS_NODE_INTERFACE_TABLE4(nsSVGMetadataElement, nsIDOMNode, nsIDOMElement, - nsIDOMSVGElement, nsIDOMSVGMetadataElement) - NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(SVGMetadataElement) -NS_INTERFACE_MAP_END_INHERITING(nsSVGMetadataElementBase) - - -//---------------------------------------------------------------------- -// Implementation - -nsSVGMetadataElement::nsSVGMetadataElement(already_AddRefed aNodeInfo) - : nsSVGMetadataElementBase(aNodeInfo) -{ -} - - -nsresult -nsSVGMetadataElement::Init() -{ - return NS_OK; -} - - -//---------------------------------------------------------------------- -// nsIDOMNode methods - -NS_IMPL_ELEMENT_CLONE_WITH_INIT(nsSVGMetadataElement) diff --git a/dom/webidl/SVGMetadataElement.webidl b/dom/webidl/SVGMetadataElement.webidl new file mode 100644 index 00000000000..1c404f91f2d --- /dev/null +++ b/dom/webidl/SVGMetadataElement.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 SVGMetadataElement : SVGElement { +}; + diff --git a/dom/webidl/WebIDL.mk b/dom/webidl/WebIDL.mk index 97aa4aea426..a21f2f079a4 100644 --- a/dom/webidl/WebIDL.mk +++ b/dom/webidl/WebIDL.mk @@ -100,6 +100,7 @@ webidl_files = \ SVGElement.webidl \ SVGLengthList.webidl \ SVGMatrix.webidl \ + SVGMetadataElement.webidl \ SVGNumberList.webidl \ SVGPathSeg.webidl \ SVGPathSegList.webidl \