1 : /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 : /* ***** BEGIN LICENSE BLOCK *****
3 : * Version: MPL 1.1/GPL 2.0/LGPL 2.1
4 : *
5 : * The contents of this file are subject to the Mozilla Public License Version
6 : * 1.1 (the "License"); you may not use this file except in compliance with
7 : * the License. You may obtain a copy of the License at
8 : * http://www.mozilla.org/MPL/
9 : *
10 : * Software distributed under the License is distributed on an "AS IS" basis,
11 : * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 : * for the specific language governing rights and limitations under the
13 : * License.
14 : *
15 : * The Original Code is the Mozilla SVG project.
16 : *
17 : * The Initial Developer of the Original Code is
18 : * Crocodile Clips Ltd..
19 : * Portions created by the Initial Developer are Copyright (C) 2001
20 : * the Initial Developer. All Rights Reserved.
21 : *
22 : * Contributor(s):
23 : * Alex Fritze <alex.fritze@crocodile-clips.com> (original author)
24 : *
25 : * Alternatively, the contents of this file may be used under the terms of
26 : * either of the GNU General Public License Version 2 or later (the "GPL"),
27 : * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
28 : * in which case the provisions of the GPL or the LGPL are applicable instead
29 : * of those above. If you wish to allow use of your version of this file only
30 : * under the terms of either the GPL or the LGPL, and not to allow others to
31 : * use your version of this file under the terms of the MPL, indicate your
32 : * decision by deleting the provisions above and replace them with the notice
33 : * and other provisions required by the GPL or the LGPL. If you do not delete
34 : * the provisions above, a recipient may use your version of this file under
35 : * the terms of any one of the MPL, the GPL or the LGPL.
36 : *
37 : * ***** END LICENSE BLOCK ***** */
38 :
39 : #include "mozilla/Util.h"
40 :
41 : #include "nsSVGGraphicElement.h"
42 : #include "nsIDOMSVGDefsElement.h"
43 : #include "DOMSVGTests.h"
44 :
45 : using namespace mozilla;
46 :
47 : typedef nsSVGGraphicElement nsSVGDefsElementBase;
48 :
49 : class nsSVGDefsElement : public nsSVGDefsElementBase,
50 : public nsIDOMSVGDefsElement,
51 : public DOMSVGTests
52 0 : {
53 : protected:
54 : friend nsresult NS_NewSVGDefsElement(nsIContent **aResult,
55 : already_AddRefed<nsINodeInfo> aNodeInfo);
56 : nsSVGDefsElement(already_AddRefed<nsINodeInfo> aNodeInfo);
57 :
58 : public:
59 : // interfaces:
60 :
61 : NS_DECL_ISUPPORTS_INHERITED
62 : NS_DECL_NSIDOMSVGDEFSELEMENT
63 :
64 : // xxx I wish we could use virtual inheritance
65 0 : NS_FORWARD_NSIDOMNODE(nsSVGDefsElementBase::)
66 0 : NS_FORWARD_NSIDOMELEMENT(nsSVGDefsElementBase::)
67 0 : NS_FORWARD_NSIDOMSVGELEMENT(nsSVGDefsElementBase::)
68 :
69 : // nsIContent
70 : NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom* aAttribute) const;
71 :
72 : virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
73 :
74 : virtual nsXPCClassInfo* GetClassInfo();
75 : };
76 :
77 : ////////////////////////////////////////////////////////////////////////
78 : // implementation
79 :
80 :
81 0 : NS_IMPL_NS_NEW_SVG_ELEMENT(Defs)
82 :
83 :
84 : //----------------------------------------------------------------------
85 : // nsISupports methods
86 :
87 0 : NS_IMPL_ADDREF_INHERITED(nsSVGDefsElement,nsSVGDefsElementBase)
88 0 : NS_IMPL_RELEASE_INHERITED(nsSVGDefsElement,nsSVGDefsElementBase)
89 :
90 0 : DOMCI_NODE_DATA(SVGDefsElement, nsSVGDefsElement)
91 :
92 0 : NS_INTERFACE_TABLE_HEAD(nsSVGDefsElement)
93 0 : NS_NODE_INTERFACE_TABLE5(nsSVGDefsElement, nsIDOMNode, nsIDOMElement,
94 : nsIDOMSVGElement, nsIDOMSVGTests,
95 : nsIDOMSVGDefsElement)
96 0 : NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(SVGDefsElement)
97 0 : NS_INTERFACE_MAP_END_INHERITING(nsSVGDefsElementBase)
98 :
99 : //----------------------------------------------------------------------
100 : // Implementation
101 :
102 0 : nsSVGDefsElement::nsSVGDefsElement(already_AddRefed<nsINodeInfo> aNodeInfo)
103 0 : : nsSVGDefsElementBase(aNodeInfo)
104 : {
105 :
106 0 : }
107 :
108 : //----------------------------------------------------------------------
109 : // nsIDOMNode methods
110 :
111 :
112 0 : NS_IMPL_ELEMENT_CLONE_WITH_INIT(nsSVGDefsElement)
113 :
114 :
115 : //----------------------------------------------------------------------
116 : // nsIContent methods
117 :
118 : NS_IMETHODIMP_(bool)
119 0 : nsSVGDefsElement::IsAttributeMapped(const nsIAtom* name) const
120 : {
121 : static const MappedAttributeEntry* const map[] = {
122 : sFEFloodMap,
123 : sFiltersMap,
124 : sFontSpecificationMap,
125 : sGradientStopMap,
126 : sLightingEffectsMap,
127 : sMarkersMap,
128 : sTextContentElementsMap,
129 : sViewportsMap
130 : };
131 :
132 0 : return FindAttributeDependence(name, map) ||
133 0 : nsSVGDefsElementBase::IsAttributeMapped(name);
134 : }
|