From 9c8bb30ad053feddc4052a04f97b08975633d743 Mon Sep 17 00:00:00 2001 From: David Zbarsky Date: Fri, 8 Feb 2013 14:55:51 -0500 Subject: [PATCH] Bug 833446: Remove nsIDOMSVGUseElement r=peterv --- content/svg/content/src/SVGUseElement.cpp | 51 +++------------------- content/svg/content/src/SVGUseElement.h | 14 +----- dom/base/nsDOMClassInfo.cpp | 9 ---- dom/base/nsDOMClassInfoClasses.h | 1 - dom/interfaces/svg/Makefile.in | 1 - dom/interfaces/svg/nsIDOMSVGUseElement.idl | 34 --------------- 6 files changed, 6 insertions(+), 104 deletions(-) delete mode 100644 dom/interfaces/svg/nsIDOMSVGUseElement.idl diff --git a/content/svg/content/src/SVGUseElement.cpp b/content/svg/content/src/SVGUseElement.cpp index 69d6e3456a1c..ea6358c5991d 100644 --- a/content/svg/content/src/SVGUseElement.cpp +++ b/content/svg/content/src/SVGUseElement.cpp @@ -15,8 +15,6 @@ #include "mozilla/dom/Element.h" #include "nsContentUtils.h" -DOMCI_NODE_DATA(SVGUseElement, mozilla::dom::SVGUseElement) - NS_IMPL_NS_NEW_NAMESPACED_SVG_ELEMENT(Use) namespace mozilla { @@ -65,14 +63,10 @@ NS_IMPL_ADDREF_INHERITED(SVGUseElement,SVGUseElementBase) NS_IMPL_RELEASE_INHERITED(SVGUseElement,SVGUseElementBase) NS_INTERFACE_TABLE_HEAD_CYCLE_COLLECTION_INHERITED(SVGUseElement) - NS_NODE_INTERFACE_TABLE6(SVGUseElement, nsIDOMNode, nsIDOMElement, + NS_NODE_INTERFACE_TABLE5(SVGUseElement, nsIDOMNode, nsIDOMElement, nsIDOMSVGElement, nsIDOMSVGURIReference, - nsIDOMSVGUseElement, nsIMutationObserver) - NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(SVGUseElement) - if (aIID.Equals(NS_GET_IID(mozilla::dom::SVGUseElement))) - foundInterface = reinterpret_cast(this); - else + nsIMutationObserver) NS_INTERFACE_MAP_END_INHERITING(SVGUseElementBase) //---------------------------------------------------------------------- @@ -145,14 +139,6 @@ SVGUseElement::Href() } //---------------------------------------------------------------------- -// nsIDOMSVGUseElement methods - -/* readonly attribute nsIDOMSVGAnimatedLength x; */ -NS_IMETHODIMP SVGUseElement::GetX(nsIDOMSVGAnimatedLength * *aX) -{ - *aX = X().get(); - return NS_OK; -} already_AddRefed SVGUseElement::X() @@ -160,39 +146,18 @@ SVGUseElement::X() return mLengthAttributes[ATTR_X].ToDOMAnimatedLength(this); } -/* readonly attribute nsIDOMSVGAnimatedLength y; */ -NS_IMETHODIMP SVGUseElement::GetY(nsIDOMSVGAnimatedLength * *aY) -{ - *aY = Y().get(); - return NS_OK; -} - already_AddRefed SVGUseElement::Y() { return mLengthAttributes[ATTR_Y].ToDOMAnimatedLength(this); } -/* readonly attribute nsIDOMSVGAnimatedLength width; */ -NS_IMETHODIMP SVGUseElement::GetWidth(nsIDOMSVGAnimatedLength * *aWidth) -{ - *aWidth = Width().get(); - return NS_OK; -} - already_AddRefed SVGUseElement::Width() { return mLengthAttributes[ATTR_WIDTH].ToDOMAnimatedLength(this); } -/* readonly attribute nsIDOMSVGAnimatedLength height; */ -NS_IMETHODIMP SVGUseElement::GetHeight(nsIDOMSVGAnimatedLength * *aHeight) -{ - *aHeight = Height().get(); - return NS_OK; -} - already_AddRefed SVGUseElement::Height() { @@ -310,15 +275,9 @@ SVGUseElement::CreateAnonymousContent() for (nsCOMPtr content = GetParent(); content; content = content->GetParent()) { - nsCOMPtr useElement = do_QueryInterface(content); - - if (useElement) { - nsRefPtr useImpl; - useElement->QueryInterface(NS_GET_IID(mozilla::dom::SVGUseElement), - getter_AddRefs(useImpl)); - - if (useImpl && useImpl->mOriginal == mOriginal) - return nullptr; + if (content->IsSVG(nsGkAtoms::use) && + static_cast(content.get())->mOriginal == mOriginal) { + return nullptr; } } } diff --git a/content/svg/content/src/SVGUseElement.h b/content/svg/content/src/SVGUseElement.h index 8105e6fe86c7..39c8484a1e26 100644 --- a/content/svg/content/src/SVGUseElement.h +++ b/content/svg/content/src/SVGUseElement.h @@ -8,7 +8,6 @@ #include "mozilla/dom/FromParser.h" #include "nsIDOMSVGURIReference.h" -#include "nsIDOMSVGUseElement.h" #include "nsReferencedElement.h" #include "nsStubMutationObserver.h" #include "mozilla/dom/SVGGraphicsElement.h" @@ -20,10 +19,6 @@ class nsIContent; class nsINodeInfo; class nsSVGUseFrame; -#define NS_SVG_USE_ELEMENT_IMPL_CID \ -{ 0x55fb86fe, 0xd81f, 0x4ae4, \ - { 0x80, 0x3f, 0xeb, 0x90, 0xfe, 0xe0, 0x7a, 0xe9 } } - nsresult NS_NewSVGSVGElement(nsIContent **aResult, already_AddRefed aNodeInfo, @@ -37,7 +32,7 @@ namespace dom { typedef SVGGraphicsElement SVGUseElementBase; class SVGUseElement MOZ_FINAL : public SVGUseElementBase, - public nsIDOMSVGUseElement, + public nsIDOMSVGElement, public nsIDOMSVGURIReference, public nsStubMutationObserver { @@ -50,13 +45,10 @@ protected: virtual JSObject* WrapNode(JSContext *cx, JSObject *scope, bool *triedToWrap) MOZ_OVERRIDE; public: - NS_DECLARE_STATIC_IID_ACCESSOR(NS_SVG_USE_ELEMENT_IMPL_CID) - // interfaces: NS_DECL_ISUPPORTS_INHERITED NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(SVGUseElement, SVGUseElementBase) - NS_DECL_NSIDOMSVGUSEELEMENT NS_DECL_NSIDOMSVGURIREFERENCE NS_DECL_NSIMUTATIONOBSERVER_CHARACTERDATACHANGED @@ -85,8 +77,6 @@ public: virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const; NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom* aAttribute) const; - virtual nsXPCClassInfo* GetClassInfo(); - virtual nsIDOMNode* AsDOMNode() { return this; } // WebIDL @@ -139,8 +129,6 @@ protected: SourceReference mSource; // observed element }; -NS_DEFINE_STATIC_IID_ACCESSOR(SVGUseElement, NS_SVG_USE_ELEMENT_IMPL_CID) - } // namespace dom } // namespace mozilla diff --git a/dom/base/nsDOMClassInfo.cpp b/dom/base/nsDOMClassInfo.cpp index f5ea3e18e087..5a305f2ec938 100644 --- a/dom/base/nsDOMClassInfo.cpp +++ b/dom/base/nsDOMClassInfo.cpp @@ -332,7 +332,6 @@ #include "nsIDOMSVGTitleElement.h" #include "nsIDOMSVGUnitTypes.h" #include "nsIDOMSVGURIReference.h" -#include "nsIDOMSVGUseElement.h" #include "nsIDOMSVGViewElement.h" #include "nsIDOMSVGZoomEvent.h" @@ -1091,8 +1090,6 @@ static nsDOMClassInfoData sClassInfoData[] = { ELEMENT_SCRIPTABLE_FLAGS) NS_DEFINE_CLASSINFO_DATA_WITH_NAME(SVGUnknownElement, SVGElement, nsElementSH, ELEMENT_SCRIPTABLE_FLAGS) - NS_DEFINE_CLASSINFO_DATA(SVGUseElement, nsElementSH, - ELEMENT_SCRIPTABLE_FLAGS) NS_DEFINE_CLASSINFO_DATA(SVGViewElement, nsElementSH, ELEMENT_SCRIPTABLE_FLAGS) @@ -3065,12 +3062,6 @@ nsDOMClassInfo::Init() DOM_CLASSINFO_SVG_ELEMENT_MAP_ENTRIES DOM_CLASSINFO_MAP_END - DOM_CLASSINFO_MAP_BEGIN(SVGUseElement, nsIDOMSVGUseElement) - DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGUseElement) - DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGURIReference) - DOM_CLASSINFO_SVG_GRAPHIC_ELEMENT_MAP_ENTRIES - DOM_CLASSINFO_MAP_END - DOM_CLASSINFO_MAP_BEGIN(SVGViewElement, nsIDOMSVGViewElement) DOM_CLASSINFO_SVG_ELEMENT_MAP_ENTRIES DOM_CLASSINFO_MAP_END diff --git a/dom/base/nsDOMClassInfoClasses.h b/dom/base/nsDOMClassInfoClasses.h index debd8c0674e1..035442b2f341 100644 --- a/dom/base/nsDOMClassInfoClasses.h +++ b/dom/base/nsDOMClassInfoClasses.h @@ -224,7 +224,6 @@ DOMCI_CLASS(SVGMarkerElement) DOMCI_CLASS(SVGMaskElement) DOMCI_CLASS(SVGTitleElement) DOMCI_CLASS(SVGUnknownElement) -DOMCI_CLASS(SVGUseElement) DOMCI_CLASS(SVGViewElement) // other SVG classes diff --git a/dom/interfaces/svg/Makefile.in b/dom/interfaces/svg/Makefile.in index a96942d79b84..6c0f3cd97610 100644 --- a/dom/interfaces/svg/Makefile.in +++ b/dom/interfaces/svg/Makefile.in @@ -40,7 +40,6 @@ XPIDLSRCS = \ nsIDOMSVGTitleElement.idl \ nsIDOMSVGURIReference.idl \ nsIDOMSVGUnitTypes.idl \ - nsIDOMSVGUseElement.idl \ nsIDOMSVGViewElement.idl \ nsIDOMSVGZoomEvent.idl \ $(NULL) diff --git a/dom/interfaces/svg/nsIDOMSVGUseElement.idl b/dom/interfaces/svg/nsIDOMSVGUseElement.idl deleted file mode 100644 index 8115d179b37d..000000000000 --- a/dom/interfaces/svg/nsIDOMSVGUseElement.idl +++ /dev/null @@ -1,34 +0,0 @@ -/* -*- 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/. */ - -#include "nsIDOMSVGElement.idl" - -interface nsIDOMSVGAnimatedLength; - -[scriptable, uuid(1C2F17CF-3ABF-4E03-94AF-E0A3B93CEEBB)] -interface nsIDOMSVGUseElement - : nsIDOMSVGElement -/* - The SVG DOM makes use of multiple interface inheritance. - Since XPCOM only supports single interface inheritance, - the best thing that we can do is to promise that whenever - an object implements _this_ interface it will also - implement the following interfaces. (We then have to QI to - hop between them.) - - nsIDOMSVGURIReference, - nsIDOMSVGTests, - nsIDOMSVGLangSpace, - nsIDOMSVGExternalResourcesRequired, - nsIDOMSVGStylable, - nsIDOMSVGTransformable, - events::nsIDOMEventTarget -*/ -{ - readonly attribute nsIDOMSVGAnimatedLength x; - readonly attribute nsIDOMSVGAnimatedLength y; - readonly attribute nsIDOMSVGAnimatedLength width; - readonly attribute nsIDOMSVGAnimatedLength height; -};