|
1 /* |
|
2 This file is part of the WebKit open source project. |
|
3 This file has been generated by generate-bindings.pl. DO NOT MODIFY! |
|
4 |
|
5 This library is free software; you can redistribute it and/or |
|
6 modify it under the terms of the GNU Library General Public |
|
7 License as published by the Free Software Foundation; either |
|
8 version 2 of the License, or (at your option) any later version. |
|
9 |
|
10 This library is distributed in the hope that it will be useful, |
|
11 but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
13 Library General Public License for more details. |
|
14 |
|
15 You should have received a copy of the GNU Library General Public License |
|
16 along with this library; see the file COPYING.LIB. If not, write to |
|
17 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
|
18 Boston, MA 02110-1301, USA. |
|
19 */ |
|
20 |
|
21 #include "config.h" |
|
22 |
|
23 |
|
24 #if ENABLE(SVG) |
|
25 |
|
26 #include "Document.h" |
|
27 #include "Frame.h" |
|
28 #include "SVGDocumentExtensions.h" |
|
29 #include "SVGElement.h" |
|
30 #include "SVGAnimatedTemplate.h" |
|
31 #include "JSSVGSymbolElement.h" |
|
32 |
|
33 #include <wtf/GetPtr.h> |
|
34 |
|
35 #include "CSSMutableStyleDeclaration.h" |
|
36 #include "CSSStyleDeclaration.h" |
|
37 #include "JSCSSStyleDeclaration.h" |
|
38 #include "JSSVGAnimatedBoolean.h" |
|
39 #include "JSSVGAnimatedPreserveAspectRatio.h" |
|
40 #include "JSSVGAnimatedRect.h" |
|
41 #include "JSSVGAnimatedString.h" |
|
42 #include "PlatformString.h" |
|
43 #include "SVGSymbolElement.h" |
|
44 |
|
45 using namespace KJS; |
|
46 |
|
47 namespace WebCore { |
|
48 |
|
49 /* Hash table */ |
|
50 |
|
51 static const HashEntry JSSVGSymbolElementTableEntries[] = |
|
52 { |
|
53 { "xmlspace", JSSVGSymbolElement::XmlspaceAttrNum, DontDelete, 0, 0 }, |
|
54 { "className", JSSVGSymbolElement::ClassNameAttrNum, DontDelete|ReadOnly, 0, 0 }, |
|
55 { "externalResourcesRequired", JSSVGSymbolElement::ExternalResourcesRequiredAttrNum, DontDelete|ReadOnly, 0, &JSSVGSymbolElementTableEntries[7] }, |
|
56 { 0, 0, 0, 0, 0 }, |
|
57 { 0, 0, 0, 0, 0 }, |
|
58 { "preserveAspectRatio", JSSVGSymbolElement::PreserveAspectRatioAttrNum, DontDelete|ReadOnly, 0, 0 }, |
|
59 { "xmllang", JSSVGSymbolElement::XmllangAttrNum, DontDelete, 0, 0 }, |
|
60 { "style", JSSVGSymbolElement::StyleAttrNum, DontDelete|ReadOnly, 0, &JSSVGSymbolElementTableEntries[8] }, |
|
61 { "viewBox", JSSVGSymbolElement::ViewBoxAttrNum, DontDelete|ReadOnly, 0, 0 } |
|
62 }; |
|
63 |
|
64 static const HashTable JSSVGSymbolElementTable = |
|
65 { |
|
66 2, 9, JSSVGSymbolElementTableEntries, 7 |
|
67 }; |
|
68 |
|
69 /* Hash table for prototype */ |
|
70 |
|
71 static const HashEntry JSSVGSymbolElementPrototypeTableEntries[] = |
|
72 { |
|
73 { 0, 0, 0, 0, 0 } |
|
74 }; |
|
75 |
|
76 static const HashTable JSSVGSymbolElementPrototypeTable = |
|
77 { |
|
78 2, 1, JSSVGSymbolElementPrototypeTableEntries, 1 |
|
79 }; |
|
80 |
|
81 const ClassInfo JSSVGSymbolElementPrototype::info = { "SVGSymbolElementPrototype", 0, &JSSVGSymbolElementPrototypeTable, 0 }; |
|
82 |
|
83 JSObject* JSSVGSymbolElementPrototype::self(ExecState* exec) |
|
84 { |
|
85 return KJS::cacheGlobalObject<JSSVGSymbolElementPrototype>(exec, "[[JSSVGSymbolElement.prototype]]"); |
|
86 } |
|
87 |
|
88 const ClassInfo JSSVGSymbolElement::info = { "SVGSymbolElement", &JSSVGElement::info, &JSSVGSymbolElementTable, 0 }; |
|
89 |
|
90 JSSVGSymbolElement::JSSVGSymbolElement(ExecState* exec, SVGSymbolElement* impl) |
|
91 : JSSVGElement(exec, impl) |
|
92 { |
|
93 setPrototype(JSSVGSymbolElementPrototype::self(exec)); |
|
94 } |
|
95 |
|
96 bool JSSVGSymbolElement::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) |
|
97 { |
|
98 return getStaticValueSlot<JSSVGSymbolElement, JSSVGElement>(exec, &JSSVGSymbolElementTable, this, propertyName, slot); |
|
99 } |
|
100 |
|
101 JSValue* JSSVGSymbolElement::getValueProperty(ExecState* exec, int token) const |
|
102 { |
|
103 switch (token) { |
|
104 case XmllangAttrNum: { |
|
105 SVGSymbolElement* imp = static_cast<SVGSymbolElement*>(impl()); |
|
106 |
|
107 return jsString(imp->xmllang()); |
|
108 } |
|
109 case XmlspaceAttrNum: { |
|
110 SVGSymbolElement* imp = static_cast<SVGSymbolElement*>(impl()); |
|
111 |
|
112 return jsString(imp->xmlspace()); |
|
113 } |
|
114 case ExternalResourcesRequiredAttrNum: { |
|
115 SVGSymbolElement* imp = static_cast<SVGSymbolElement*>(impl()); |
|
116 |
|
117 ASSERT(exec && exec->dynamicInterpreter()); |
|
118 |
|
119 RefPtr<SVGAnimatedBoolean> obj = imp->externalResourcesRequiredAnimated(); |
|
120 Frame* activeFrame = static_cast<ScriptInterpreter*>(exec->dynamicInterpreter())->frame(); |
|
121 if (activeFrame) { |
|
122 SVGDocumentExtensions* extensions = (activeFrame->document() ? activeFrame->document()->accessSVGExtensions() : 0); |
|
123 if (extensions) { |
|
124 if (extensions->hasGenericContext<SVGAnimatedBoolean>(obj.get())) |
|
125 ASSERT(extensions->genericContext<SVGAnimatedBoolean>(obj.get()) == imp); |
|
126 else |
|
127 extensions->setGenericContext<SVGAnimatedBoolean>(obj.get(), imp); |
|
128 } |
|
129 } |
|
130 |
|
131 return toJS(exec, obj.get()); |
|
132 } |
|
133 case ClassNameAttrNum: { |
|
134 SVGSymbolElement* imp = static_cast<SVGSymbolElement*>(impl()); |
|
135 |
|
136 ASSERT(exec && exec->dynamicInterpreter()); |
|
137 |
|
138 RefPtr<SVGAnimatedString> obj = imp->classNameAnimated(); |
|
139 Frame* activeFrame = static_cast<ScriptInterpreter*>(exec->dynamicInterpreter())->frame(); |
|
140 if (activeFrame) { |
|
141 SVGDocumentExtensions* extensions = (activeFrame->document() ? activeFrame->document()->accessSVGExtensions() : 0); |
|
142 if (extensions) { |
|
143 if (extensions->hasGenericContext<SVGAnimatedString>(obj.get())) |
|
144 ASSERT(extensions->genericContext<SVGAnimatedString>(obj.get()) == imp); |
|
145 else |
|
146 extensions->setGenericContext<SVGAnimatedString>(obj.get(), imp); |
|
147 } |
|
148 } |
|
149 |
|
150 return toJS(exec, obj.get()); |
|
151 } |
|
152 case StyleAttrNum: { |
|
153 SVGSymbolElement* imp = static_cast<SVGSymbolElement*>(impl()); |
|
154 |
|
155 return toJS(exec, WTF::getPtr(imp->style())); |
|
156 } |
|
157 case ViewBoxAttrNum: { |
|
158 SVGSymbolElement* imp = static_cast<SVGSymbolElement*>(impl()); |
|
159 |
|
160 ASSERT(exec && exec->dynamicInterpreter()); |
|
161 |
|
162 RefPtr<SVGAnimatedRect> obj = imp->viewBoxAnimated(); |
|
163 Frame* activeFrame = static_cast<ScriptInterpreter*>(exec->dynamicInterpreter())->frame(); |
|
164 if (activeFrame) { |
|
165 SVGDocumentExtensions* extensions = (activeFrame->document() ? activeFrame->document()->accessSVGExtensions() : 0); |
|
166 if (extensions) { |
|
167 if (extensions->hasGenericContext<SVGAnimatedRect>(obj.get())) |
|
168 ASSERT(extensions->genericContext<SVGAnimatedRect>(obj.get()) == imp); |
|
169 else |
|
170 extensions->setGenericContext<SVGAnimatedRect>(obj.get(), imp); |
|
171 } |
|
172 } |
|
173 |
|
174 return toJS(exec, obj.get()); |
|
175 } |
|
176 case PreserveAspectRatioAttrNum: { |
|
177 SVGSymbolElement* imp = static_cast<SVGSymbolElement*>(impl()); |
|
178 |
|
179 ASSERT(exec && exec->dynamicInterpreter()); |
|
180 |
|
181 RefPtr<SVGAnimatedPreserveAspectRatio> obj = imp->preserveAspectRatioAnimated(); |
|
182 Frame* activeFrame = static_cast<ScriptInterpreter*>(exec->dynamicInterpreter())->frame(); |
|
183 if (activeFrame) { |
|
184 SVGDocumentExtensions* extensions = (activeFrame->document() ? activeFrame->document()->accessSVGExtensions() : 0); |
|
185 if (extensions) { |
|
186 if (extensions->hasGenericContext<SVGAnimatedPreserveAspectRatio>(obj.get())) |
|
187 ASSERT(extensions->genericContext<SVGAnimatedPreserveAspectRatio>(obj.get()) == imp); |
|
188 else |
|
189 extensions->setGenericContext<SVGAnimatedPreserveAspectRatio>(obj.get(), imp); |
|
190 } |
|
191 } |
|
192 |
|
193 return toJS(exec, obj.get()); |
|
194 } |
|
195 } |
|
196 return 0; |
|
197 } |
|
198 |
|
199 void JSSVGSymbolElement::put(ExecState* exec, const Identifier& propertyName, JSValue* value, int attr) |
|
200 { |
|
201 lookupPut<JSSVGSymbolElement, JSSVGElement>(exec, propertyName, value, attr, &JSSVGSymbolElementTable, this); |
|
202 } |
|
203 |
|
204 void JSSVGSymbolElement::putValueProperty(ExecState* exec, int token, JSValue* value, int /*attr*/) |
|
205 { |
|
206 switch (token) { |
|
207 case XmllangAttrNum: { |
|
208 SVGSymbolElement* imp = static_cast<SVGSymbolElement*>(impl()); |
|
209 |
|
210 imp->setXmllang(value->toString(exec)); |
|
211 break; |
|
212 } |
|
213 case XmlspaceAttrNum: { |
|
214 SVGSymbolElement* imp = static_cast<SVGSymbolElement*>(impl()); |
|
215 |
|
216 imp->setXmlspace(value->toString(exec)); |
|
217 break; |
|
218 } |
|
219 } |
|
220 } |
|
221 |
|
222 |
|
223 } |
|
224 |
|
225 #endif // ENABLE(SVG) |