2 This file is part of the WebKit open source project.
3 This file has been generated by generate-bindings.pl. DO NOT MODIFY!
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.
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.
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.
25 #include "JSSVGMatrix.h"
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>
38 ASSERT_CLASS_FITS_IN_CELL(JSSVGMatrix);
42 #define THUNK_GENERATOR(generator) , generator
44 #define THUNK_GENERATOR(generator)
47 #define INTRINSIC(intrinsic) , intrinsic
49 #define INTRINSIC(intrinsic)
52 static const HashTableValue JSSVGMatrixTableValues[] =
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) }
64 #undef THUNK_GENERATOR
65 static const HashTable JSSVGMatrixTable = { 17, 15, JSSVGMatrixTableValues, 0 };
66 /* Hash table for constructor */
68 #define THUNK_GENERATOR(generator) , generator
70 #define THUNK_GENERATOR(generator)
73 #define INTRINSIC(intrinsic) , intrinsic
75 #define INTRINSIC(intrinsic)
78 static const HashTableValue JSSVGMatrixConstructorTableValues[] =
80 { 0, 0, 0, 0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) }
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) };
87 JSSVGMatrixConstructor::JSSVGMatrixConstructor(Structure* structure, JSDOMGlobalObject* globalObject)
88 : DOMConstructorObject(structure, globalObject)
92 void JSSVGMatrixConstructor::finishCreation(ExecState* exec, JSDOMGlobalObject* globalObject)
94 Base::finishCreation(exec->globalData());
95 ASSERT(inherits(&s_info));
96 putDirect(exec->globalData(), exec->propertyNames().prototype, JSSVGMatrixPrototype::self(exec, globalObject), DontDelete | ReadOnly);
99 bool JSSVGMatrixConstructor::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
101 return getStaticValueSlot<JSSVGMatrixConstructor, JSDOMWrapper>(exec, &JSSVGMatrixConstructorTable, static_cast<JSSVGMatrixConstructor*>(cell), propertyName, slot);
104 bool JSSVGMatrixConstructor::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
106 return getStaticValueDescriptor<JSSVGMatrixConstructor, JSDOMWrapper>(exec, &JSSVGMatrixConstructorTable, static_cast<JSSVGMatrixConstructor*>(object), propertyName, descriptor);
109 /* Hash table for prototype */
111 #define THUNK_GENERATOR(generator) , generator
113 #define THUNK_GENERATOR(generator)
116 #define INTRINSIC(intrinsic) , intrinsic
118 #define INTRINSIC(intrinsic)
121 static const HashTableValue JSSVGMatrixPrototypeTableValues[] =
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) }
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) };
141 JSObject* JSSVGMatrixPrototype::self(ExecState* exec, JSGlobalObject* globalObject)
143 return getDOMPrototype<JSSVGMatrix>(exec, globalObject);
146 bool JSSVGMatrixPrototype::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
148 JSSVGMatrixPrototype* thisObject = jsCast<JSSVGMatrixPrototype*>(cell);
149 return getStaticFunctionSlot<JSObject>(exec, &JSSVGMatrixPrototypeTable, thisObject, propertyName, slot);
152 bool JSSVGMatrixPrototype::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
154 JSSVGMatrixPrototype* thisObject = jsCast<JSSVGMatrixPrototype*>(object);
155 return getStaticFunctionDescriptor<JSObject>(exec, &JSSVGMatrixPrototypeTable, thisObject, propertyName, descriptor);
158 const ClassInfo JSSVGMatrix::s_info = { "SVGMatrix", &JSDOMWrapper::s_info, &JSSVGMatrixTable, 0 , CREATE_METHOD_TABLE(JSSVGMatrix) };
160 JSSVGMatrix::JSSVGMatrix(Structure* structure, JSDOMGlobalObject* globalObject, PassRefPtr<SVGPropertyTearOff<SVGMatrix> > impl)
161 : JSDOMWrapper(structure, globalObject)
162 , m_impl(impl.leakRef())
166 void JSSVGMatrix::finishCreation(JSGlobalData& globalData)
168 Base::finishCreation(globalData);
169 ASSERT(inherits(&s_info));
172 JSObject* JSSVGMatrix::createPrototype(ExecState* exec, JSGlobalObject* globalObject)
174 return JSSVGMatrixPrototype::create(exec->globalData(), globalObject, JSSVGMatrixPrototype::createStructure(globalObject->globalData(), globalObject, globalObject->objectPrototype()));
177 bool JSSVGMatrix::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
179 JSSVGMatrix* thisObject = jsCast<JSSVGMatrix*>(cell);
180 ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info);
181 return getStaticValueSlot<JSSVGMatrix, Base>(exec, &JSSVGMatrixTable, thisObject, propertyName, slot);
184 bool JSSVGMatrix::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
186 JSSVGMatrix* thisObject = jsCast<JSSVGMatrix*>(object);
187 ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info);
188 return getStaticValueDescriptor<JSSVGMatrix, Base>(exec, &JSSVGMatrixTable, thisObject, propertyName, descriptor);
191 JSValue jsSVGMatrixA(ExecState* exec, JSValue slotBase, const Identifier&)
193 JSSVGMatrix* castedThis = static_cast<JSSVGMatrix*>(asObject(slotBase));
195 SVGMatrix& imp = castedThis->impl()->propertyReference();
196 JSValue result = jsNumber(imp.a());
201 JSValue jsSVGMatrixB(ExecState* exec, JSValue slotBase, const Identifier&)
203 JSSVGMatrix* castedThis = static_cast<JSSVGMatrix*>(asObject(slotBase));
205 SVGMatrix& imp = castedThis->impl()->propertyReference();
206 JSValue result = jsNumber(imp.b());
211 JSValue jsSVGMatrixC(ExecState* exec, JSValue slotBase, const Identifier&)
213 JSSVGMatrix* castedThis = static_cast<JSSVGMatrix*>(asObject(slotBase));
215 SVGMatrix& imp = castedThis->impl()->propertyReference();
216 JSValue result = jsNumber(imp.c());
221 JSValue jsSVGMatrixD(ExecState* exec, JSValue slotBase, const Identifier&)
223 JSSVGMatrix* castedThis = static_cast<JSSVGMatrix*>(asObject(slotBase));
225 SVGMatrix& imp = castedThis->impl()->propertyReference();
226 JSValue result = jsNumber(imp.d());
231 JSValue jsSVGMatrixE(ExecState* exec, JSValue slotBase, const Identifier&)
233 JSSVGMatrix* castedThis = static_cast<JSSVGMatrix*>(asObject(slotBase));
235 SVGMatrix& imp = castedThis->impl()->propertyReference();
236 JSValue result = jsNumber(imp.e());
241 JSValue jsSVGMatrixF(ExecState* exec, JSValue slotBase, const Identifier&)
243 JSSVGMatrix* castedThis = static_cast<JSSVGMatrix*>(asObject(slotBase));
245 SVGMatrix& imp = castedThis->impl()->propertyReference();
246 JSValue result = jsNumber(imp.f());
251 JSValue jsSVGMatrixConstructor(ExecState* exec, JSValue slotBase, const Identifier&)
253 JSSVGMatrix* domObject = static_cast<JSSVGMatrix*>(asObject(slotBase));
254 return JSSVGMatrix::getConstructor(exec, domObject->globalObject());
257 void JSSVGMatrix::put(JSCell* cell, ExecState* exec, const Identifier& propertyName, JSValue value, PutPropertySlot& slot)
259 JSSVGMatrix* thisObject = jsCast<JSSVGMatrix*>(cell);
260 ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info);
261 lookupPut<JSSVGMatrix, Base>(exec, propertyName, value, &JSSVGMatrixTable, thisObject, slot);
264 void setJSSVGMatrixA(ExecState* exec, JSObject* thisObject, JSValue value)
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);
272 SVGMatrix& podImp = imp->propertyReference();
273 podImp.setA(value.toNumber(exec));
278 void setJSSVGMatrixB(ExecState* exec, JSObject* thisObject, JSValue value)
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);
286 SVGMatrix& podImp = imp->propertyReference();
287 podImp.setB(value.toNumber(exec));
292 void setJSSVGMatrixC(ExecState* exec, JSObject* thisObject, JSValue value)
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);
300 SVGMatrix& podImp = imp->propertyReference();
301 podImp.setC(value.toNumber(exec));
306 void setJSSVGMatrixD(ExecState* exec, JSObject* thisObject, JSValue value)
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);
314 SVGMatrix& podImp = imp->propertyReference();
315 podImp.setD(value.toNumber(exec));
320 void setJSSVGMatrixE(ExecState* exec, JSObject* thisObject, JSValue value)
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);
328 SVGMatrix& podImp = imp->propertyReference();
329 podImp.setE(value.toNumber(exec));
334 void setJSSVGMatrixF(ExecState* exec, JSObject* thisObject, JSValue value)
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);
342 SVGMatrix& podImp = imp->propertyReference();
343 podImp.setF(value.toNumber(exec));
348 JSValue JSSVGMatrix::getConstructor(ExecState* exec, JSGlobalObject* globalObject)
350 return getDOMConstructor<JSSVGMatrixConstructor>(exec, static_cast<JSDOMGlobalObject*>(globalObject));
353 EncodedJSValue JSC_HOST_CALL jsSVGMatrixPrototypeFunctionMultiply(ExecState* exec)
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());
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());
374 setDOMException(exec, TYPE_MISMATCH_ERR);
375 return JSValue::encode(jsUndefined());
378 JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(SVGPropertyTearOff<SVGMatrix>::create(podImp.multiply(secondMatrix->propertyReference()))));
379 return JSValue::encode(result);
382 EncodedJSValue JSC_HOST_CALL jsSVGMatrixPrototypeFunctionInverse(ExecState* exec)
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());
394 SVGMatrix& podImp = imp->propertyReference();
395 ExceptionCode ec = 0;
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);
402 EncodedJSValue JSC_HOST_CALL jsSVGMatrixPrototypeFunctionTranslate(ExecState* exec)
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());
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());
424 JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(SVGPropertyTearOff<SVGMatrix>::create(podImp.translate(x, y))));
425 return JSValue::encode(result);
428 EncodedJSValue JSC_HOST_CALL jsSVGMatrixPrototypeFunctionScale(ExecState* exec)
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());
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());
447 JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(SVGPropertyTearOff<SVGMatrix>::create(podImp.scale(scaleFactor))));
448 return JSValue::encode(result);
451 EncodedJSValue JSC_HOST_CALL jsSVGMatrixPrototypeFunctionScaleNonUniform(ExecState* exec)
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());
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());
473 JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(SVGPropertyTearOff<SVGMatrix>::create(podImp.scaleNonUniform(scaleFactorX, scaleFactorY))));
474 return JSValue::encode(result);
477 EncodedJSValue JSC_HOST_CALL jsSVGMatrixPrototypeFunctionRotate(ExecState* exec)
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());
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());
496 JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(SVGPropertyTearOff<SVGMatrix>::create(podImp.rotate(angle))));
497 return JSValue::encode(result);
500 EncodedJSValue JSC_HOST_CALL jsSVGMatrixPrototypeFunctionRotateFromVector(ExecState* exec)
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());
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());
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);
528 EncodedJSValue JSC_HOST_CALL jsSVGMatrixPrototypeFunctionFlipX(ExecState* exec)
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());
540 SVGMatrix& podImp = imp->propertyReference();
542 JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(SVGPropertyTearOff<SVGMatrix>::create(podImp.flipX())));
543 return JSValue::encode(result);
546 EncodedJSValue JSC_HOST_CALL jsSVGMatrixPrototypeFunctionFlipY(ExecState* exec)
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());
558 SVGMatrix& podImp = imp->propertyReference();
560 JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(SVGPropertyTearOff<SVGMatrix>::create(podImp.flipY())));
561 return JSValue::encode(result);
564 EncodedJSValue JSC_HOST_CALL jsSVGMatrixPrototypeFunctionSkewX(ExecState* exec)
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());
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());
583 JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(SVGPropertyTearOff<SVGMatrix>::create(podImp.skewX(angle))));
584 return JSValue::encode(result);
587 EncodedJSValue JSC_HOST_CALL jsSVGMatrixPrototypeFunctionSkewY(ExecState* exec)
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());
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());
606 JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(SVGPropertyTearOff<SVGMatrix>::create(podImp.skewY(angle))));
607 return JSValue::encode(result);
610 static inline bool isObservable(JSSVGMatrix* jsSVGMatrix)
612 if (jsSVGMatrix->hasCustomProperties())
617 bool JSSVGMatrixOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor)
619 JSSVGMatrix* jsSVGMatrix = static_cast<JSSVGMatrix*>(handle.get().asCell());
620 if (!isObservable(jsSVGMatrix))
622 UNUSED_PARAM(visitor);
626 void JSSVGMatrixOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context)
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();
634 JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, SVGPropertyTearOff<SVGMatrix> * impl)
636 return wrap<JSSVGMatrix, SVGPropertyTearOff<SVGMatrix> >(exec, globalObject, impl);
639 SVGPropertyTearOff<SVGMatrix> * toSVGMatrix(JSC::JSValue value)
641 return value.inherits(&JSSVGMatrix::s_info) ? static_cast<JSSVGMatrix*>(asObject(value))->impl() : 0;
646 #endif // ENABLE(SVG)