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) 2002
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 "nsGkAtoms.h"
42 : #include "nsIDOMSVGTSpanElement.h"
43 : #include "nsSVGSVGElement.h"
44 : #include "nsSVGTextPositioningElement.h"
45 : #include "nsContentUtils.h"
46 :
47 : using namespace mozilla;
48 :
49 : typedef nsSVGTextPositioningElement nsSVGTSpanElementBase;
50 :
51 : class nsSVGTSpanElement : public nsSVGTSpanElementBase, // = nsIDOMSVGTextPositioningElement
52 : public nsIDOMSVGTSpanElement
53 0 : {
54 : protected:
55 : friend nsresult NS_NewSVGTSpanElement(nsIContent **aResult,
56 : already_AddRefed<nsINodeInfo> aNodeInfo);
57 : nsSVGTSpanElement(already_AddRefed<nsINodeInfo> aNodeInfo);
58 :
59 : public:
60 : // interfaces:
61 :
62 : NS_DECL_ISUPPORTS_INHERITED
63 : NS_DECL_NSIDOMSVGTSPANELEMENT
64 :
65 : // xxx If xpcom allowed virtual inheritance we wouldn't need to
66 : // forward here :-(
67 0 : NS_FORWARD_NSIDOMNODE(nsSVGTSpanElementBase::)
68 0 : NS_FORWARD_NSIDOMELEMENT(nsSVGTSpanElementBase::)
69 0 : NS_FORWARD_NSIDOMSVGELEMENT(nsSVGTSpanElementBase::)
70 0 : NS_FORWARD_NSIDOMSVGTEXTCONTENTELEMENT(nsSVGTSpanElementBase::)
71 0 : NS_FORWARD_NSIDOMSVGTEXTPOSITIONINGELEMENT(nsSVGTSpanElementBase::)
72 :
73 : // nsIContent interface
74 : NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom* aAttribute) const;
75 :
76 : virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
77 :
78 : virtual nsXPCClassInfo* GetClassInfo();
79 : protected:
80 :
81 : // nsSVGElement overrides
82 : virtual bool IsEventName(nsIAtom* aName);
83 : };
84 :
85 :
86 0 : NS_IMPL_NS_NEW_SVG_ELEMENT(TSpan)
87 :
88 :
89 : //----------------------------------------------------------------------
90 : // nsISupports methods
91 :
92 0 : NS_IMPL_ADDREF_INHERITED(nsSVGTSpanElement,nsSVGTSpanElementBase)
93 0 : NS_IMPL_RELEASE_INHERITED(nsSVGTSpanElement,nsSVGTSpanElementBase)
94 :
95 0 : DOMCI_NODE_DATA(SVGTSpanElement, nsSVGTSpanElement)
96 :
97 0 : NS_INTERFACE_TABLE_HEAD(nsSVGTSpanElement)
98 0 : NS_NODE_INTERFACE_TABLE7(nsSVGTSpanElement, nsIDOMNode, nsIDOMElement,
99 : nsIDOMSVGElement, nsIDOMSVGTSpanElement,
100 : nsIDOMSVGTextPositioningElement,
101 : nsIDOMSVGTextContentElement,
102 : nsIDOMSVGTests)
103 0 : NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(SVGTSpanElement)
104 0 : NS_INTERFACE_MAP_END_INHERITING(nsSVGTSpanElementBase)
105 :
106 : //----------------------------------------------------------------------
107 : // Implementation
108 :
109 0 : nsSVGTSpanElement::nsSVGTSpanElement(already_AddRefed<nsINodeInfo> aNodeInfo)
110 0 : : nsSVGTSpanElementBase(aNodeInfo)
111 : {
112 :
113 0 : }
114 :
115 :
116 : //----------------------------------------------------------------------
117 : // nsIDOMNode methods
118 :
119 :
120 0 : NS_IMPL_ELEMENT_CLONE_WITH_INIT(nsSVGTSpanElement)
121 :
122 :
123 : //----------------------------------------------------------------------
124 : // nsIDOMSVGTSpanElement methods
125 :
126 : // - no methods -
127 :
128 : //----------------------------------------------------------------------
129 : // nsIContent methods
130 :
131 : NS_IMETHODIMP_(bool)
132 0 : nsSVGTSpanElement::IsAttributeMapped(const nsIAtom* name) const
133 : {
134 : static const MappedAttributeEntry* const map[] = {
135 : sColorMap,
136 : sFillStrokeMap,
137 : sFontSpecificationMap,
138 : sGraphicsMap,
139 : sTextContentElementsMap
140 : };
141 :
142 0 : return FindAttributeDependence(name, map) ||
143 0 : nsSVGTSpanElementBase::IsAttributeMapped(name);
144 : }
145 :
146 : //----------------------------------------------------------------------
147 : // nsSVGElement overrides
148 :
149 : bool
150 0 : nsSVGTSpanElement::IsEventName(nsIAtom* aName)
151 : {
152 0 : return nsContentUtils::IsEventAttributeName(aName, EventNameType_SVGGraphic);
153 : }
|