|
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 "JSSVGUseElement.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 "JSSVGAnimatedLength.h" |
|
40 #include "JSSVGAnimatedString.h" |
|
41 #include "JSSVGAnimatedTransformList.h" |
|
42 #include "JSSVGElement.h" |
|
43 #include "JSSVGElementInstance.h" |
|
44 #include "JSSVGMatrix.h" |
|
45 #include "JSSVGRect.h" |
|
46 #include "JSSVGStringList.h" |
|
47 #include "PlatformString.h" |
|
48 #include "SVGElement.h" |
|
49 #include "SVGElementInstance.h" |
|
50 #include "SVGStringList.h" |
|
51 #include "SVGUseElement.h" |
|
52 |
|
53 using namespace KJS; |
|
54 |
|
55 namespace WebCore { |
|
56 |
|
57 /* Hash table */ |
|
58 |
|
59 static const HashEntry JSSVGUseElementTableEntries[] = |
|
60 { |
|
61 { 0, 0, 0, 0, 0 }, |
|
62 { 0, 0, 0, 0, 0 }, |
|
63 { "xmlspace", JSSVGUseElement::XmlspaceAttrNum, DontDelete, 0, 0 }, |
|
64 { "requiredFeatures", JSSVGUseElement::RequiredFeaturesAttrNum, DontDelete|ReadOnly, 0, 0 }, |
|
65 { "y", JSSVGUseElement::YAttrNum, DontDelete|ReadOnly, 0, &JSSVGUseElementTableEntries[19] }, |
|
66 { 0, 0, 0, 0, 0 }, |
|
67 { "xmllang", JSSVGUseElement::XmllangAttrNum, DontDelete, 0, 0 }, |
|
68 { "transform", JSSVGUseElement::TransformAttrNum, DontDelete|ReadOnly, 0, 0 }, |
|
69 { "style", JSSVGUseElement::StyleAttrNum, DontDelete|ReadOnly, 0, 0 }, |
|
70 { "nearestViewportElement", JSSVGUseElement::NearestViewportElementAttrNum, DontDelete|ReadOnly, 0, 0 }, |
|
71 { 0, 0, 0, 0, 0 }, |
|
72 { "x", JSSVGUseElement::XAttrNum, DontDelete|ReadOnly, 0, &JSSVGUseElementTableEntries[18] }, |
|
73 { "systemLanguage", JSSVGUseElement::SystemLanguageAttrNum, DontDelete|ReadOnly, 0, &JSSVGUseElementTableEntries[21] }, |
|
74 { "width", JSSVGUseElement::WidthAttrNum, DontDelete|ReadOnly, 0, &JSSVGUseElementTableEntries[22] }, |
|
75 { "instanceRoot", JSSVGUseElement::InstanceRootAttrNum, DontDelete|ReadOnly, 0, 0 }, |
|
76 { 0, 0, 0, 0, 0 }, |
|
77 { "href", JSSVGUseElement::HrefAttrNum, DontDelete|ReadOnly, 0, 0 }, |
|
78 { "requiredExtensions", JSSVGUseElement::RequiredExtensionsAttrNum, DontDelete|ReadOnly, 0, 0 }, |
|
79 { "height", JSSVGUseElement::HeightAttrNum, DontDelete|ReadOnly, 0, &JSSVGUseElementTableEntries[20] }, |
|
80 { "animatedInstanceRoot", JSSVGUseElement::AnimatedInstanceRootAttrNum, DontDelete|ReadOnly, 0, 0 }, |
|
81 { "externalResourcesRequired", JSSVGUseElement::ExternalResourcesRequiredAttrNum, DontDelete|ReadOnly, 0, 0 }, |
|
82 { "className", JSSVGUseElement::ClassNameAttrNum, DontDelete|ReadOnly, 0, 0 }, |
|
83 { "farthestViewportElement", JSSVGUseElement::FarthestViewportElementAttrNum, DontDelete|ReadOnly, 0, 0 } |
|
84 }; |
|
85 |
|
86 static const HashTable JSSVGUseElementTable = |
|
87 { |
|
88 2, 23, JSSVGUseElementTableEntries, 18 |
|
89 }; |
|
90 |
|
91 /* Hash table for prototype */ |
|
92 |
|
93 static const HashEntry JSSVGUseElementPrototypeTableEntries[] = |
|
94 { |
|
95 { "hasExtension", JSSVGUseElement::HasExtensionFuncNum, DontDelete|Function, 1, &JSSVGUseElementPrototypeTableEntries[6] }, |
|
96 { 0, 0, 0, 0, 0 }, |
|
97 { 0, 0, 0, 0, 0 }, |
|
98 { "getBBox", JSSVGUseElement::GetBBoxFuncNum, DontDelete|Function, 0, &JSSVGUseElementPrototypeTableEntries[5] }, |
|
99 { "getTransformToElement", JSSVGUseElement::GetTransformToElementFuncNum, DontDelete|Function, 1, 0 }, |
|
100 { "getCTM", JSSVGUseElement::GetCTMFuncNum, DontDelete|Function, 0, 0 }, |
|
101 { "getScreenCTM", JSSVGUseElement::GetScreenCTMFuncNum, DontDelete|Function, 0, 0 } |
|
102 }; |
|
103 |
|
104 static const HashTable JSSVGUseElementPrototypeTable = |
|
105 { |
|
106 2, 7, JSSVGUseElementPrototypeTableEntries, 5 |
|
107 }; |
|
108 |
|
109 const ClassInfo JSSVGUseElementPrototype::info = { "SVGUseElementPrototype", 0, &JSSVGUseElementPrototypeTable, 0 }; |
|
110 |
|
111 JSObject* JSSVGUseElementPrototype::self(ExecState* exec) |
|
112 { |
|
113 return KJS::cacheGlobalObject<JSSVGUseElementPrototype>(exec, "[[JSSVGUseElement.prototype]]"); |
|
114 } |
|
115 |
|
116 bool JSSVGUseElementPrototype::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) |
|
117 { |
|
118 return getStaticFunctionSlot<JSSVGUseElementPrototypeFunction, JSObject>(exec, &JSSVGUseElementPrototypeTable, this, propertyName, slot); |
|
119 } |
|
120 |
|
121 const ClassInfo JSSVGUseElement::info = { "SVGUseElement", &JSSVGElement::info, &JSSVGUseElementTable, 0 }; |
|
122 |
|
123 JSSVGUseElement::JSSVGUseElement(ExecState* exec, SVGUseElement* impl) |
|
124 : JSSVGElement(exec, impl) |
|
125 { |
|
126 setPrototype(JSSVGUseElementPrototype::self(exec)); |
|
127 } |
|
128 |
|
129 bool JSSVGUseElement::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) |
|
130 { |
|
131 return getStaticValueSlot<JSSVGUseElement, JSSVGElement>(exec, &JSSVGUseElementTable, this, propertyName, slot); |
|
132 } |
|
133 |
|
134 JSValue* JSSVGUseElement::getValueProperty(ExecState* exec, int token) const |
|
135 { |
|
136 switch (token) { |
|
137 case XAttrNum: { |
|
138 SVGUseElement* imp = static_cast<SVGUseElement*>(impl()); |
|
139 |
|
140 ASSERT(exec && exec->dynamicInterpreter()); |
|
141 |
|
142 RefPtr<SVGAnimatedLength> obj = imp->xAnimated(); |
|
143 Frame* activeFrame = static_cast<ScriptInterpreter*>(exec->dynamicInterpreter())->frame(); |
|
144 if (activeFrame) { |
|
145 SVGDocumentExtensions* extensions = (activeFrame->document() ? activeFrame->document()->accessSVGExtensions() : 0); |
|
146 if (extensions) { |
|
147 if (extensions->hasGenericContext<SVGAnimatedLength>(obj.get())) |
|
148 ASSERT(extensions->genericContext<SVGAnimatedLength>(obj.get()) == imp); |
|
149 else |
|
150 extensions->setGenericContext<SVGAnimatedLength>(obj.get(), imp); |
|
151 } |
|
152 } |
|
153 |
|
154 return toJS(exec, obj.get()); |
|
155 } |
|
156 case YAttrNum: { |
|
157 SVGUseElement* imp = static_cast<SVGUseElement*>(impl()); |
|
158 |
|
159 ASSERT(exec && exec->dynamicInterpreter()); |
|
160 |
|
161 RefPtr<SVGAnimatedLength> obj = imp->yAnimated(); |
|
162 Frame* activeFrame = static_cast<ScriptInterpreter*>(exec->dynamicInterpreter())->frame(); |
|
163 if (activeFrame) { |
|
164 SVGDocumentExtensions* extensions = (activeFrame->document() ? activeFrame->document()->accessSVGExtensions() : 0); |
|
165 if (extensions) { |
|
166 if (extensions->hasGenericContext<SVGAnimatedLength>(obj.get())) |
|
167 ASSERT(extensions->genericContext<SVGAnimatedLength>(obj.get()) == imp); |
|
168 else |
|
169 extensions->setGenericContext<SVGAnimatedLength>(obj.get(), imp); |
|
170 } |
|
171 } |
|
172 |
|
173 return toJS(exec, obj.get()); |
|
174 } |
|
175 case WidthAttrNum: { |
|
176 SVGUseElement* imp = static_cast<SVGUseElement*>(impl()); |
|
177 |
|
178 ASSERT(exec && exec->dynamicInterpreter()); |
|
179 |
|
180 RefPtr<SVGAnimatedLength> obj = imp->widthAnimated(); |
|
181 Frame* activeFrame = static_cast<ScriptInterpreter*>(exec->dynamicInterpreter())->frame(); |
|
182 if (activeFrame) { |
|
183 SVGDocumentExtensions* extensions = (activeFrame->document() ? activeFrame->document()->accessSVGExtensions() : 0); |
|
184 if (extensions) { |
|
185 if (extensions->hasGenericContext<SVGAnimatedLength>(obj.get())) |
|
186 ASSERT(extensions->genericContext<SVGAnimatedLength>(obj.get()) == imp); |
|
187 else |
|
188 extensions->setGenericContext<SVGAnimatedLength>(obj.get(), imp); |
|
189 } |
|
190 } |
|
191 |
|
192 return toJS(exec, obj.get()); |
|
193 } |
|
194 case HeightAttrNum: { |
|
195 SVGUseElement* imp = static_cast<SVGUseElement*>(impl()); |
|
196 |
|
197 ASSERT(exec && exec->dynamicInterpreter()); |
|
198 |
|
199 RefPtr<SVGAnimatedLength> obj = imp->heightAnimated(); |
|
200 Frame* activeFrame = static_cast<ScriptInterpreter*>(exec->dynamicInterpreter())->frame(); |
|
201 if (activeFrame) { |
|
202 SVGDocumentExtensions* extensions = (activeFrame->document() ? activeFrame->document()->accessSVGExtensions() : 0); |
|
203 if (extensions) { |
|
204 if (extensions->hasGenericContext<SVGAnimatedLength>(obj.get())) |
|
205 ASSERT(extensions->genericContext<SVGAnimatedLength>(obj.get()) == imp); |
|
206 else |
|
207 extensions->setGenericContext<SVGAnimatedLength>(obj.get(), imp); |
|
208 } |
|
209 } |
|
210 |
|
211 return toJS(exec, obj.get()); |
|
212 } |
|
213 case InstanceRootAttrNum: { |
|
214 SVGUseElement* imp = static_cast<SVGUseElement*>(impl()); |
|
215 |
|
216 return toJS(exec, WTF::getPtr(imp->instanceRoot())); |
|
217 } |
|
218 case AnimatedInstanceRootAttrNum: { |
|
219 SVGUseElement* imp = static_cast<SVGUseElement*>(impl()); |
|
220 |
|
221 return toJS(exec, WTF::getPtr(imp->animatedInstanceRoot())); |
|
222 } |
|
223 case HrefAttrNum: { |
|
224 SVGUseElement* imp = static_cast<SVGUseElement*>(impl()); |
|
225 |
|
226 ASSERT(exec && exec->dynamicInterpreter()); |
|
227 |
|
228 RefPtr<SVGAnimatedString> obj = imp->hrefAnimated(); |
|
229 Frame* activeFrame = static_cast<ScriptInterpreter*>(exec->dynamicInterpreter())->frame(); |
|
230 if (activeFrame) { |
|
231 SVGDocumentExtensions* extensions = (activeFrame->document() ? activeFrame->document()->accessSVGExtensions() : 0); |
|
232 if (extensions) { |
|
233 if (extensions->hasGenericContext<SVGAnimatedString>(obj.get())) |
|
234 ASSERT(extensions->genericContext<SVGAnimatedString>(obj.get()) == imp); |
|
235 else |
|
236 extensions->setGenericContext<SVGAnimatedString>(obj.get(), imp); |
|
237 } |
|
238 } |
|
239 |
|
240 return toJS(exec, obj.get()); |
|
241 } |
|
242 case RequiredFeaturesAttrNum: { |
|
243 SVGUseElement* imp = static_cast<SVGUseElement*>(impl()); |
|
244 |
|
245 return toJS(exec, WTF::getPtr(imp->requiredFeatures())); |
|
246 } |
|
247 case RequiredExtensionsAttrNum: { |
|
248 SVGUseElement* imp = static_cast<SVGUseElement*>(impl()); |
|
249 |
|
250 return toJS(exec, WTF::getPtr(imp->requiredExtensions())); |
|
251 } |
|
252 case SystemLanguageAttrNum: { |
|
253 SVGUseElement* imp = static_cast<SVGUseElement*>(impl()); |
|
254 |
|
255 return toJS(exec, WTF::getPtr(imp->systemLanguage())); |
|
256 } |
|
257 case XmllangAttrNum: { |
|
258 SVGUseElement* imp = static_cast<SVGUseElement*>(impl()); |
|
259 |
|
260 return jsString(imp->xmllang()); |
|
261 } |
|
262 case XmlspaceAttrNum: { |
|
263 SVGUseElement* imp = static_cast<SVGUseElement*>(impl()); |
|
264 |
|
265 return jsString(imp->xmlspace()); |
|
266 } |
|
267 case ExternalResourcesRequiredAttrNum: { |
|
268 SVGUseElement* imp = static_cast<SVGUseElement*>(impl()); |
|
269 |
|
270 ASSERT(exec && exec->dynamicInterpreter()); |
|
271 |
|
272 RefPtr<SVGAnimatedBoolean> obj = imp->externalResourcesRequiredAnimated(); |
|
273 Frame* activeFrame = static_cast<ScriptInterpreter*>(exec->dynamicInterpreter())->frame(); |
|
274 if (activeFrame) { |
|
275 SVGDocumentExtensions* extensions = (activeFrame->document() ? activeFrame->document()->accessSVGExtensions() : 0); |
|
276 if (extensions) { |
|
277 if (extensions->hasGenericContext<SVGAnimatedBoolean>(obj.get())) |
|
278 ASSERT(extensions->genericContext<SVGAnimatedBoolean>(obj.get()) == imp); |
|
279 else |
|
280 extensions->setGenericContext<SVGAnimatedBoolean>(obj.get(), imp); |
|
281 } |
|
282 } |
|
283 |
|
284 return toJS(exec, obj.get()); |
|
285 } |
|
286 case ClassNameAttrNum: { |
|
287 SVGUseElement* imp = static_cast<SVGUseElement*>(impl()); |
|
288 |
|
289 ASSERT(exec && exec->dynamicInterpreter()); |
|
290 |
|
291 RefPtr<SVGAnimatedString> obj = imp->classNameAnimated(); |
|
292 Frame* activeFrame = static_cast<ScriptInterpreter*>(exec->dynamicInterpreter())->frame(); |
|
293 if (activeFrame) { |
|
294 SVGDocumentExtensions* extensions = (activeFrame->document() ? activeFrame->document()->accessSVGExtensions() : 0); |
|
295 if (extensions) { |
|
296 if (extensions->hasGenericContext<SVGAnimatedString>(obj.get())) |
|
297 ASSERT(extensions->genericContext<SVGAnimatedString>(obj.get()) == imp); |
|
298 else |
|
299 extensions->setGenericContext<SVGAnimatedString>(obj.get(), imp); |
|
300 } |
|
301 } |
|
302 |
|
303 return toJS(exec, obj.get()); |
|
304 } |
|
305 case StyleAttrNum: { |
|
306 SVGUseElement* imp = static_cast<SVGUseElement*>(impl()); |
|
307 |
|
308 return toJS(exec, WTF::getPtr(imp->style())); |
|
309 } |
|
310 case TransformAttrNum: { |
|
311 SVGUseElement* imp = static_cast<SVGUseElement*>(impl()); |
|
312 |
|
313 ASSERT(exec && exec->dynamicInterpreter()); |
|
314 |
|
315 RefPtr<SVGAnimatedTransformList> obj = imp->transformAnimated(); |
|
316 Frame* activeFrame = static_cast<ScriptInterpreter*>(exec->dynamicInterpreter())->frame(); |
|
317 if (activeFrame) { |
|
318 SVGDocumentExtensions* extensions = (activeFrame->document() ? activeFrame->document()->accessSVGExtensions() : 0); |
|
319 if (extensions) { |
|
320 if (extensions->hasGenericContext<SVGAnimatedTransformList>(obj.get())) |
|
321 ASSERT(extensions->genericContext<SVGAnimatedTransformList>(obj.get()) == imp); |
|
322 else |
|
323 extensions->setGenericContext<SVGAnimatedTransformList>(obj.get(), imp); |
|
324 } |
|
325 } |
|
326 |
|
327 return toJS(exec, obj.get()); |
|
328 } |
|
329 case NearestViewportElementAttrNum: { |
|
330 SVGUseElement* imp = static_cast<SVGUseElement*>(impl()); |
|
331 |
|
332 return toJS(exec, WTF::getPtr(imp->nearestViewportElement())); |
|
333 } |
|
334 case FarthestViewportElementAttrNum: { |
|
335 SVGUseElement* imp = static_cast<SVGUseElement*>(impl()); |
|
336 |
|
337 return toJS(exec, WTF::getPtr(imp->farthestViewportElement())); |
|
338 } |
|
339 } |
|
340 return 0; |
|
341 } |
|
342 |
|
343 void JSSVGUseElement::put(ExecState* exec, const Identifier& propertyName, JSValue* value, int attr) |
|
344 { |
|
345 lookupPut<JSSVGUseElement, JSSVGElement>(exec, propertyName, value, attr, &JSSVGUseElementTable, this); |
|
346 } |
|
347 |
|
348 void JSSVGUseElement::putValueProperty(ExecState* exec, int token, JSValue* value, int /*attr*/) |
|
349 { |
|
350 switch (token) { |
|
351 case XmllangAttrNum: { |
|
352 SVGUseElement* imp = static_cast<SVGUseElement*>(impl()); |
|
353 |
|
354 imp->setXmllang(value->toString(exec)); |
|
355 break; |
|
356 } |
|
357 case XmlspaceAttrNum: { |
|
358 SVGUseElement* imp = static_cast<SVGUseElement*>(impl()); |
|
359 |
|
360 imp->setXmlspace(value->toString(exec)); |
|
361 break; |
|
362 } |
|
363 } |
|
364 } |
|
365 |
|
366 JSValue* JSSVGUseElementPrototypeFunction::callAsFunction(ExecState* exec, JSObject* thisObj, const List& args) |
|
367 { |
|
368 if (!thisObj->inherits(&JSSVGUseElement::info)) |
|
369 return throwError(exec, TypeError); |
|
370 |
|
371 SVGUseElement* imp = static_cast<SVGUseElement*>(static_cast<JSSVGUseElement*>(thisObj)->impl()); |
|
372 |
|
373 switch (id) { |
|
374 case JSSVGUseElement::HasExtensionFuncNum: { |
|
375 String extension = args[0]->toString(exec); |
|
376 |
|
377 |
|
378 KJS::JSValue* result = jsBoolean(imp->hasExtension(extension)); |
|
379 return result; |
|
380 } |
|
381 case JSSVGUseElement::GetBBoxFuncNum: { |
|
382 |
|
383 |
|
384 KJS::JSValue* result = toJS(exec, new JSSVGPODTypeWrapper<FloatRect>(imp->getBBox())); |
|
385 return result; |
|
386 } |
|
387 case JSSVGUseElement::GetCTMFuncNum: { |
|
388 |
|
389 |
|
390 KJS::JSValue* result = toJS(exec, new JSSVGPODTypeWrapper<AffineTransform>(imp->getCTM())); |
|
391 return result; |
|
392 } |
|
393 case JSSVGUseElement::GetScreenCTMFuncNum: { |
|
394 |
|
395 |
|
396 KJS::JSValue* result = toJS(exec, new JSSVGPODTypeWrapper<AffineTransform>(imp->getScreenCTM())); |
|
397 return result; |
|
398 } |
|
399 case JSSVGUseElement::GetTransformToElementFuncNum: { |
|
400 ExceptionCode ec = 0; |
|
401 SVGElement* element = toSVGElement(args[0]); |
|
402 |
|
403 |
|
404 KJS::JSValue* result = toJS(exec, new JSSVGPODTypeWrapper<AffineTransform>(imp->getTransformToElement(element, ec))); |
|
405 setDOMException(exec, ec); |
|
406 return result; |
|
407 } |
|
408 } |
|
409 return 0; |
|
410 } |
|
411 |
|
412 } |
|
413 |
|
414 #endif // ENABLE(SVG) |