tizen beta release
[profile/ivi/webkit-efl.git] / DerivedSources / WebCore / JSSVGMatrix.cpp
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 #if ENABLE(SVG)
24
25 #include "JSSVGMatrix.h"
26
27 #include "ExceptionCode.h"
28 #include "JSDOMBinding.h"
29 #include "JSSVGMatrix.h"
30 #include "SVGMatrix.h"
31 #include <runtime/Error.h>
32 #include <wtf/GetPtr.h>
33
34 using namespace JSC;
35
36 namespace WebCore {
37
38 ASSERT_CLASS_FITS_IN_CELL(JSSVGMatrix);
39
40 /* Hash table */
41 #if ENABLE(JIT)
42 #define THUNK_GENERATOR(generator) , generator
43 #else
44 #define THUNK_GENERATOR(generator)
45 #endif
46 #if ENABLE(DFG_JIT)
47 #define INTRINSIC(intrinsic) , intrinsic
48 #else
49 #define INTRINSIC(intrinsic)
50 #endif
51
52 static const HashTableValue JSSVGMatrixTableValues[] =
53 {
54     { "a", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGMatrixA), (intptr_t)setJSSVGMatrixA THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
55     { "b", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGMatrixB), (intptr_t)setJSSVGMatrixB THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
56     { "c", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGMatrixC), (intptr_t)setJSSVGMatrixC THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
57     { "d", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGMatrixD), (intptr_t)setJSSVGMatrixD THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
58     { "e", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGMatrixE), (intptr_t)setJSSVGMatrixE THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
59     { "f", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGMatrixF), (intptr_t)setJSSVGMatrixF THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
60     { "constructor", DontEnum | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGMatrixConstructor), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
61     { 0, 0, 0, 0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) }
62 };
63
64 #undef THUNK_GENERATOR
65 static const HashTable JSSVGMatrixTable = { 17, 15, JSSVGMatrixTableValues, 0 };
66 /* Hash table for constructor */
67 #if ENABLE(JIT)
68 #define THUNK_GENERATOR(generator) , generator
69 #else
70 #define THUNK_GENERATOR(generator)
71 #endif
72 #if ENABLE(DFG_JIT)
73 #define INTRINSIC(intrinsic) , intrinsic
74 #else
75 #define INTRINSIC(intrinsic)
76 #endif
77
78 static const HashTableValue JSSVGMatrixConstructorTableValues[] =
79 {
80     { 0, 0, 0, 0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) }
81 };
82
83 #undef THUNK_GENERATOR
84 static const HashTable JSSVGMatrixConstructorTable = { 1, 0, JSSVGMatrixConstructorTableValues, 0 };
85 const ClassInfo JSSVGMatrixConstructor::s_info = { "SVGMatrixConstructor", &DOMConstructorObject::s_info, &JSSVGMatrixConstructorTable, 0, CREATE_METHOD_TABLE(JSSVGMatrixConstructor) };
86
87 JSSVGMatrixConstructor::JSSVGMatrixConstructor(Structure* structure, JSDOMGlobalObject* globalObject)
88     : DOMConstructorObject(structure, globalObject)
89 {
90 }
91
92 void JSSVGMatrixConstructor::finishCreation(ExecState* exec, JSDOMGlobalObject* globalObject)
93 {
94     Base::finishCreation(exec->globalData());
95     ASSERT(inherits(&s_info));
96     putDirect(exec->globalData(), exec->propertyNames().prototype, JSSVGMatrixPrototype::self(exec, globalObject), DontDelete | ReadOnly);
97 }
98
99 bool JSSVGMatrixConstructor::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
100 {
101     return getStaticValueSlot<JSSVGMatrixConstructor, JSDOMWrapper>(exec, &JSSVGMatrixConstructorTable, static_cast<JSSVGMatrixConstructor*>(cell), propertyName, slot);
102 }
103
104 bool JSSVGMatrixConstructor::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
105 {
106     return getStaticValueDescriptor<JSSVGMatrixConstructor, JSDOMWrapper>(exec, &JSSVGMatrixConstructorTable, static_cast<JSSVGMatrixConstructor*>(object), propertyName, descriptor);
107 }
108
109 /* Hash table for prototype */
110 #if ENABLE(JIT)
111 #define THUNK_GENERATOR(generator) , generator
112 #else
113 #define THUNK_GENERATOR(generator)
114 #endif
115 #if ENABLE(DFG_JIT)
116 #define INTRINSIC(intrinsic) , intrinsic
117 #else
118 #define INTRINSIC(intrinsic)
119 #endif
120
121 static const HashTableValue JSSVGMatrixPrototypeTableValues[] =
122 {
123     { "multiply", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsSVGMatrixPrototypeFunctionMultiply), (intptr_t)1 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
124     { "inverse", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsSVGMatrixPrototypeFunctionInverse), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
125     { "translate", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsSVGMatrixPrototypeFunctionTranslate), (intptr_t)2 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
126     { "scale", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsSVGMatrixPrototypeFunctionScale), (intptr_t)1 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
127     { "scaleNonUniform", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsSVGMatrixPrototypeFunctionScaleNonUniform), (intptr_t)2 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
128     { "rotate", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsSVGMatrixPrototypeFunctionRotate), (intptr_t)1 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
129     { "rotateFromVector", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsSVGMatrixPrototypeFunctionRotateFromVector), (intptr_t)2 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
130     { "flipX", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsSVGMatrixPrototypeFunctionFlipX), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
131     { "flipY", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsSVGMatrixPrototypeFunctionFlipY), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
132     { "skewX", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsSVGMatrixPrototypeFunctionSkewX), (intptr_t)1 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
133     { "skewY", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsSVGMatrixPrototypeFunctionSkewY), (intptr_t)1 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
134     { 0, 0, 0, 0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) }
135 };
136
137 #undef THUNK_GENERATOR
138 static const HashTable JSSVGMatrixPrototypeTable = { 33, 31, JSSVGMatrixPrototypeTableValues, 0 };
139 const ClassInfo JSSVGMatrixPrototype::s_info = { "SVGMatrixPrototype", &JSC::JSNonFinalObject::s_info, &JSSVGMatrixPrototypeTable, 0, CREATE_METHOD_TABLE(JSSVGMatrixPrototype) };
140
141 JSObject* JSSVGMatrixPrototype::self(ExecState* exec, JSGlobalObject* globalObject)
142 {
143     return getDOMPrototype<JSSVGMatrix>(exec, globalObject);
144 }
145
146 bool JSSVGMatrixPrototype::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
147 {
148     JSSVGMatrixPrototype* thisObject = jsCast<JSSVGMatrixPrototype*>(cell);
149     return getStaticFunctionSlot<JSObject>(exec, &JSSVGMatrixPrototypeTable, thisObject, propertyName, slot);
150 }
151
152 bool JSSVGMatrixPrototype::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
153 {
154     JSSVGMatrixPrototype* thisObject = jsCast<JSSVGMatrixPrototype*>(object);
155     return getStaticFunctionDescriptor<JSObject>(exec, &JSSVGMatrixPrototypeTable, thisObject, propertyName, descriptor);
156 }
157
158 const ClassInfo JSSVGMatrix::s_info = { "SVGMatrix", &JSDOMWrapper::s_info, &JSSVGMatrixTable, 0 , CREATE_METHOD_TABLE(JSSVGMatrix) };
159
160 JSSVGMatrix::JSSVGMatrix(Structure* structure, JSDOMGlobalObject* globalObject, PassRefPtr<SVGPropertyTearOff<SVGMatrix> > impl)
161     : JSDOMWrapper(structure, globalObject)
162     , m_impl(impl.leakRef())
163 {
164 }
165
166 void JSSVGMatrix::finishCreation(JSGlobalData& globalData)
167 {
168     Base::finishCreation(globalData);
169     ASSERT(inherits(&s_info));
170 }
171
172 JSObject* JSSVGMatrix::createPrototype(ExecState* exec, JSGlobalObject* globalObject)
173 {
174     return JSSVGMatrixPrototype::create(exec->globalData(), globalObject, JSSVGMatrixPrototype::createStructure(globalObject->globalData(), globalObject, globalObject->objectPrototype()));
175 }
176
177 bool JSSVGMatrix::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
178 {
179     JSSVGMatrix* thisObject = jsCast<JSSVGMatrix*>(cell);
180     ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info);
181     return getStaticValueSlot<JSSVGMatrix, Base>(exec, &JSSVGMatrixTable, thisObject, propertyName, slot);
182 }
183
184 bool JSSVGMatrix::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
185 {
186     JSSVGMatrix* thisObject = jsCast<JSSVGMatrix*>(object);
187     ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info);
188     return getStaticValueDescriptor<JSSVGMatrix, Base>(exec, &JSSVGMatrixTable, thisObject, propertyName, descriptor);
189 }
190
191 JSValue jsSVGMatrixA(ExecState* exec, JSValue slotBase, const Identifier&)
192 {
193     JSSVGMatrix* castedThis = static_cast<JSSVGMatrix*>(asObject(slotBase));
194     UNUSED_PARAM(exec);
195     SVGMatrix& imp = castedThis->impl()->propertyReference();
196     JSValue result =  jsNumber(imp.a());
197     return result;
198 }
199
200
201 JSValue jsSVGMatrixB(ExecState* exec, JSValue slotBase, const Identifier&)
202 {
203     JSSVGMatrix* castedThis = static_cast<JSSVGMatrix*>(asObject(slotBase));
204     UNUSED_PARAM(exec);
205     SVGMatrix& imp = castedThis->impl()->propertyReference();
206     JSValue result =  jsNumber(imp.b());
207     return result;
208 }
209
210
211 JSValue jsSVGMatrixC(ExecState* exec, JSValue slotBase, const Identifier&)
212 {
213     JSSVGMatrix* castedThis = static_cast<JSSVGMatrix*>(asObject(slotBase));
214     UNUSED_PARAM(exec);
215     SVGMatrix& imp = castedThis->impl()->propertyReference();
216     JSValue result =  jsNumber(imp.c());
217     return result;
218 }
219
220
221 JSValue jsSVGMatrixD(ExecState* exec, JSValue slotBase, const Identifier&)
222 {
223     JSSVGMatrix* castedThis = static_cast<JSSVGMatrix*>(asObject(slotBase));
224     UNUSED_PARAM(exec);
225     SVGMatrix& imp = castedThis->impl()->propertyReference();
226     JSValue result =  jsNumber(imp.d());
227     return result;
228 }
229
230
231 JSValue jsSVGMatrixE(ExecState* exec, JSValue slotBase, const Identifier&)
232 {
233     JSSVGMatrix* castedThis = static_cast<JSSVGMatrix*>(asObject(slotBase));
234     UNUSED_PARAM(exec);
235     SVGMatrix& imp = castedThis->impl()->propertyReference();
236     JSValue result =  jsNumber(imp.e());
237     return result;
238 }
239
240
241 JSValue jsSVGMatrixF(ExecState* exec, JSValue slotBase, const Identifier&)
242 {
243     JSSVGMatrix* castedThis = static_cast<JSSVGMatrix*>(asObject(slotBase));
244     UNUSED_PARAM(exec);
245     SVGMatrix& imp = castedThis->impl()->propertyReference();
246     JSValue result =  jsNumber(imp.f());
247     return result;
248 }
249
250
251 JSValue jsSVGMatrixConstructor(ExecState* exec, JSValue slotBase, const Identifier&)
252 {
253     JSSVGMatrix* domObject = static_cast<JSSVGMatrix*>(asObject(slotBase));
254     return JSSVGMatrix::getConstructor(exec, domObject->globalObject());
255 }
256
257 void JSSVGMatrix::put(JSCell* cell, ExecState* exec, const Identifier& propertyName, JSValue value, PutPropertySlot& slot)
258 {
259     JSSVGMatrix* thisObject = jsCast<JSSVGMatrix*>(cell);
260     ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info);
261     lookupPut<JSSVGMatrix, Base>(exec, propertyName, value, &JSSVGMatrixTable, thisObject, slot);
262 }
263
264 void setJSSVGMatrixA(ExecState* exec, JSObject* thisObject, JSValue value)
265 {
266     JSSVGMatrix* castedThis = static_cast<JSSVGMatrix*>(thisObject);
267     SVGPropertyTearOff<SVGMatrix> * imp = static_cast<SVGPropertyTearOff<SVGMatrix> *>(castedThis->impl());
268     if (imp->role() == AnimValRole) {
269         setDOMException(exec, NO_MODIFICATION_ALLOWED_ERR);
270         return;
271     }
272     SVGMatrix& podImp = imp->propertyReference();
273     podImp.setA(value.toNumber(exec));
274     imp->commitChange();
275 }
276
277
278 void setJSSVGMatrixB(ExecState* exec, JSObject* thisObject, JSValue value)
279 {
280     JSSVGMatrix* castedThis = static_cast<JSSVGMatrix*>(thisObject);
281     SVGPropertyTearOff<SVGMatrix> * imp = static_cast<SVGPropertyTearOff<SVGMatrix> *>(castedThis->impl());
282     if (imp->role() == AnimValRole) {
283         setDOMException(exec, NO_MODIFICATION_ALLOWED_ERR);
284         return;
285     }
286     SVGMatrix& podImp = imp->propertyReference();
287     podImp.setB(value.toNumber(exec));
288     imp->commitChange();
289 }
290
291
292 void setJSSVGMatrixC(ExecState* exec, JSObject* thisObject, JSValue value)
293 {
294     JSSVGMatrix* castedThis = static_cast<JSSVGMatrix*>(thisObject);
295     SVGPropertyTearOff<SVGMatrix> * imp = static_cast<SVGPropertyTearOff<SVGMatrix> *>(castedThis->impl());
296     if (imp->role() == AnimValRole) {
297         setDOMException(exec, NO_MODIFICATION_ALLOWED_ERR);
298         return;
299     }
300     SVGMatrix& podImp = imp->propertyReference();
301     podImp.setC(value.toNumber(exec));
302     imp->commitChange();
303 }
304
305
306 void setJSSVGMatrixD(ExecState* exec, JSObject* thisObject, JSValue value)
307 {
308     JSSVGMatrix* castedThis = static_cast<JSSVGMatrix*>(thisObject);
309     SVGPropertyTearOff<SVGMatrix> * imp = static_cast<SVGPropertyTearOff<SVGMatrix> *>(castedThis->impl());
310     if (imp->role() == AnimValRole) {
311         setDOMException(exec, NO_MODIFICATION_ALLOWED_ERR);
312         return;
313     }
314     SVGMatrix& podImp = imp->propertyReference();
315     podImp.setD(value.toNumber(exec));
316     imp->commitChange();
317 }
318
319
320 void setJSSVGMatrixE(ExecState* exec, JSObject* thisObject, JSValue value)
321 {
322     JSSVGMatrix* castedThis = static_cast<JSSVGMatrix*>(thisObject);
323     SVGPropertyTearOff<SVGMatrix> * imp = static_cast<SVGPropertyTearOff<SVGMatrix> *>(castedThis->impl());
324     if (imp->role() == AnimValRole) {
325         setDOMException(exec, NO_MODIFICATION_ALLOWED_ERR);
326         return;
327     }
328     SVGMatrix& podImp = imp->propertyReference();
329     podImp.setE(value.toNumber(exec));
330     imp->commitChange();
331 }
332
333
334 void setJSSVGMatrixF(ExecState* exec, JSObject* thisObject, JSValue value)
335 {
336     JSSVGMatrix* castedThis = static_cast<JSSVGMatrix*>(thisObject);
337     SVGPropertyTearOff<SVGMatrix> * imp = static_cast<SVGPropertyTearOff<SVGMatrix> *>(castedThis->impl());
338     if (imp->role() == AnimValRole) {
339         setDOMException(exec, NO_MODIFICATION_ALLOWED_ERR);
340         return;
341     }
342     SVGMatrix& podImp = imp->propertyReference();
343     podImp.setF(value.toNumber(exec));
344     imp->commitChange();
345 }
346
347
348 JSValue JSSVGMatrix::getConstructor(ExecState* exec, JSGlobalObject* globalObject)
349 {
350     return getDOMConstructor<JSSVGMatrixConstructor>(exec, static_cast<JSDOMGlobalObject*>(globalObject));
351 }
352
353 EncodedJSValue JSC_HOST_CALL jsSVGMatrixPrototypeFunctionMultiply(ExecState* exec)
354 {
355     JSValue thisValue = exec->hostThisValue();
356     if (!thisValue.inherits(&JSSVGMatrix::s_info))
357         return throwVMTypeError(exec);
358     JSSVGMatrix* castedThis = static_cast<JSSVGMatrix*>(asObject(thisValue));
359     ASSERT_GC_OBJECT_INHERITS(castedThis, &JSSVGMatrix::s_info);
360     SVGPropertyTearOff<SVGMatrix> * imp = static_cast<SVGPropertyTearOff<SVGMatrix> *>(castedThis->impl());
361     if (imp->role() == AnimValRole) {
362         setDOMException(exec, NO_MODIFICATION_ALLOWED_ERR);
363         return JSValue::encode(jsUndefined());
364     }
365     SVGMatrix& podImp = imp->propertyReference();
366     if (exec->argumentCount() < 1)
367         return throwVMError(exec, createTypeError(exec, "Not enough arguments"));
368     if (exec->argumentCount() > 0 && !exec->argument(0).isUndefinedOrNull() && !exec->argument(0).inherits(&JSSVGMatrix::s_info))
369         return throwVMTypeError(exec);
370     SVGPropertyTearOff<SVGMatrix>* secondMatrix(toSVGMatrix(MAYBE_MISSING_PARAMETER(exec, 0, MissingIsUndefined)));
371     if (exec->hadException())
372         return JSValue::encode(jsUndefined());
373     if (!secondMatrix) {
374         setDOMException(exec, TYPE_MISMATCH_ERR);
375         return JSValue::encode(jsUndefined());
376     }
377
378     JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(SVGPropertyTearOff<SVGMatrix>::create(podImp.multiply(secondMatrix->propertyReference()))));
379     return JSValue::encode(result);
380 }
381
382 EncodedJSValue JSC_HOST_CALL jsSVGMatrixPrototypeFunctionInverse(ExecState* exec)
383 {
384     JSValue thisValue = exec->hostThisValue();
385     if (!thisValue.inherits(&JSSVGMatrix::s_info))
386         return throwVMTypeError(exec);
387     JSSVGMatrix* castedThis = static_cast<JSSVGMatrix*>(asObject(thisValue));
388     ASSERT_GC_OBJECT_INHERITS(castedThis, &JSSVGMatrix::s_info);
389     SVGPropertyTearOff<SVGMatrix> * imp = static_cast<SVGPropertyTearOff<SVGMatrix> *>(castedThis->impl());
390     if (imp->role() == AnimValRole) {
391         setDOMException(exec, NO_MODIFICATION_ALLOWED_ERR);
392         return JSValue::encode(jsUndefined());
393     }
394     SVGMatrix& podImp = imp->propertyReference();
395     ExceptionCode ec = 0;
396
397     JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(SVGPropertyTearOff<SVGMatrix>::create(podImp.inverse(ec))));
398     setDOMException(exec, ec);
399     return JSValue::encode(result);
400 }
401
402 EncodedJSValue JSC_HOST_CALL jsSVGMatrixPrototypeFunctionTranslate(ExecState* exec)
403 {
404     JSValue thisValue = exec->hostThisValue();
405     if (!thisValue.inherits(&JSSVGMatrix::s_info))
406         return throwVMTypeError(exec);
407     JSSVGMatrix* castedThis = static_cast<JSSVGMatrix*>(asObject(thisValue));
408     ASSERT_GC_OBJECT_INHERITS(castedThis, &JSSVGMatrix::s_info);
409     SVGPropertyTearOff<SVGMatrix> * imp = static_cast<SVGPropertyTearOff<SVGMatrix> *>(castedThis->impl());
410     if (imp->role() == AnimValRole) {
411         setDOMException(exec, NO_MODIFICATION_ALLOWED_ERR);
412         return JSValue::encode(jsUndefined());
413     }
414     SVGMatrix& podImp = imp->propertyReference();
415     if (exec->argumentCount() < 2)
416         return throwVMError(exec, createTypeError(exec, "Not enough arguments"));
417     float x(MAYBE_MISSING_PARAMETER(exec, 0, MissingIsUndefined).toFloat(exec));
418     if (exec->hadException())
419         return JSValue::encode(jsUndefined());
420     float y(MAYBE_MISSING_PARAMETER(exec, 1, MissingIsUndefined).toFloat(exec));
421     if (exec->hadException())
422         return JSValue::encode(jsUndefined());
423
424     JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(SVGPropertyTearOff<SVGMatrix>::create(podImp.translate(x, y))));
425     return JSValue::encode(result);
426 }
427
428 EncodedJSValue JSC_HOST_CALL jsSVGMatrixPrototypeFunctionScale(ExecState* exec)
429 {
430     JSValue thisValue = exec->hostThisValue();
431     if (!thisValue.inherits(&JSSVGMatrix::s_info))
432         return throwVMTypeError(exec);
433     JSSVGMatrix* castedThis = static_cast<JSSVGMatrix*>(asObject(thisValue));
434     ASSERT_GC_OBJECT_INHERITS(castedThis, &JSSVGMatrix::s_info);
435     SVGPropertyTearOff<SVGMatrix> * imp = static_cast<SVGPropertyTearOff<SVGMatrix> *>(castedThis->impl());
436     if (imp->role() == AnimValRole) {
437         setDOMException(exec, NO_MODIFICATION_ALLOWED_ERR);
438         return JSValue::encode(jsUndefined());
439     }
440     SVGMatrix& podImp = imp->propertyReference();
441     if (exec->argumentCount() < 1)
442         return throwVMError(exec, createTypeError(exec, "Not enough arguments"));
443     float scaleFactor(MAYBE_MISSING_PARAMETER(exec, 0, MissingIsUndefined).toFloat(exec));
444     if (exec->hadException())
445         return JSValue::encode(jsUndefined());
446
447     JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(SVGPropertyTearOff<SVGMatrix>::create(podImp.scale(scaleFactor))));
448     return JSValue::encode(result);
449 }
450
451 EncodedJSValue JSC_HOST_CALL jsSVGMatrixPrototypeFunctionScaleNonUniform(ExecState* exec)
452 {
453     JSValue thisValue = exec->hostThisValue();
454     if (!thisValue.inherits(&JSSVGMatrix::s_info))
455         return throwVMTypeError(exec);
456     JSSVGMatrix* castedThis = static_cast<JSSVGMatrix*>(asObject(thisValue));
457     ASSERT_GC_OBJECT_INHERITS(castedThis, &JSSVGMatrix::s_info);
458     SVGPropertyTearOff<SVGMatrix> * imp = static_cast<SVGPropertyTearOff<SVGMatrix> *>(castedThis->impl());
459     if (imp->role() == AnimValRole) {
460         setDOMException(exec, NO_MODIFICATION_ALLOWED_ERR);
461         return JSValue::encode(jsUndefined());
462     }
463     SVGMatrix& podImp = imp->propertyReference();
464     if (exec->argumentCount() < 2)
465         return throwVMError(exec, createTypeError(exec, "Not enough arguments"));
466     float scaleFactorX(MAYBE_MISSING_PARAMETER(exec, 0, MissingIsUndefined).toFloat(exec));
467     if (exec->hadException())
468         return JSValue::encode(jsUndefined());
469     float scaleFactorY(MAYBE_MISSING_PARAMETER(exec, 1, MissingIsUndefined).toFloat(exec));
470     if (exec->hadException())
471         return JSValue::encode(jsUndefined());
472
473     JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(SVGPropertyTearOff<SVGMatrix>::create(podImp.scaleNonUniform(scaleFactorX, scaleFactorY))));
474     return JSValue::encode(result);
475 }
476
477 EncodedJSValue JSC_HOST_CALL jsSVGMatrixPrototypeFunctionRotate(ExecState* exec)
478 {
479     JSValue thisValue = exec->hostThisValue();
480     if (!thisValue.inherits(&JSSVGMatrix::s_info))
481         return throwVMTypeError(exec);
482     JSSVGMatrix* castedThis = static_cast<JSSVGMatrix*>(asObject(thisValue));
483     ASSERT_GC_OBJECT_INHERITS(castedThis, &JSSVGMatrix::s_info);
484     SVGPropertyTearOff<SVGMatrix> * imp = static_cast<SVGPropertyTearOff<SVGMatrix> *>(castedThis->impl());
485     if (imp->role() == AnimValRole) {
486         setDOMException(exec, NO_MODIFICATION_ALLOWED_ERR);
487         return JSValue::encode(jsUndefined());
488     }
489     SVGMatrix& podImp = imp->propertyReference();
490     if (exec->argumentCount() < 1)
491         return throwVMError(exec, createTypeError(exec, "Not enough arguments"));
492     float angle(MAYBE_MISSING_PARAMETER(exec, 0, MissingIsUndefined).toFloat(exec));
493     if (exec->hadException())
494         return JSValue::encode(jsUndefined());
495
496     JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(SVGPropertyTearOff<SVGMatrix>::create(podImp.rotate(angle))));
497     return JSValue::encode(result);
498 }
499
500 EncodedJSValue JSC_HOST_CALL jsSVGMatrixPrototypeFunctionRotateFromVector(ExecState* exec)
501 {
502     JSValue thisValue = exec->hostThisValue();
503     if (!thisValue.inherits(&JSSVGMatrix::s_info))
504         return throwVMTypeError(exec);
505     JSSVGMatrix* castedThis = static_cast<JSSVGMatrix*>(asObject(thisValue));
506     ASSERT_GC_OBJECT_INHERITS(castedThis, &JSSVGMatrix::s_info);
507     SVGPropertyTearOff<SVGMatrix> * imp = static_cast<SVGPropertyTearOff<SVGMatrix> *>(castedThis->impl());
508     if (imp->role() == AnimValRole) {
509         setDOMException(exec, NO_MODIFICATION_ALLOWED_ERR);
510         return JSValue::encode(jsUndefined());
511     }
512     SVGMatrix& podImp = imp->propertyReference();
513     if (exec->argumentCount() < 2)
514         return throwVMError(exec, createTypeError(exec, "Not enough arguments"));
515     ExceptionCode ec = 0;
516     float x(MAYBE_MISSING_PARAMETER(exec, 0, MissingIsUndefined).toFloat(exec));
517     if (exec->hadException())
518         return JSValue::encode(jsUndefined());
519     float y(MAYBE_MISSING_PARAMETER(exec, 1, MissingIsUndefined).toFloat(exec));
520     if (exec->hadException())
521         return JSValue::encode(jsUndefined());
522
523     JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(SVGPropertyTearOff<SVGMatrix>::create(podImp.rotateFromVector(x, y, ec))));
524     setDOMException(exec, ec);
525     return JSValue::encode(result);
526 }
527
528 EncodedJSValue JSC_HOST_CALL jsSVGMatrixPrototypeFunctionFlipX(ExecState* exec)
529 {
530     JSValue thisValue = exec->hostThisValue();
531     if (!thisValue.inherits(&JSSVGMatrix::s_info))
532         return throwVMTypeError(exec);
533     JSSVGMatrix* castedThis = static_cast<JSSVGMatrix*>(asObject(thisValue));
534     ASSERT_GC_OBJECT_INHERITS(castedThis, &JSSVGMatrix::s_info);
535     SVGPropertyTearOff<SVGMatrix> * imp = static_cast<SVGPropertyTearOff<SVGMatrix> *>(castedThis->impl());
536     if (imp->role() == AnimValRole) {
537         setDOMException(exec, NO_MODIFICATION_ALLOWED_ERR);
538         return JSValue::encode(jsUndefined());
539     }
540     SVGMatrix& podImp = imp->propertyReference();
541
542     JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(SVGPropertyTearOff<SVGMatrix>::create(podImp.flipX())));
543     return JSValue::encode(result);
544 }
545
546 EncodedJSValue JSC_HOST_CALL jsSVGMatrixPrototypeFunctionFlipY(ExecState* exec)
547 {
548     JSValue thisValue = exec->hostThisValue();
549     if (!thisValue.inherits(&JSSVGMatrix::s_info))
550         return throwVMTypeError(exec);
551     JSSVGMatrix* castedThis = static_cast<JSSVGMatrix*>(asObject(thisValue));
552     ASSERT_GC_OBJECT_INHERITS(castedThis, &JSSVGMatrix::s_info);
553     SVGPropertyTearOff<SVGMatrix> * imp = static_cast<SVGPropertyTearOff<SVGMatrix> *>(castedThis->impl());
554     if (imp->role() == AnimValRole) {
555         setDOMException(exec, NO_MODIFICATION_ALLOWED_ERR);
556         return JSValue::encode(jsUndefined());
557     }
558     SVGMatrix& podImp = imp->propertyReference();
559
560     JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(SVGPropertyTearOff<SVGMatrix>::create(podImp.flipY())));
561     return JSValue::encode(result);
562 }
563
564 EncodedJSValue JSC_HOST_CALL jsSVGMatrixPrototypeFunctionSkewX(ExecState* exec)
565 {
566     JSValue thisValue = exec->hostThisValue();
567     if (!thisValue.inherits(&JSSVGMatrix::s_info))
568         return throwVMTypeError(exec);
569     JSSVGMatrix* castedThis = static_cast<JSSVGMatrix*>(asObject(thisValue));
570     ASSERT_GC_OBJECT_INHERITS(castedThis, &JSSVGMatrix::s_info);
571     SVGPropertyTearOff<SVGMatrix> * imp = static_cast<SVGPropertyTearOff<SVGMatrix> *>(castedThis->impl());
572     if (imp->role() == AnimValRole) {
573         setDOMException(exec, NO_MODIFICATION_ALLOWED_ERR);
574         return JSValue::encode(jsUndefined());
575     }
576     SVGMatrix& podImp = imp->propertyReference();
577     if (exec->argumentCount() < 1)
578         return throwVMError(exec, createTypeError(exec, "Not enough arguments"));
579     float angle(MAYBE_MISSING_PARAMETER(exec, 0, MissingIsUndefined).toFloat(exec));
580     if (exec->hadException())
581         return JSValue::encode(jsUndefined());
582
583     JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(SVGPropertyTearOff<SVGMatrix>::create(podImp.skewX(angle))));
584     return JSValue::encode(result);
585 }
586
587 EncodedJSValue JSC_HOST_CALL jsSVGMatrixPrototypeFunctionSkewY(ExecState* exec)
588 {
589     JSValue thisValue = exec->hostThisValue();
590     if (!thisValue.inherits(&JSSVGMatrix::s_info))
591         return throwVMTypeError(exec);
592     JSSVGMatrix* castedThis = static_cast<JSSVGMatrix*>(asObject(thisValue));
593     ASSERT_GC_OBJECT_INHERITS(castedThis, &JSSVGMatrix::s_info);
594     SVGPropertyTearOff<SVGMatrix> * imp = static_cast<SVGPropertyTearOff<SVGMatrix> *>(castedThis->impl());
595     if (imp->role() == AnimValRole) {
596         setDOMException(exec, NO_MODIFICATION_ALLOWED_ERR);
597         return JSValue::encode(jsUndefined());
598     }
599     SVGMatrix& podImp = imp->propertyReference();
600     if (exec->argumentCount() < 1)
601         return throwVMError(exec, createTypeError(exec, "Not enough arguments"));
602     float angle(MAYBE_MISSING_PARAMETER(exec, 0, MissingIsUndefined).toFloat(exec));
603     if (exec->hadException())
604         return JSValue::encode(jsUndefined());
605
606     JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(SVGPropertyTearOff<SVGMatrix>::create(podImp.skewY(angle))));
607     return JSValue::encode(result);
608 }
609
610 static inline bool isObservable(JSSVGMatrix* jsSVGMatrix)
611 {
612     if (jsSVGMatrix->hasCustomProperties())
613         return true;
614     return false;
615 }
616
617 bool JSSVGMatrixOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor)
618 {
619     JSSVGMatrix* jsSVGMatrix = static_cast<JSSVGMatrix*>(handle.get().asCell());
620     if (!isObservable(jsSVGMatrix))
621         return false;
622     UNUSED_PARAM(visitor);
623     return false;
624 }
625
626 void JSSVGMatrixOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context)
627 {
628     JSSVGMatrix* jsSVGMatrix = static_cast<JSSVGMatrix*>(handle.get().asCell());
629     DOMWrapperWorld* world = static_cast<DOMWrapperWorld*>(context);
630     uncacheWrapper(world, jsSVGMatrix->impl(), jsSVGMatrix);
631     jsSVGMatrix->releaseImpl();
632 }
633
634 JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, SVGPropertyTearOff<SVGMatrix> * impl)
635 {
636     return wrap<JSSVGMatrix, SVGPropertyTearOff<SVGMatrix> >(exec, globalObject, impl);
637 }
638
639 SVGPropertyTearOff<SVGMatrix> * toSVGMatrix(JSC::JSValue value)
640 {
641     return value.inherits(&JSSVGMatrix::s_info) ? static_cast<JSSVGMatrix*>(asObject(value))->impl() : 0;
642 }
643
644 }
645
646 #endif // ENABLE(SVG)