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 "nsIDOMSVGGElement.h"
43 : #include "DOMSVGTests.h"
44 :
45 : using namespace mozilla;
46 :
47 : typedef nsSVGGraphicElement nsSVGGElementBase;
48 :
49 : class nsSVGGElement : public nsSVGGElementBase,
50 : public nsIDOMSVGGElement,
51 : public DOMSVGTests
52 0 : {
53 : protected:
54 : friend nsresult NS_NewSVGGElement(nsIContent **aResult,
55 : already_AddRefed<nsINodeInfo> aNodeInfo);
56 : nsSVGGElement(already_AddRefed<nsINodeInfo> aNodeInfo);
57 :
58 : public:
59 : // interfaces:
60 :
61 : NS_DECL_ISUPPORTS_INHERITED
62 : NS_DECL_NSIDOMSVGGELEMENT
63 :
64 : // xxx I wish we could use virtual inheritance
65 0 : NS_FORWARD_NSIDOMNODE(nsSVGGElementBase::)
66 0 : NS_FORWARD_NSIDOMELEMENT(nsSVGGElementBase::)
67 0 : NS_FORWARD_NSIDOMSVGELEMENT(nsSVGGElementBase::)
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(G)
82 :
83 :
84 : //----------------------------------------------------------------------
85 : // nsISupports methods
86 :
87 0 : NS_IMPL_ADDREF_INHERITED(nsSVGGElement,nsSVGGElementBase)
88 0 : NS_IMPL_RELEASE_INHERITED(nsSVGGElement,nsSVGGElementBase)
89 :
90 0 : DOMCI_NODE_DATA(SVGGElement, nsSVGGElement)
91 :
92 0 : NS_INTERFACE_TABLE_HEAD(nsSVGGElement)
93 0 : NS_NODE_INTERFACE_TABLE5(nsSVGGElement, nsIDOMNode, nsIDOMElement,
94 : nsIDOMSVGElement, nsIDOMSVGTests,
95 : nsIDOMSVGGElement)
96 0 : NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(SVGGElement)
97 0 : NS_INTERFACE_MAP_END_INHERITING(nsSVGGElementBase)
98 :
99 : //----------------------------------------------------------------------
100 : // Implementation
101 :
102 0 : nsSVGGElement::nsSVGGElement(already_AddRefed<nsINodeInfo> aNodeInfo)
103 0 : : nsSVGGElementBase(aNodeInfo)
104 : {
105 :
106 0 : }
107 :
108 :
109 : //----------------------------------------------------------------------
110 : // nsIDOMNode methods
111 :
112 :
113 0 : NS_IMPL_ELEMENT_CLONE_WITH_INIT(nsSVGGElement)
114 :
115 :
116 : //----------------------------------------------------------------------
117 : // nsIContent methods
118 :
119 : NS_IMETHODIMP_(bool)
120 0 : nsSVGGElement::IsAttributeMapped(const nsIAtom* name) const
121 : {
122 : static const MappedAttributeEntry* const map[] = {
123 : sFEFloodMap,
124 : sFiltersMap,
125 : sFontSpecificationMap,
126 : sGradientStopMap,
127 : sLightingEffectsMap,
128 : sMarkersMap,
129 : sTextContentElementsMap,
130 : sViewportsMap
131 : };
132 :
133 0 : return FindAttributeDependence(name, map) ||
134 0 : nsSVGGElementBase::IsAttributeMapped(name);
135 : }
|