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