|
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 "JSSVGSVGElement.h" |
|
32 |
|
33 #include <wtf/GetPtr.h> |
|
34 |
|
35 #include "CSSMutableStyleDeclaration.h" |
|
36 #include "CSSStyleDeclaration.h" |
|
37 #include "ExceptionCode.h" |
|
38 #include "FloatRect.h" |
|
39 #include "JSCSSStyleDeclaration.h" |
|
40 #include "JSNodeList.h" |
|
41 #include "JSSVGAngle.h" |
|
42 #include "JSSVGAnimatedBoolean.h" |
|
43 #include "JSSVGAnimatedLength.h" |
|
44 #include "JSSVGAnimatedPreserveAspectRatio.h" |
|
45 #include "JSSVGAnimatedRect.h" |
|
46 #include "JSSVGAnimatedString.h" |
|
47 #include "JSSVGElement.h" |
|
48 #include "JSSVGLength.h" |
|
49 #include "JSSVGMatrix.h" |
|
50 #include "JSSVGNumber.h" |
|
51 #include "JSSVGPoint.h" |
|
52 #include "JSSVGRect.h" |
|
53 #include "JSSVGStringList.h" |
|
54 #include "JSSVGTransform.h" |
|
55 #include "NameNodeList.h" |
|
56 #include "NodeList.h" |
|
57 #include "PlatformString.h" |
|
58 #include "SVGAngle.h" |
|
59 #include "SVGElement.h" |
|
60 #include "SVGLength.h" |
|
61 #include "SVGSVGElement.h" |
|
62 #include "SVGStringList.h" |
|
63 #include "SVGTransform.h" |
|
64 |
|
65 using namespace KJS; |
|
66 |
|
67 namespace WebCore { |
|
68 |
|
69 /* Hash table */ |
|
70 |
|
71 static const HashEntry JSSVGSVGElementTableEntries[] = |
|
72 { |
|
73 { 0, 0, 0, 0, 0 }, |
|
74 { 0, 0, 0, 0, 0 }, |
|
75 { "x", JSSVGSVGElement::XAttrNum, DontDelete|ReadOnly, 0, &JSSVGSVGElementTableEntries[28] }, |
|
76 { 0, 0, 0, 0, 0 }, |
|
77 { 0, 0, 0, 0, 0 }, |
|
78 { "screenPixelToMillimeterY", JSSVGSVGElement::ScreenPixelToMillimeterYAttrNum, DontDelete|ReadOnly, 0, &JSSVGSVGElementTableEntries[36] }, |
|
79 { "viewBox", JSSVGSVGElement::ViewBoxAttrNum, DontDelete|ReadOnly, 0, 0 }, |
|
80 { 0, 0, 0, 0, 0 }, |
|
81 { 0, 0, 0, 0, 0 }, |
|
82 { 0, 0, 0, 0, 0 }, |
|
83 { 0, 0, 0, 0, 0 }, |
|
84 { "externalResourcesRequired", JSSVGSVGElement::ExternalResourcesRequiredAttrNum, DontDelete|ReadOnly, 0, 0 }, |
|
85 { "requiredFeatures", JSSVGSVGElement::RequiredFeaturesAttrNum, DontDelete|ReadOnly, 0, 0 }, |
|
86 { "farthestViewportElement", JSSVGSVGElement::FarthestViewportElementAttrNum, DontDelete|ReadOnly, 0, 0 }, |
|
87 { "pixelUnitToMillimeterX", JSSVGSVGElement::PixelUnitToMillimeterXAttrNum, DontDelete|ReadOnly, 0, 0 }, |
|
88 { "pixelUnitToMillimeterY", JSSVGSVGElement::PixelUnitToMillimeterYAttrNum, DontDelete|ReadOnly, 0, &JSSVGSVGElementTableEntries[31] }, |
|
89 { 0, 0, 0, 0, 0 }, |
|
90 { "style", JSSVGSVGElement::StyleAttrNum, DontDelete|ReadOnly, 0, 0 }, |
|
91 { "nearestViewportElement", JSSVGSVGElement::NearestViewportElementAttrNum, DontDelete|ReadOnly, 0, 0 }, |
|
92 { "zoomAndPan", JSSVGSVGElement::ZoomAndPanAttrNum, DontDelete, 0, 0 }, |
|
93 { "screenPixelToMillimeterX", JSSVGSVGElement::ScreenPixelToMillimeterXAttrNum, DontDelete|ReadOnly, 0, 0 }, |
|
94 { "contentStyleType", JSSVGSVGElement::ContentStyleTypeAttrNum, DontDelete, 0, &JSSVGSVGElementTableEntries[33] }, |
|
95 { "y", JSSVGSVGElement::YAttrNum, DontDelete|ReadOnly, 0, &JSSVGSVGElementTableEntries[27] }, |
|
96 { 0, 0, 0, 0, 0 }, |
|
97 { "xmllang", JSSVGSVGElement::XmllangAttrNum, DontDelete, 0, 0 }, |
|
98 { "viewport", JSSVGSVGElement::ViewportAttrNum, DontDelete|ReadOnly, 0, 0 }, |
|
99 { "currentTranslate", JSSVGSVGElement::CurrentTranslateAttrNum, DontDelete|ReadOnly, 0, &JSSVGSVGElementTableEntries[32] }, |
|
100 { "width", JSSVGSVGElement::WidthAttrNum, DontDelete|ReadOnly, 0, &JSSVGSVGElementTableEntries[30] }, |
|
101 { "height", JSSVGSVGElement::HeightAttrNum, DontDelete|ReadOnly, 0, &JSSVGSVGElementTableEntries[29] }, |
|
102 { "contentScriptType", JSSVGSVGElement::ContentScriptTypeAttrNum, DontDelete, 0, &JSSVGSVGElementTableEntries[34] }, |
|
103 { "useCurrentView", JSSVGSVGElement::UseCurrentViewAttrNum, DontDelete, 0, 0 }, |
|
104 { "currentScale", JSSVGSVGElement::CurrentScaleAttrNum, DontDelete, 0, 0 }, |
|
105 { "requiredExtensions", JSSVGSVGElement::RequiredExtensionsAttrNum, DontDelete|ReadOnly, 0, 0 }, |
|
106 { "systemLanguage", JSSVGSVGElement::SystemLanguageAttrNum, DontDelete|ReadOnly, 0, &JSSVGSVGElementTableEntries[35] }, |
|
107 { "xmlspace", JSSVGSVGElement::XmlspaceAttrNum, DontDelete, 0, 0 }, |
|
108 { "className", JSSVGSVGElement::ClassNameAttrNum, DontDelete|ReadOnly, 0, 0 }, |
|
109 { "preserveAspectRatio", JSSVGSVGElement::PreserveAspectRatioAttrNum, DontDelete|ReadOnly, 0, 0 } |
|
110 }; |
|
111 |
|
112 static const HashTable JSSVGSVGElementTable = |
|
113 { |
|
114 2, 37, JSSVGSVGElementTableEntries, 27 |
|
115 }; |
|
116 |
|
117 /* Hash table for prototype */ |
|
118 |
|
119 static const HashEntry JSSVGSVGElementPrototypeTableEntries[] = |
|
120 { |
|
121 { "createSVGNumber", JSSVGSVGElement::CreateSVGNumberFuncNum, DontDelete|Function, 0, &JSSVGSVGElementPrototypeTableEntries[34] }, |
|
122 { "SVG_ZOOMANDPAN_UNKNOWN", SVGSVGElement::SVG_ZOOMANDPAN_UNKNOWN, DontDelete|ReadOnly, 0, 0 }, |
|
123 { "setCurrentTime", JSSVGSVGElement::SetCurrentTimeFuncNum, DontDelete|Function, 1, &JSSVGSVGElementPrototypeTableEntries[32] }, |
|
124 { 0, 0, 0, 0, 0 }, |
|
125 { "checkEnclosure", JSSVGSVGElement::CheckEnclosureFuncNum, DontDelete|Function, 2, &JSSVGSVGElementPrototypeTableEntries[33] }, |
|
126 { "unpauseAnimations", JSSVGSVGElement::UnpauseAnimationsFuncNum, DontDelete|Function, 0, 0 }, |
|
127 { 0, 0, 0, 0, 0 }, |
|
128 { 0, 0, 0, 0, 0 }, |
|
129 { "createSVGPoint", JSSVGSVGElement::CreateSVGPointFuncNum, DontDelete|Function, 0, &JSSVGSVGElementPrototypeTableEntries[37] }, |
|
130 { "animationsPaused", JSSVGSVGElement::AnimationsPausedFuncNum, DontDelete|Function, 0, &JSSVGSVGElementPrototypeTableEntries[31] }, |
|
131 { 0, 0, 0, 0, 0 }, |
|
132 { "createSVGLength", JSSVGSVGElement::CreateSVGLengthFuncNum, DontDelete|Function, 0, 0 }, |
|
133 { "createSVGAngle", JSSVGSVGElement::CreateSVGAngleFuncNum, DontDelete|Function, 0, 0 }, |
|
134 { 0, 0, 0, 0, 0 }, |
|
135 { "SVG_ZOOMANDPAN_DISABLE", SVGSVGElement::SVG_ZOOMANDPAN_DISABLE, DontDelete|ReadOnly, 0, &JSSVGSVGElementPrototypeTableEntries[30] }, |
|
136 { "getScreenCTM", JSSVGSVGElement::GetScreenCTMFuncNum, DontDelete|Function, 0, 0 }, |
|
137 { 0, 0, 0, 0, 0 }, |
|
138 { "pauseAnimations", JSSVGSVGElement::PauseAnimationsFuncNum, DontDelete|Function, 0, &JSSVGSVGElementPrototypeTableEntries[35] }, |
|
139 { "deselectAll", JSSVGSVGElement::DeselectAllFuncNum, DontDelete|Function, 0, 0 }, |
|
140 { "unsuspendRedraw", JSSVGSVGElement::UnsuspendRedrawFuncNum, DontDelete|Function, 1, 0 }, |
|
141 { "SVG_ZOOMANDPAN_MAGNIFY", SVGSVGElement::SVG_ZOOMANDPAN_MAGNIFY, DontDelete|ReadOnly, 0, 0 }, |
|
142 { 0, 0, 0, 0, 0 }, |
|
143 { "getEnclosureList", JSSVGSVGElement::GetEnclosureListFuncNum, DontDelete|Function, 2, 0 }, |
|
144 { "getBBox", JSSVGSVGElement::GetBBoxFuncNum, DontDelete|Function, 0, 0 }, |
|
145 { "unsuspendRedrawAll", JSSVGSVGElement::UnsuspendRedrawAllFuncNum, DontDelete|Function, 0, 0 }, |
|
146 { "suspendRedraw", JSSVGSVGElement::SuspendRedrawFuncNum, DontDelete|Function, 1, &JSSVGSVGElementPrototypeTableEntries[36] }, |
|
147 { 0, 0, 0, 0, 0 }, |
|
148 { "getIntersectionList", JSSVGSVGElement::GetIntersectionListFuncNum, DontDelete|Function, 2, 0 }, |
|
149 { "forceRedraw", JSSVGSVGElement::ForceRedrawFuncNum, DontDelete|Function, 0, 0 }, |
|
150 { 0, 0, 0, 0, 0 }, |
|
151 { "getCurrentTime", JSSVGSVGElement::GetCurrentTimeFuncNum, DontDelete|Function, 0, 0 }, |
|
152 { "checkIntersection", JSSVGSVGElement::CheckIntersectionFuncNum, DontDelete|Function, 2, 0 }, |
|
153 { "createSVGMatrix", JSSVGSVGElement::CreateSVGMatrixFuncNum, DontDelete|Function, 0, 0 }, |
|
154 { "createSVGRect", JSSVGSVGElement::CreateSVGRectFuncNum, DontDelete|Function, 0, &JSSVGSVGElementPrototypeTableEntries[38] }, |
|
155 { "createSVGTransform", JSSVGSVGElement::CreateSVGTransformFuncNum, DontDelete|Function, 0, 0 }, |
|
156 { "createSVGTransformFromMatrix", JSSVGSVGElement::CreateSVGTransformFromMatrixFuncNum, DontDelete|Function, 1, 0 }, |
|
157 { "hasExtension", JSSVGSVGElement::HasExtensionFuncNum, DontDelete|Function, 1, 0 }, |
|
158 { "getCTM", JSSVGSVGElement::GetCTMFuncNum, DontDelete|Function, 0, 0 }, |
|
159 { "getTransformToElement", JSSVGSVGElement::GetTransformToElementFuncNum, DontDelete|Function, 1, 0 } |
|
160 }; |
|
161 |
|
162 static const HashTable JSSVGSVGElementPrototypeTable = |
|
163 { |
|
164 2, 39, JSSVGSVGElementPrototypeTableEntries, 30 |
|
165 }; |
|
166 |
|
167 const ClassInfo JSSVGSVGElementPrototype::info = { "SVGSVGElementPrototype", 0, &JSSVGSVGElementPrototypeTable, 0 }; |
|
168 |
|
169 JSObject* JSSVGSVGElementPrototype::self(ExecState* exec) |
|
170 { |
|
171 return KJS::cacheGlobalObject<JSSVGSVGElementPrototype>(exec, "[[JSSVGSVGElement.prototype]]"); |
|
172 } |
|
173 |
|
174 bool JSSVGSVGElementPrototype::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) |
|
175 { |
|
176 return getStaticPropertySlot<JSSVGSVGElementPrototypeFunction, JSSVGSVGElementPrototype, JSObject>(exec, &JSSVGSVGElementPrototypeTable, this, propertyName, slot); |
|
177 } |
|
178 |
|
179 JSValue* JSSVGSVGElementPrototype::getValueProperty(ExecState*, int token) const |
|
180 { |
|
181 // The token is the numeric value of its associated constant |
|
182 return jsNumber(token); |
|
183 } |
|
184 |
|
185 const ClassInfo JSSVGSVGElement::info = { "SVGSVGElement", &JSSVGElement::info, &JSSVGSVGElementTable, 0 }; |
|
186 |
|
187 JSSVGSVGElement::JSSVGSVGElement(ExecState* exec, SVGSVGElement* impl) |
|
188 : JSSVGElement(exec, impl) |
|
189 { |
|
190 setPrototype(JSSVGSVGElementPrototype::self(exec)); |
|
191 } |
|
192 |
|
193 bool JSSVGSVGElement::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) |
|
194 { |
|
195 return getStaticValueSlot<JSSVGSVGElement, JSSVGElement>(exec, &JSSVGSVGElementTable, this, propertyName, slot); |
|
196 } |
|
197 |
|
198 JSValue* JSSVGSVGElement::getValueProperty(ExecState* exec, int token) const |
|
199 { |
|
200 switch (token) { |
|
201 case XAttrNum: { |
|
202 SVGSVGElement* imp = static_cast<SVGSVGElement*>(impl()); |
|
203 |
|
204 ASSERT(exec && exec->dynamicInterpreter()); |
|
205 |
|
206 RefPtr<SVGAnimatedLength> obj = imp->xAnimated(); |
|
207 Frame* activeFrame = static_cast<ScriptInterpreter*>(exec->dynamicInterpreter())->frame(); |
|
208 if (activeFrame) { |
|
209 SVGDocumentExtensions* extensions = (activeFrame->document() ? activeFrame->document()->accessSVGExtensions() : 0); |
|
210 if (extensions) { |
|
211 if (extensions->hasGenericContext<SVGAnimatedLength>(obj.get())) |
|
212 ASSERT(extensions->genericContext<SVGAnimatedLength>(obj.get()) == imp); |
|
213 else |
|
214 extensions->setGenericContext<SVGAnimatedLength>(obj.get(), imp); |
|
215 } |
|
216 } |
|
217 |
|
218 return toJS(exec, obj.get()); |
|
219 } |
|
220 case YAttrNum: { |
|
221 SVGSVGElement* imp = static_cast<SVGSVGElement*>(impl()); |
|
222 |
|
223 ASSERT(exec && exec->dynamicInterpreter()); |
|
224 |
|
225 RefPtr<SVGAnimatedLength> obj = imp->yAnimated(); |
|
226 Frame* activeFrame = static_cast<ScriptInterpreter*>(exec->dynamicInterpreter())->frame(); |
|
227 if (activeFrame) { |
|
228 SVGDocumentExtensions* extensions = (activeFrame->document() ? activeFrame->document()->accessSVGExtensions() : 0); |
|
229 if (extensions) { |
|
230 if (extensions->hasGenericContext<SVGAnimatedLength>(obj.get())) |
|
231 ASSERT(extensions->genericContext<SVGAnimatedLength>(obj.get()) == imp); |
|
232 else |
|
233 extensions->setGenericContext<SVGAnimatedLength>(obj.get(), imp); |
|
234 } |
|
235 } |
|
236 |
|
237 return toJS(exec, obj.get()); |
|
238 } |
|
239 case WidthAttrNum: { |
|
240 SVGSVGElement* imp = static_cast<SVGSVGElement*>(impl()); |
|
241 |
|
242 ASSERT(exec && exec->dynamicInterpreter()); |
|
243 |
|
244 RefPtr<SVGAnimatedLength> obj = imp->widthAnimated(); |
|
245 Frame* activeFrame = static_cast<ScriptInterpreter*>(exec->dynamicInterpreter())->frame(); |
|
246 if (activeFrame) { |
|
247 SVGDocumentExtensions* extensions = (activeFrame->document() ? activeFrame->document()->accessSVGExtensions() : 0); |
|
248 if (extensions) { |
|
249 if (extensions->hasGenericContext<SVGAnimatedLength>(obj.get())) |
|
250 ASSERT(extensions->genericContext<SVGAnimatedLength>(obj.get()) == imp); |
|
251 else |
|
252 extensions->setGenericContext<SVGAnimatedLength>(obj.get(), imp); |
|
253 } |
|
254 } |
|
255 |
|
256 return toJS(exec, obj.get()); |
|
257 } |
|
258 case HeightAttrNum: { |
|
259 SVGSVGElement* imp = static_cast<SVGSVGElement*>(impl()); |
|
260 |
|
261 ASSERT(exec && exec->dynamicInterpreter()); |
|
262 |
|
263 RefPtr<SVGAnimatedLength> obj = imp->heightAnimated(); |
|
264 Frame* activeFrame = static_cast<ScriptInterpreter*>(exec->dynamicInterpreter())->frame(); |
|
265 if (activeFrame) { |
|
266 SVGDocumentExtensions* extensions = (activeFrame->document() ? activeFrame->document()->accessSVGExtensions() : 0); |
|
267 if (extensions) { |
|
268 if (extensions->hasGenericContext<SVGAnimatedLength>(obj.get())) |
|
269 ASSERT(extensions->genericContext<SVGAnimatedLength>(obj.get()) == imp); |
|
270 else |
|
271 extensions->setGenericContext<SVGAnimatedLength>(obj.get(), imp); |
|
272 } |
|
273 } |
|
274 |
|
275 return toJS(exec, obj.get()); |
|
276 } |
|
277 case ContentScriptTypeAttrNum: { |
|
278 SVGSVGElement* imp = static_cast<SVGSVGElement*>(impl()); |
|
279 |
|
280 return jsString(imp->contentScriptType()); |
|
281 } |
|
282 case ContentStyleTypeAttrNum: { |
|
283 SVGSVGElement* imp = static_cast<SVGSVGElement*>(impl()); |
|
284 |
|
285 return jsString(imp->contentStyleType()); |
|
286 } |
|
287 case ViewportAttrNum: { |
|
288 SVGSVGElement* imp = static_cast<SVGSVGElement*>(impl()); |
|
289 |
|
290 return toJS(exec, new JSSVGPODTypeWrapper<FloatRect>(imp->viewport())); |
|
291 } |
|
292 case PixelUnitToMillimeterXAttrNum: { |
|
293 SVGSVGElement* imp = static_cast<SVGSVGElement*>(impl()); |
|
294 |
|
295 return jsNumber(imp->pixelUnitToMillimeterX()); |
|
296 } |
|
297 case PixelUnitToMillimeterYAttrNum: { |
|
298 SVGSVGElement* imp = static_cast<SVGSVGElement*>(impl()); |
|
299 |
|
300 return jsNumber(imp->pixelUnitToMillimeterY()); |
|
301 } |
|
302 case ScreenPixelToMillimeterXAttrNum: { |
|
303 SVGSVGElement* imp = static_cast<SVGSVGElement*>(impl()); |
|
304 |
|
305 return jsNumber(imp->screenPixelToMillimeterX()); |
|
306 } |
|
307 case ScreenPixelToMillimeterYAttrNum: { |
|
308 SVGSVGElement* imp = static_cast<SVGSVGElement*>(impl()); |
|
309 |
|
310 return jsNumber(imp->screenPixelToMillimeterY()); |
|
311 } |
|
312 case UseCurrentViewAttrNum: { |
|
313 SVGSVGElement* imp = static_cast<SVGSVGElement*>(impl()); |
|
314 |
|
315 return jsBoolean(imp->useCurrentView()); |
|
316 } |
|
317 case CurrentScaleAttrNum: { |
|
318 SVGSVGElement* imp = static_cast<SVGSVGElement*>(impl()); |
|
319 |
|
320 return jsNumber(imp->currentScale()); |
|
321 } |
|
322 case CurrentTranslateAttrNum: { |
|
323 SVGSVGElement* imp = static_cast<SVGSVGElement*>(impl()); |
|
324 |
|
325 return toJS(exec, new JSSVGPODTypeWrapper<FloatPoint>(imp->currentTranslate())); |
|
326 } |
|
327 case RequiredFeaturesAttrNum: { |
|
328 SVGSVGElement* imp = static_cast<SVGSVGElement*>(impl()); |
|
329 |
|
330 return toJS(exec, WTF::getPtr(imp->requiredFeatures())); |
|
331 } |
|
332 case RequiredExtensionsAttrNum: { |
|
333 SVGSVGElement* imp = static_cast<SVGSVGElement*>(impl()); |
|
334 |
|
335 return toJS(exec, WTF::getPtr(imp->requiredExtensions())); |
|
336 } |
|
337 case SystemLanguageAttrNum: { |
|
338 SVGSVGElement* imp = static_cast<SVGSVGElement*>(impl()); |
|
339 |
|
340 return toJS(exec, WTF::getPtr(imp->systemLanguage())); |
|
341 } |
|
342 case XmllangAttrNum: { |
|
343 SVGSVGElement* imp = static_cast<SVGSVGElement*>(impl()); |
|
344 |
|
345 return jsString(imp->xmllang()); |
|
346 } |
|
347 case XmlspaceAttrNum: { |
|
348 SVGSVGElement* imp = static_cast<SVGSVGElement*>(impl()); |
|
349 |
|
350 return jsString(imp->xmlspace()); |
|
351 } |
|
352 case ExternalResourcesRequiredAttrNum: { |
|
353 SVGSVGElement* imp = static_cast<SVGSVGElement*>(impl()); |
|
354 |
|
355 ASSERT(exec && exec->dynamicInterpreter()); |
|
356 |
|
357 RefPtr<SVGAnimatedBoolean> obj = imp->externalResourcesRequiredAnimated(); |
|
358 Frame* activeFrame = static_cast<ScriptInterpreter*>(exec->dynamicInterpreter())->frame(); |
|
359 if (activeFrame) { |
|
360 SVGDocumentExtensions* extensions = (activeFrame->document() ? activeFrame->document()->accessSVGExtensions() : 0); |
|
361 if (extensions) { |
|
362 if (extensions->hasGenericContext<SVGAnimatedBoolean>(obj.get())) |
|
363 ASSERT(extensions->genericContext<SVGAnimatedBoolean>(obj.get()) == imp); |
|
364 else |
|
365 extensions->setGenericContext<SVGAnimatedBoolean>(obj.get(), imp); |
|
366 } |
|
367 } |
|
368 |
|
369 return toJS(exec, obj.get()); |
|
370 } |
|
371 case ClassNameAttrNum: { |
|
372 SVGSVGElement* imp = static_cast<SVGSVGElement*>(impl()); |
|
373 |
|
374 ASSERT(exec && exec->dynamicInterpreter()); |
|
375 |
|
376 RefPtr<SVGAnimatedString> obj = imp->classNameAnimated(); |
|
377 Frame* activeFrame = static_cast<ScriptInterpreter*>(exec->dynamicInterpreter())->frame(); |
|
378 if (activeFrame) { |
|
379 SVGDocumentExtensions* extensions = (activeFrame->document() ? activeFrame->document()->accessSVGExtensions() : 0); |
|
380 if (extensions) { |
|
381 if (extensions->hasGenericContext<SVGAnimatedString>(obj.get())) |
|
382 ASSERT(extensions->genericContext<SVGAnimatedString>(obj.get()) == imp); |
|
383 else |
|
384 extensions->setGenericContext<SVGAnimatedString>(obj.get(), imp); |
|
385 } |
|
386 } |
|
387 |
|
388 return toJS(exec, obj.get()); |
|
389 } |
|
390 case StyleAttrNum: { |
|
391 SVGSVGElement* imp = static_cast<SVGSVGElement*>(impl()); |
|
392 |
|
393 return toJS(exec, WTF::getPtr(imp->style())); |
|
394 } |
|
395 case NearestViewportElementAttrNum: { |
|
396 SVGSVGElement* imp = static_cast<SVGSVGElement*>(impl()); |
|
397 |
|
398 return toJS(exec, WTF::getPtr(imp->nearestViewportElement())); |
|
399 } |
|
400 case FarthestViewportElementAttrNum: { |
|
401 SVGSVGElement* imp = static_cast<SVGSVGElement*>(impl()); |
|
402 |
|
403 return toJS(exec, WTF::getPtr(imp->farthestViewportElement())); |
|
404 } |
|
405 case ViewBoxAttrNum: { |
|
406 SVGSVGElement* imp = static_cast<SVGSVGElement*>(impl()); |
|
407 |
|
408 ASSERT(exec && exec->dynamicInterpreter()); |
|
409 |
|
410 RefPtr<SVGAnimatedRect> obj = imp->viewBoxAnimated(); |
|
411 Frame* activeFrame = static_cast<ScriptInterpreter*>(exec->dynamicInterpreter())->frame(); |
|
412 if (activeFrame) { |
|
413 SVGDocumentExtensions* extensions = (activeFrame->document() ? activeFrame->document()->accessSVGExtensions() : 0); |
|
414 if (extensions) { |
|
415 if (extensions->hasGenericContext<SVGAnimatedRect>(obj.get())) |
|
416 ASSERT(extensions->genericContext<SVGAnimatedRect>(obj.get()) == imp); |
|
417 else |
|
418 extensions->setGenericContext<SVGAnimatedRect>(obj.get(), imp); |
|
419 } |
|
420 } |
|
421 |
|
422 return toJS(exec, obj.get()); |
|
423 } |
|
424 case PreserveAspectRatioAttrNum: { |
|
425 SVGSVGElement* imp = static_cast<SVGSVGElement*>(impl()); |
|
426 |
|
427 ASSERT(exec && exec->dynamicInterpreter()); |
|
428 |
|
429 RefPtr<SVGAnimatedPreserveAspectRatio> obj = imp->preserveAspectRatioAnimated(); |
|
430 Frame* activeFrame = static_cast<ScriptInterpreter*>(exec->dynamicInterpreter())->frame(); |
|
431 if (activeFrame) { |
|
432 SVGDocumentExtensions* extensions = (activeFrame->document() ? activeFrame->document()->accessSVGExtensions() : 0); |
|
433 if (extensions) { |
|
434 if (extensions->hasGenericContext<SVGAnimatedPreserveAspectRatio>(obj.get())) |
|
435 ASSERT(extensions->genericContext<SVGAnimatedPreserveAspectRatio>(obj.get()) == imp); |
|
436 else |
|
437 extensions->setGenericContext<SVGAnimatedPreserveAspectRatio>(obj.get(), imp); |
|
438 } |
|
439 } |
|
440 |
|
441 return toJS(exec, obj.get()); |
|
442 } |
|
443 case ZoomAndPanAttrNum: { |
|
444 SVGSVGElement* imp = static_cast<SVGSVGElement*>(impl()); |
|
445 |
|
446 return jsNumber(imp->zoomAndPan()); |
|
447 } |
|
448 } |
|
449 return 0; |
|
450 } |
|
451 |
|
452 void JSSVGSVGElement::put(ExecState* exec, const Identifier& propertyName, JSValue* value, int attr) |
|
453 { |
|
454 lookupPut<JSSVGSVGElement, JSSVGElement>(exec, propertyName, value, attr, &JSSVGSVGElementTable, this); |
|
455 } |
|
456 |
|
457 void JSSVGSVGElement::putValueProperty(ExecState* exec, int token, JSValue* value, int /*attr*/) |
|
458 { |
|
459 switch (token) { |
|
460 case ContentScriptTypeAttrNum: { |
|
461 SVGSVGElement* imp = static_cast<SVGSVGElement*>(impl()); |
|
462 |
|
463 imp->setContentScriptType(value->toString(exec)); |
|
464 break; |
|
465 } |
|
466 case ContentStyleTypeAttrNum: { |
|
467 SVGSVGElement* imp = static_cast<SVGSVGElement*>(impl()); |
|
468 |
|
469 imp->setContentStyleType(value->toString(exec)); |
|
470 break; |
|
471 } |
|
472 case UseCurrentViewAttrNum: { |
|
473 SVGSVGElement* imp = static_cast<SVGSVGElement*>(impl()); |
|
474 |
|
475 imp->setUseCurrentView(value->toBoolean(exec)); |
|
476 break; |
|
477 } |
|
478 case CurrentScaleAttrNum: { |
|
479 SVGSVGElement* imp = static_cast<SVGSVGElement*>(impl()); |
|
480 |
|
481 imp->setCurrentScale(value->toFloat(exec)); |
|
482 break; |
|
483 } |
|
484 case XmllangAttrNum: { |
|
485 SVGSVGElement* imp = static_cast<SVGSVGElement*>(impl()); |
|
486 |
|
487 imp->setXmllang(value->toString(exec)); |
|
488 break; |
|
489 } |
|
490 case XmlspaceAttrNum: { |
|
491 SVGSVGElement* imp = static_cast<SVGSVGElement*>(impl()); |
|
492 |
|
493 imp->setXmlspace(value->toString(exec)); |
|
494 break; |
|
495 } |
|
496 case ZoomAndPanAttrNum: { |
|
497 SVGSVGElement* imp = static_cast<SVGSVGElement*>(impl()); |
|
498 |
|
499 imp->setZoomAndPan(value->toInt32(exec)); |
|
500 break; |
|
501 } |
|
502 } |
|
503 } |
|
504 |
|
505 JSValue* JSSVGSVGElementPrototypeFunction::callAsFunction(ExecState* exec, JSObject* thisObj, const List& args) |
|
506 { |
|
507 if (!thisObj->inherits(&JSSVGSVGElement::info)) |
|
508 return throwError(exec, TypeError); |
|
509 |
|
510 SVGSVGElement* imp = static_cast<SVGSVGElement*>(static_cast<JSSVGSVGElement*>(thisObj)->impl()); |
|
511 |
|
512 switch (id) { |
|
513 case JSSVGSVGElement::SuspendRedrawFuncNum: { |
|
514 bool maxWaitMillisecondsOk; |
|
515 unsigned maxWaitMilliseconds = args[0]->toInt32(exec, maxWaitMillisecondsOk); |
|
516 if (!maxWaitMillisecondsOk) { |
|
517 setDOMException(exec, TYPE_MISMATCH_ERR); |
|
518 return jsUndefined(); |
|
519 } |
|
520 |
|
521 |
|
522 KJS::JSValue* result = jsNumber(imp->suspendRedraw(maxWaitMilliseconds)); |
|
523 return result; |
|
524 } |
|
525 case JSSVGSVGElement::UnsuspendRedrawFuncNum: { |
|
526 ExceptionCode ec = 0; |
|
527 bool suspendHandleIdOk; |
|
528 unsigned suspendHandleId = args[0]->toInt32(exec, suspendHandleIdOk); |
|
529 if (!suspendHandleIdOk) { |
|
530 setDOMException(exec, TYPE_MISMATCH_ERR); |
|
531 return jsUndefined(); |
|
532 } |
|
533 |
|
534 imp->unsuspendRedraw(suspendHandleId, ec); |
|
535 setDOMException(exec, ec); |
|
536 return jsUndefined(); |
|
537 } |
|
538 case JSSVGSVGElement::UnsuspendRedrawAllFuncNum: { |
|
539 |
|
540 imp->unsuspendRedrawAll(); |
|
541 return jsUndefined(); |
|
542 } |
|
543 case JSSVGSVGElement::ForceRedrawFuncNum: { |
|
544 |
|
545 imp->forceRedraw(); |
|
546 return jsUndefined(); |
|
547 } |
|
548 case JSSVGSVGElement::PauseAnimationsFuncNum: { |
|
549 |
|
550 imp->pauseAnimations(); |
|
551 return jsUndefined(); |
|
552 } |
|
553 case JSSVGSVGElement::UnpauseAnimationsFuncNum: { |
|
554 |
|
555 imp->unpauseAnimations(); |
|
556 return jsUndefined(); |
|
557 } |
|
558 case JSSVGSVGElement::AnimationsPausedFuncNum: { |
|
559 |
|
560 |
|
561 KJS::JSValue* result = jsBoolean(imp->animationsPaused()); |
|
562 return result; |
|
563 } |
|
564 case JSSVGSVGElement::GetCurrentTimeFuncNum: { |
|
565 |
|
566 |
|
567 KJS::JSValue* result = jsNumber(imp->getCurrentTime()); |
|
568 return result; |
|
569 } |
|
570 case JSSVGSVGElement::SetCurrentTimeFuncNum: { |
|
571 float seconds = args[0]->toFloat(exec); |
|
572 |
|
573 imp->setCurrentTime(seconds); |
|
574 return jsUndefined(); |
|
575 } |
|
576 case JSSVGSVGElement::GetIntersectionListFuncNum: { |
|
577 FloatRect rect = toSVGRect(args[0]); |
|
578 SVGElement* referenceElement = toSVGElement(args[1]); |
|
579 |
|
580 |
|
581 KJS::JSValue* result = toJS(exec, WTF::getPtr(imp->getIntersectionList(rect, referenceElement))); |
|
582 return result; |
|
583 } |
|
584 case JSSVGSVGElement::GetEnclosureListFuncNum: { |
|
585 FloatRect rect = toSVGRect(args[0]); |
|
586 SVGElement* referenceElement = toSVGElement(args[1]); |
|
587 |
|
588 |
|
589 KJS::JSValue* result = toJS(exec, WTF::getPtr(imp->getEnclosureList(rect, referenceElement))); |
|
590 return result; |
|
591 } |
|
592 case JSSVGSVGElement::CheckIntersectionFuncNum: { |
|
593 SVGElement* element = toSVGElement(args[0]); |
|
594 FloatRect rect = toSVGRect(args[1]); |
|
595 |
|
596 |
|
597 KJS::JSValue* result = jsBoolean(imp->checkIntersection(element, rect)); |
|
598 return result; |
|
599 } |
|
600 case JSSVGSVGElement::CheckEnclosureFuncNum: { |
|
601 SVGElement* element = toSVGElement(args[0]); |
|
602 FloatRect rect = toSVGRect(args[1]); |
|
603 |
|
604 |
|
605 KJS::JSValue* result = jsBoolean(imp->checkEnclosure(element, rect)); |
|
606 return result; |
|
607 } |
|
608 case JSSVGSVGElement::DeselectAllFuncNum: { |
|
609 |
|
610 imp->deselectAll(); |
|
611 return jsUndefined(); |
|
612 } |
|
613 case JSSVGSVGElement::CreateSVGNumberFuncNum: { |
|
614 |
|
615 |
|
616 KJS::JSValue* result = toJS(exec, new JSSVGPODTypeWrapper<double>(imp->createSVGNumber())); |
|
617 return result; |
|
618 } |
|
619 case JSSVGSVGElement::CreateSVGLengthFuncNum: { |
|
620 |
|
621 |
|
622 KJS::JSValue* result = toJS(exec, new JSSVGPODTypeWrapper<SVGLength>(imp->createSVGLength())); |
|
623 return result; |
|
624 } |
|
625 case JSSVGSVGElement::CreateSVGAngleFuncNum: { |
|
626 |
|
627 |
|
628 KJS::JSValue* result = toJS(exec, WTF::getPtr(imp->createSVGAngle())); |
|
629 return result; |
|
630 } |
|
631 case JSSVGSVGElement::CreateSVGPointFuncNum: { |
|
632 |
|
633 |
|
634 KJS::JSValue* result = toJS(exec, new JSSVGPODTypeWrapper<FloatPoint>(imp->createSVGPoint())); |
|
635 return result; |
|
636 } |
|
637 case JSSVGSVGElement::CreateSVGMatrixFuncNum: { |
|
638 |
|
639 |
|
640 KJS::JSValue* result = toJS(exec, new JSSVGPODTypeWrapper<AffineTransform>(imp->createSVGMatrix())); |
|
641 return result; |
|
642 } |
|
643 case JSSVGSVGElement::CreateSVGRectFuncNum: { |
|
644 |
|
645 |
|
646 KJS::JSValue* result = toJS(exec, new JSSVGPODTypeWrapper<FloatRect>(imp->createSVGRect())); |
|
647 return result; |
|
648 } |
|
649 case JSSVGSVGElement::CreateSVGTransformFuncNum: { |
|
650 |
|
651 |
|
652 KJS::JSValue* result = toJS(exec, new JSSVGPODTypeWrapper<SVGTransform>(imp->createSVGTransform())); |
|
653 return result; |
|
654 } |
|
655 case JSSVGSVGElement::CreateSVGTransformFromMatrixFuncNum: { |
|
656 AffineTransform matrix = toSVGMatrix(args[0]); |
|
657 |
|
658 |
|
659 KJS::JSValue* result = toJS(exec, new JSSVGPODTypeWrapper<SVGTransform>(imp->createSVGTransformFromMatrix(matrix))); |
|
660 return result; |
|
661 } |
|
662 case JSSVGSVGElement::HasExtensionFuncNum: { |
|
663 String extension = args[0]->toString(exec); |
|
664 |
|
665 |
|
666 KJS::JSValue* result = jsBoolean(imp->hasExtension(extension)); |
|
667 return result; |
|
668 } |
|
669 case JSSVGSVGElement::GetBBoxFuncNum: { |
|
670 |
|
671 |
|
672 KJS::JSValue* result = toJS(exec, new JSSVGPODTypeWrapper<FloatRect>(imp->getBBox())); |
|
673 return result; |
|
674 } |
|
675 case JSSVGSVGElement::GetCTMFuncNum: { |
|
676 |
|
677 |
|
678 KJS::JSValue* result = toJS(exec, new JSSVGPODTypeWrapper<AffineTransform>(imp->getCTM())); |
|
679 return result; |
|
680 } |
|
681 case JSSVGSVGElement::GetScreenCTMFuncNum: { |
|
682 |
|
683 |
|
684 KJS::JSValue* result = toJS(exec, new JSSVGPODTypeWrapper<AffineTransform>(imp->getScreenCTM())); |
|
685 return result; |
|
686 } |
|
687 case JSSVGSVGElement::GetTransformToElementFuncNum: { |
|
688 ExceptionCode ec = 0; |
|
689 SVGElement* element = toSVGElement(args[0]); |
|
690 |
|
691 |
|
692 KJS::JSValue* result = toJS(exec, new JSSVGPODTypeWrapper<AffineTransform>(imp->getTransformToElement(element, ec))); |
|
693 setDOMException(exec, ec); |
|
694 return result; |
|
695 } |
|
696 } |
|
697 return 0; |
|
698 } |
|
699 |
|
700 } |
|
701 |
|
702 #endif // ENABLE(SVG) |