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