|
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 "JSSVGPolygonElement.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 "JSSVGAnimatedString.h" |
|
40 #include "JSSVGAnimatedTransformList.h" |
|
41 #include "JSSVGElement.h" |
|
42 #include "JSSVGMatrix.h" |
|
43 #include "JSSVGPointList.h" |
|
44 #include "JSSVGRect.h" |
|
45 #include "JSSVGStringList.h" |
|
46 #include "PlatformString.h" |
|
47 #include "SVGElement.h" |
|
48 #include "SVGPointList.h" |
|
49 #include "SVGPolygonElement.h" |
|
50 #include "SVGStringList.h" |
|
51 |
|
52 using namespace KJS; |
|
53 |
|
54 namespace WebCore { |
|
55 |
|
56 /* Hash table */ |
|
57 |
|
58 static const HashEntry JSSVGPolygonElementTableEntries[] = |
|
59 { |
|
60 { 0, 0, 0, 0, 0 }, |
|
61 { "transform", JSSVGPolygonElement::TransformAttrNum, DontDelete|ReadOnly, 0, 0 }, |
|
62 { "xmlspace", JSSVGPolygonElement::XmlspaceAttrNum, DontDelete, 0, 0 }, |
|
63 { "requiredFeatures", JSSVGPolygonElement::RequiredFeaturesAttrNum, DontDelete|ReadOnly, 0, &JSSVGPolygonElementTableEntries[13] }, |
|
64 { "farthestViewportElement", JSSVGPolygonElement::FarthestViewportElementAttrNum, DontDelete|ReadOnly, 0, &JSSVGPolygonElementTableEntries[16] }, |
|
65 { 0, 0, 0, 0, 0 }, |
|
66 { 0, 0, 0, 0, 0 }, |
|
67 { 0, 0, 0, 0, 0 }, |
|
68 { "style", JSSVGPolygonElement::StyleAttrNum, DontDelete|ReadOnly, 0, &JSSVGPolygonElementTableEntries[15] }, |
|
69 { "systemLanguage", JSSVGPolygonElement::SystemLanguageAttrNum, DontDelete|ReadOnly, 0, 0 }, |
|
70 { "className", JSSVGPolygonElement::ClassNameAttrNum, DontDelete|ReadOnly, 0, 0 }, |
|
71 { "externalResourcesRequired", JSSVGPolygonElement::ExternalResourcesRequiredAttrNum, DontDelete|ReadOnly, 0, 0 }, |
|
72 { "requiredExtensions", JSSVGPolygonElement::RequiredExtensionsAttrNum, DontDelete|ReadOnly, 0, 0 }, |
|
73 { "xmllang", JSSVGPolygonElement::XmllangAttrNum, DontDelete, 0, &JSSVGPolygonElementTableEntries[14] }, |
|
74 { "nearestViewportElement", JSSVGPolygonElement::NearestViewportElementAttrNum, DontDelete|ReadOnly, 0, 0 }, |
|
75 { "points", JSSVGPolygonElement::PointsAttrNum, DontDelete|ReadOnly, 0, 0 }, |
|
76 { "animatedPoints", JSSVGPolygonElement::AnimatedPointsAttrNum, DontDelete|ReadOnly, 0, 0 } |
|
77 }; |
|
78 |
|
79 static const HashTable JSSVGPolygonElementTable = |
|
80 { |
|
81 2, 17, JSSVGPolygonElementTableEntries, 13 |
|
82 }; |
|
83 |
|
84 /* Hash table for prototype */ |
|
85 |
|
86 static const HashEntry JSSVGPolygonElementPrototypeTableEntries[] = |
|
87 { |
|
88 { "hasExtension", JSSVGPolygonElement::HasExtensionFuncNum, DontDelete|Function, 1, &JSSVGPolygonElementPrototypeTableEntries[6] }, |
|
89 { 0, 0, 0, 0, 0 }, |
|
90 { 0, 0, 0, 0, 0 }, |
|
91 { "getBBox", JSSVGPolygonElement::GetBBoxFuncNum, DontDelete|Function, 0, &JSSVGPolygonElementPrototypeTableEntries[5] }, |
|
92 { "getTransformToElement", JSSVGPolygonElement::GetTransformToElementFuncNum, DontDelete|Function, 1, 0 }, |
|
93 { "getCTM", JSSVGPolygonElement::GetCTMFuncNum, DontDelete|Function, 0, 0 }, |
|
94 { "getScreenCTM", JSSVGPolygonElement::GetScreenCTMFuncNum, DontDelete|Function, 0, 0 } |
|
95 }; |
|
96 |
|
97 static const HashTable JSSVGPolygonElementPrototypeTable = |
|
98 { |
|
99 2, 7, JSSVGPolygonElementPrototypeTableEntries, 5 |
|
100 }; |
|
101 |
|
102 const ClassInfo JSSVGPolygonElementPrototype::info = { "SVGPolygonElementPrototype", 0, &JSSVGPolygonElementPrototypeTable, 0 }; |
|
103 |
|
104 JSObject* JSSVGPolygonElementPrototype::self(ExecState* exec) |
|
105 { |
|
106 return KJS::cacheGlobalObject<JSSVGPolygonElementPrototype>(exec, "[[JSSVGPolygonElement.prototype]]"); |
|
107 } |
|
108 |
|
109 bool JSSVGPolygonElementPrototype::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) |
|
110 { |
|
111 return getStaticFunctionSlot<JSSVGPolygonElementPrototypeFunction, JSObject>(exec, &JSSVGPolygonElementPrototypeTable, this, propertyName, slot); |
|
112 } |
|
113 |
|
114 const ClassInfo JSSVGPolygonElement::info = { "SVGPolygonElement", &JSSVGElement::info, &JSSVGPolygonElementTable, 0 }; |
|
115 |
|
116 JSSVGPolygonElement::JSSVGPolygonElement(ExecState* exec, SVGPolygonElement* impl) |
|
117 : JSSVGElement(exec, impl) |
|
118 { |
|
119 setPrototype(JSSVGPolygonElementPrototype::self(exec)); |
|
120 } |
|
121 |
|
122 bool JSSVGPolygonElement::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) |
|
123 { |
|
124 return getStaticValueSlot<JSSVGPolygonElement, JSSVGElement>(exec, &JSSVGPolygonElementTable, this, propertyName, slot); |
|
125 } |
|
126 |
|
127 JSValue* JSSVGPolygonElement::getValueProperty(ExecState* exec, int token) const |
|
128 { |
|
129 switch (token) { |
|
130 case RequiredFeaturesAttrNum: { |
|
131 SVGPolygonElement* imp = static_cast<SVGPolygonElement*>(impl()); |
|
132 |
|
133 return toJS(exec, WTF::getPtr(imp->requiredFeatures())); |
|
134 } |
|
135 case RequiredExtensionsAttrNum: { |
|
136 SVGPolygonElement* imp = static_cast<SVGPolygonElement*>(impl()); |
|
137 |
|
138 return toJS(exec, WTF::getPtr(imp->requiredExtensions())); |
|
139 } |
|
140 case SystemLanguageAttrNum: { |
|
141 SVGPolygonElement* imp = static_cast<SVGPolygonElement*>(impl()); |
|
142 |
|
143 return toJS(exec, WTF::getPtr(imp->systemLanguage())); |
|
144 } |
|
145 case XmllangAttrNum: { |
|
146 SVGPolygonElement* imp = static_cast<SVGPolygonElement*>(impl()); |
|
147 |
|
148 return jsString(imp->xmllang()); |
|
149 } |
|
150 case XmlspaceAttrNum: { |
|
151 SVGPolygonElement* imp = static_cast<SVGPolygonElement*>(impl()); |
|
152 |
|
153 return jsString(imp->xmlspace()); |
|
154 } |
|
155 case ExternalResourcesRequiredAttrNum: { |
|
156 SVGPolygonElement* imp = static_cast<SVGPolygonElement*>(impl()); |
|
157 |
|
158 ASSERT(exec && exec->dynamicInterpreter()); |
|
159 |
|
160 RefPtr<SVGAnimatedBoolean> obj = imp->externalResourcesRequiredAnimated(); |
|
161 Frame* activeFrame = static_cast<ScriptInterpreter*>(exec->dynamicInterpreter())->frame(); |
|
162 if (activeFrame) { |
|
163 SVGDocumentExtensions* extensions = (activeFrame->document() ? activeFrame->document()->accessSVGExtensions() : 0); |
|
164 if (extensions) { |
|
165 if (extensions->hasGenericContext<SVGAnimatedBoolean>(obj.get())) |
|
166 ASSERT(extensions->genericContext<SVGAnimatedBoolean>(obj.get()) == imp); |
|
167 else |
|
168 extensions->setGenericContext<SVGAnimatedBoolean>(obj.get(), imp); |
|
169 } |
|
170 } |
|
171 |
|
172 return toJS(exec, obj.get()); |
|
173 } |
|
174 case ClassNameAttrNum: { |
|
175 SVGPolygonElement* imp = static_cast<SVGPolygonElement*>(impl()); |
|
176 |
|
177 ASSERT(exec && exec->dynamicInterpreter()); |
|
178 |
|
179 RefPtr<SVGAnimatedString> obj = imp->classNameAnimated(); |
|
180 Frame* activeFrame = static_cast<ScriptInterpreter*>(exec->dynamicInterpreter())->frame(); |
|
181 if (activeFrame) { |
|
182 SVGDocumentExtensions* extensions = (activeFrame->document() ? activeFrame->document()->accessSVGExtensions() : 0); |
|
183 if (extensions) { |
|
184 if (extensions->hasGenericContext<SVGAnimatedString>(obj.get())) |
|
185 ASSERT(extensions->genericContext<SVGAnimatedString>(obj.get()) == imp); |
|
186 else |
|
187 extensions->setGenericContext<SVGAnimatedString>(obj.get(), imp); |
|
188 } |
|
189 } |
|
190 |
|
191 return toJS(exec, obj.get()); |
|
192 } |
|
193 case StyleAttrNum: { |
|
194 SVGPolygonElement* imp = static_cast<SVGPolygonElement*>(impl()); |
|
195 |
|
196 return toJS(exec, WTF::getPtr(imp->style())); |
|
197 } |
|
198 case TransformAttrNum: { |
|
199 SVGPolygonElement* imp = static_cast<SVGPolygonElement*>(impl()); |
|
200 |
|
201 ASSERT(exec && exec->dynamicInterpreter()); |
|
202 |
|
203 RefPtr<SVGAnimatedTransformList> obj = imp->transformAnimated(); |
|
204 Frame* activeFrame = static_cast<ScriptInterpreter*>(exec->dynamicInterpreter())->frame(); |
|
205 if (activeFrame) { |
|
206 SVGDocumentExtensions* extensions = (activeFrame->document() ? activeFrame->document()->accessSVGExtensions() : 0); |
|
207 if (extensions) { |
|
208 if (extensions->hasGenericContext<SVGAnimatedTransformList>(obj.get())) |
|
209 ASSERT(extensions->genericContext<SVGAnimatedTransformList>(obj.get()) == imp); |
|
210 else |
|
211 extensions->setGenericContext<SVGAnimatedTransformList>(obj.get(), imp); |
|
212 } |
|
213 } |
|
214 |
|
215 return toJS(exec, obj.get()); |
|
216 } |
|
217 case NearestViewportElementAttrNum: { |
|
218 SVGPolygonElement* imp = static_cast<SVGPolygonElement*>(impl()); |
|
219 |
|
220 return toJS(exec, WTF::getPtr(imp->nearestViewportElement())); |
|
221 } |
|
222 case FarthestViewportElementAttrNum: { |
|
223 SVGPolygonElement* imp = static_cast<SVGPolygonElement*>(impl()); |
|
224 |
|
225 return toJS(exec, WTF::getPtr(imp->farthestViewportElement())); |
|
226 } |
|
227 case PointsAttrNum: { |
|
228 SVGPolygonElement* imp = static_cast<SVGPolygonElement*>(impl()); |
|
229 |
|
230 return toJS(exec, WTF::getPtr(imp->points())); |
|
231 } |
|
232 case AnimatedPointsAttrNum: { |
|
233 SVGPolygonElement* imp = static_cast<SVGPolygonElement*>(impl()); |
|
234 |
|
235 return toJS(exec, WTF::getPtr(imp->animatedPoints())); |
|
236 } |
|
237 } |
|
238 return 0; |
|
239 } |
|
240 |
|
241 void JSSVGPolygonElement::put(ExecState* exec, const Identifier& propertyName, JSValue* value, int attr) |
|
242 { |
|
243 lookupPut<JSSVGPolygonElement, JSSVGElement>(exec, propertyName, value, attr, &JSSVGPolygonElementTable, this); |
|
244 } |
|
245 |
|
246 void JSSVGPolygonElement::putValueProperty(ExecState* exec, int token, JSValue* value, int /*attr*/) |
|
247 { |
|
248 switch (token) { |
|
249 case XmllangAttrNum: { |
|
250 SVGPolygonElement* imp = static_cast<SVGPolygonElement*>(impl()); |
|
251 |
|
252 imp->setXmllang(value->toString(exec)); |
|
253 break; |
|
254 } |
|
255 case XmlspaceAttrNum: { |
|
256 SVGPolygonElement* imp = static_cast<SVGPolygonElement*>(impl()); |
|
257 |
|
258 imp->setXmlspace(value->toString(exec)); |
|
259 break; |
|
260 } |
|
261 } |
|
262 } |
|
263 |
|
264 JSValue* JSSVGPolygonElementPrototypeFunction::callAsFunction(ExecState* exec, JSObject* thisObj, const List& args) |
|
265 { |
|
266 if (!thisObj->inherits(&JSSVGPolygonElement::info)) |
|
267 return throwError(exec, TypeError); |
|
268 |
|
269 SVGPolygonElement* imp = static_cast<SVGPolygonElement*>(static_cast<JSSVGPolygonElement*>(thisObj)->impl()); |
|
270 |
|
271 switch (id) { |
|
272 case JSSVGPolygonElement::HasExtensionFuncNum: { |
|
273 String extension = args[0]->toString(exec); |
|
274 |
|
275 |
|
276 KJS::JSValue* result = jsBoolean(imp->hasExtension(extension)); |
|
277 return result; |
|
278 } |
|
279 case JSSVGPolygonElement::GetBBoxFuncNum: { |
|
280 |
|
281 |
|
282 KJS::JSValue* result = toJS(exec, new JSSVGPODTypeWrapper<FloatRect>(imp->getBBox())); |
|
283 return result; |
|
284 } |
|
285 case JSSVGPolygonElement::GetCTMFuncNum: { |
|
286 |
|
287 |
|
288 KJS::JSValue* result = toJS(exec, new JSSVGPODTypeWrapper<AffineTransform>(imp->getCTM())); |
|
289 return result; |
|
290 } |
|
291 case JSSVGPolygonElement::GetScreenCTMFuncNum: { |
|
292 |
|
293 |
|
294 KJS::JSValue* result = toJS(exec, new JSSVGPODTypeWrapper<AffineTransform>(imp->getScreenCTM())); |
|
295 return result; |
|
296 } |
|
297 case JSSVGPolygonElement::GetTransformToElementFuncNum: { |
|
298 ExceptionCode ec = 0; |
|
299 SVGElement* element = toSVGElement(args[0]); |
|
300 |
|
301 |
|
302 KJS::JSValue* result = toJS(exec, new JSSVGPODTypeWrapper<AffineTransform>(imp->getTransformToElement(element, ec))); |
|
303 setDOMException(exec, ec); |
|
304 return result; |
|
305 } |
|
306 } |
|
307 return 0; |
|
308 } |
|
309 |
|
310 } |
|
311 |
|
312 #endif // ENABLE(SVG) |