diff --git a/content/svg/content/src/Makefile.in b/content/svg/content/src/Makefile.in index 57d5902e1e77..34f5b783da79 100644 --- a/content/svg/content/src/Makefile.in +++ b/content/svg/content/src/Makefile.in @@ -119,6 +119,7 @@ CPPSRCS = \ nsSVGTextPathElement.cpp \ nsSVGTextPositioningElement.cpp \ nsSVGTitleElement.cpp \ + nsSVGUnknownElement.cpp \ nsSVGUseElement.cpp \ nsSVGViewBox.cpp \ SVGAnimatedLengthList.cpp \ diff --git a/content/svg/content/src/nsSVGElementFactory.cpp b/content/svg/content/src/nsSVGElementFactory.cpp index e1861db5475d..3853fcf169bb 100644 --- a/content/svg/content/src/nsSVGElementFactory.cpp +++ b/content/svg/content/src/nsSVGElementFactory.cpp @@ -239,6 +239,10 @@ nsresult NS_NewSVGSetElement(nsIContent **aResult, already_AddRefed aNodeInfo); +nsresult +NS_NewSVGUnknownElement(nsIContent **aResult, + already_AddRefed aNodeInfo); + nsresult NS_NewSVGElement(nsIContent** aResult, already_AddRefed aNodeInfo, FromParser aFromParser) @@ -379,7 +383,7 @@ NS_NewSVGElement(nsIContent** aResult, already_AddRefed aNodeInfo, return NS_NewSVGSetElement(aResult, aNodeInfo); } - // if we don't know what to create, just create a standard xml element: - return NS_NewXMLElement(aResult, aNodeInfo); + // if we don't know what to create, just create a standard svg element: + return NS_NewSVGUnknownElement(aResult, aNodeInfo); } diff --git a/content/svg/content/src/nsSVGUnknownElement.cpp b/content/svg/content/src/nsSVGUnknownElement.cpp new file mode 100644 index 000000000000..73511b8c3080 --- /dev/null +++ b/content/svg/content/src/nsSVGUnknownElement.cpp @@ -0,0 +1,89 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is the Mozilla SVG project. + * + * The Initial Developer of the Original Code is Brian O'Keefe. + * Portions created by the Initial Developer are Copyright (C) 2011 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Brian O'Keefe + * + * Alternatively, the contents of this file may be used under the terms of + * either of the GNU General Public License Version 2 or later (the "GPL"), + * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +#include "nsSVGElement.h" +#include "nsIDOMSVGElement.h" + +using namespace mozilla; + +typedef nsSVGElement nsSVGUnknownElementBase; + +class nsSVGUnknownElement : public nsSVGUnknownElementBase, + public nsIDOMSVGElement +{ +protected: + friend nsresult NS_NewSVGUnknownElement(nsIContent **aResult, + already_AddRefed aNodeInfo); + nsSVGUnknownElement(already_AddRefed aNodeInfo); + +public: + // interfaces: + NS_DECL_ISUPPORTS_INHERITED + + // xxx I wish we could use virtual inheritance + NS_FORWARD_NSIDOMNODE(nsSVGUnknownElementBase::) + NS_FORWARD_NSIDOMELEMENT(nsSVGUnknownElementBase::) + NS_FORWARD_NSIDOMSVGELEMENT(nsSVGUnknownElementBase::) + + virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const; + + virtual nsXPCClassInfo* GetClassInfo(); +}; + +NS_IMPL_NS_NEW_SVG_ELEMENT(Unknown) + +//---------------------------------------------------------------------- +// nsISupports methods + +NS_IMPL_ADDREF_INHERITED(nsSVGUnknownElement, nsSVGUnknownElementBase) +NS_IMPL_RELEASE_INHERITED(nsSVGUnknownElement, nsSVGUnknownElementBase) + +DOMCI_NODE_DATA(SVGUnknownElement, nsSVGUnknownElement) + +NS_INTERFACE_TABLE_HEAD(nsSVGUnknownElement) + NS_NODE_INTERFACE_TABLE3(nsSVGUnknownElement, nsIDOMNode, nsIDOMElement, + nsIDOMSVGElement) +NS_INTERFACE_MAP_END_INHERITING(nsSVGUnknownElementBase) +//---------------------------------------------------------------------- +// Implementation + +nsSVGUnknownElement::nsSVGUnknownElement(already_AddRefed aNodeInfo) + : nsSVGUnknownElementBase(aNodeInfo) +{ +} + +NS_IMPL_ELEMENT_CLONE_WITH_INIT(nsSVGUnknownElement) diff --git a/content/svg/content/test/Makefile.in b/content/svg/content/test/Makefile.in index 408c37eee6de..4d8c8ccbc590 100644 --- a/content/svg/content/test/Makefile.in +++ b/content/svg/content/test/Makefile.in @@ -84,6 +84,7 @@ _TEST_FILES = \ animated-svg-image-helper.html \ animated-svg-image-helper.svg \ test_stroke-linecap-hit-testing.xhtml \ + test_SVG_namespace_ids.html \ test_SVGLengthList.xhtml \ test_SVGLengthList-2.xhtml \ test_SVGMatrix.xhtml \ diff --git a/content/svg/content/test/test_SVG_namespace_ids.html b/content/svg/content/test/test_SVG_namespace_ids.html new file mode 100644 index 000000000000..4e3c4e477645 --- /dev/null +++ b/content/svg/content/test/test_SVG_namespace_ids.html @@ -0,0 +1,116 @@ + + + + + Test for Bug 589640 + + + + + +Mozilla Bug 589640 +

+
+
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+
+
+
diff --git a/dom/base/nsDOMClassInfo.cpp b/dom/base/nsDOMClassInfo.cpp
index 2f3fc0122217..09cc63d0f781 100644
--- a/dom/base/nsDOMClassInfo.cpp
+++ b/dom/base/nsDOMClassInfo.cpp
@@ -1151,6 +1151,8 @@ static nsDOMClassInfoData sClassInfoData[] = {
                            ELEMENT_SCRIPTABLE_FLAGS)
   NS_DEFINE_CLASSINFO_DATA(SVGTSpanElement, nsElementSH,
                            ELEMENT_SCRIPTABLE_FLAGS)
+  NS_DEFINE_CLASSINFO_DATA_WITH_NAME(SVGUnknownElement, SVGElement, nsElementSH,
+                                     ELEMENT_SCRIPTABLE_FLAGS)
   NS_DEFINE_CLASSINFO_DATA(SVGUseElement, nsElementSH,
                            ELEMENT_SCRIPTABLE_FLAGS)
 
@@ -3460,6 +3462,10 @@ nsDOMClassInfo::Init()
     DOM_CLASSINFO_SVG_ELEMENT_MAP_ENTRIES
   DOM_CLASSINFO_MAP_END
 
+  DOM_CLASSINFO_MAP_BEGIN(SVGUnknownElement, nsIDOMSVGElement)
+    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)
diff --git a/dom/base/nsDOMClassInfoClasses.h b/dom/base/nsDOMClassInfoClasses.h
index bb18b71399ee..0bdb85c3354f 100644
--- a/dom/base/nsDOMClassInfoClasses.h
+++ b/dom/base/nsDOMClassInfoClasses.h
@@ -293,6 +293,7 @@ DOMCI_CLASS(SVGTextElement)
 DOMCI_CLASS(SVGTextPathElement)
 DOMCI_CLASS(SVGTitleElement)
 DOMCI_CLASS(SVGTSpanElement)
+DOMCI_CLASS(SVGUnknownElement)
 DOMCI_CLASS(SVGUseElement)
 
 // other SVG classes