/* This file is part of the WebKit open source project. This file has been generated by generate-bindings.pl. DO NOT MODIFY! This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "config.h" #if ENABLE(SVG) #include "JSSVGMatrix.h" #include "JSSVGMatrix.h" #include #include #include using namespace JSC; namespace WebCore { ASSERT_CLASS_FITS_IN_CELL(JSSVGMatrix); /* Hash table */ static const HashTableValue JSSVGMatrixTableValues[7] = { { "a", DontDelete, (intptr_t)jsSVGMatrixA, (intptr_t)setJSSVGMatrixA }, { "b", DontDelete, (intptr_t)jsSVGMatrixB, (intptr_t)setJSSVGMatrixB }, { "c", DontDelete, (intptr_t)jsSVGMatrixC, (intptr_t)setJSSVGMatrixC }, { "d", DontDelete, (intptr_t)jsSVGMatrixD, (intptr_t)setJSSVGMatrixD }, { "e", DontDelete, (intptr_t)jsSVGMatrixE, (intptr_t)setJSSVGMatrixE }, { "f", DontDelete, (intptr_t)jsSVGMatrixF, (intptr_t)setJSSVGMatrixF }, { 0, 0, 0, 0 } }; static const HashTable JSSVGMatrixTable = #if ENABLE(PERFECT_HASH_SIZE) { 15, JSSVGMatrixTableValues, 0 }; #else { 16, 15, JSSVGMatrixTableValues, 0 }; #endif /* Hash table for prototype */ static const HashTableValue JSSVGMatrixPrototypeTableValues[12] = { { "multiply", DontDelete|Function, (intptr_t)jsSVGMatrixPrototypeFunctionMultiply, (intptr_t)1 }, { "inverse", DontDelete|Function, (intptr_t)jsSVGMatrixPrototypeFunctionInverse, (intptr_t)0 }, { "translate", DontDelete|Function, (intptr_t)jsSVGMatrixPrototypeFunctionTranslate, (intptr_t)2 }, { "scale", DontDelete|Function, (intptr_t)jsSVGMatrixPrototypeFunctionScale, (intptr_t)1 }, { "scaleNonUniform", DontDelete|Function, (intptr_t)jsSVGMatrixPrototypeFunctionScaleNonUniform, (intptr_t)2 }, { "rotate", DontDelete|Function, (intptr_t)jsSVGMatrixPrototypeFunctionRotate, (intptr_t)1 }, { "rotateFromVector", DontDelete|Function, (intptr_t)jsSVGMatrixPrototypeFunctionRotateFromVector, (intptr_t)2 }, { "flipX", DontDelete|Function, (intptr_t)jsSVGMatrixPrototypeFunctionFlipX, (intptr_t)0 }, { "flipY", DontDelete|Function, (intptr_t)jsSVGMatrixPrototypeFunctionFlipY, (intptr_t)0 }, { "skewX", DontDelete|Function, (intptr_t)jsSVGMatrixPrototypeFunctionSkewX, (intptr_t)1 }, { "skewY", DontDelete|Function, (intptr_t)jsSVGMatrixPrototypeFunctionSkewY, (intptr_t)1 }, { 0, 0, 0, 0 } }; static const HashTable JSSVGMatrixPrototypeTable = #if ENABLE(PERFECT_HASH_SIZE) { 63, JSSVGMatrixPrototypeTableValues, 0 }; #else { 33, 31, JSSVGMatrixPrototypeTableValues, 0 }; #endif const ClassInfo JSSVGMatrixPrototype::s_info = { "SVGMatrixPrototype", 0, &JSSVGMatrixPrototypeTable, 0 }; JSObject* JSSVGMatrixPrototype::self(ExecState* exec, JSGlobalObject* globalObject) { return getDOMPrototype(exec, globalObject); } bool JSSVGMatrixPrototype::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) { return getStaticFunctionSlot(exec, &JSSVGMatrixPrototypeTable, this, propertyName, slot); } const ClassInfo JSSVGMatrix::s_info = { "SVGMatrix", 0, &JSSVGMatrixTable, 0 }; JSSVGMatrix::JSSVGMatrix(PassRefPtr structure, PassRefPtr > impl, SVGElement* context) : DOMObject(structure) , m_context(context) , m_impl(impl) { } JSSVGMatrix::~JSSVGMatrix() { forgetDOMObject(*Heap::heap(this)->globalData(), m_impl.get()); } JSObject* JSSVGMatrix::createPrototype(ExecState* exec, JSGlobalObject* globalObject) { return new (exec) JSSVGMatrixPrototype(JSSVGMatrixPrototype::createStructure(globalObject->objectPrototype())); } bool JSSVGMatrix::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) { return getStaticValueSlot(exec, &JSSVGMatrixTable, this, propertyName, slot); } JSValue jsSVGMatrixA(ExecState* exec, const Identifier&, const PropertySlot& slot) { UNUSED_PARAM(exec); TransformationMatrix imp(*static_cast(asObject(slot.slotBase()))->impl()); return jsNumber(exec, imp.a()); } JSValue jsSVGMatrixB(ExecState* exec, const Identifier&, const PropertySlot& slot) { UNUSED_PARAM(exec); TransformationMatrix imp(*static_cast(asObject(slot.slotBase()))->impl()); return jsNumber(exec, imp.b()); } JSValue jsSVGMatrixC(ExecState* exec, const Identifier&, const PropertySlot& slot) { UNUSED_PARAM(exec); TransformationMatrix imp(*static_cast(asObject(slot.slotBase()))->impl()); return jsNumber(exec, imp.c()); } JSValue jsSVGMatrixD(ExecState* exec, const Identifier&, const PropertySlot& slot) { UNUSED_PARAM(exec); TransformationMatrix imp(*static_cast(asObject(slot.slotBase()))->impl()); return jsNumber(exec, imp.d()); } JSValue jsSVGMatrixE(ExecState* exec, const Identifier&, const PropertySlot& slot) { UNUSED_PARAM(exec); TransformationMatrix imp(*static_cast(asObject(slot.slotBase()))->impl()); return jsNumber(exec, imp.e()); } JSValue jsSVGMatrixF(ExecState* exec, const Identifier&, const PropertySlot& slot) { UNUSED_PARAM(exec); TransformationMatrix imp(*static_cast(asObject(slot.slotBase()))->impl()); return jsNumber(exec, imp.f()); } void JSSVGMatrix::put(ExecState* exec, const Identifier& propertyName, JSValue value, PutPropertySlot& slot) { lookupPut(exec, propertyName, value, &JSSVGMatrixTable, this, slot); } void setJSSVGMatrixA(ExecState* exec, JSObject* thisObject, JSValue value) { TransformationMatrix imp(*static_cast(thisObject)->impl()); imp.setA(value.toNumber(exec)); static_cast(thisObject)->impl()->commitChange(imp, static_cast(thisObject)->context()); } void setJSSVGMatrixB(ExecState* exec, JSObject* thisObject, JSValue value) { TransformationMatrix imp(*static_cast(thisObject)->impl()); imp.setB(value.toNumber(exec)); static_cast(thisObject)->impl()->commitChange(imp, static_cast(thisObject)->context()); } void setJSSVGMatrixC(ExecState* exec, JSObject* thisObject, JSValue value) { TransformationMatrix imp(*static_cast(thisObject)->impl()); imp.setC(value.toNumber(exec)); static_cast(thisObject)->impl()->commitChange(imp, static_cast(thisObject)->context()); } void setJSSVGMatrixD(ExecState* exec, JSObject* thisObject, JSValue value) { TransformationMatrix imp(*static_cast(thisObject)->impl()); imp.setD(value.toNumber(exec)); static_cast(thisObject)->impl()->commitChange(imp, static_cast(thisObject)->context()); } void setJSSVGMatrixE(ExecState* exec, JSObject* thisObject, JSValue value) { TransformationMatrix imp(*static_cast(thisObject)->impl()); imp.setE(value.toNumber(exec)); static_cast(thisObject)->impl()->commitChange(imp, static_cast(thisObject)->context()); } void setJSSVGMatrixF(ExecState* exec, JSObject* thisObject, JSValue value) { TransformationMatrix imp(*static_cast(thisObject)->impl()); imp.setF(value.toNumber(exec)); static_cast(thisObject)->impl()->commitChange(imp, static_cast(thisObject)->context()); } JSValue JSC_HOST_CALL jsSVGMatrixPrototypeFunctionMultiply(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args) { UNUSED_PARAM(args); if (!thisValue.isObject(&JSSVGMatrix::s_info)) return throwError(exec, TypeError); JSSVGMatrix* castedThisObj = static_cast(asObject(thisValue)); JSSVGPODTypeWrapper* wrapper = castedThisObj->impl(); TransformationMatrix imp(*wrapper); TransformationMatrix secondMatrix = toSVGMatrix(args.at(0)); JSC::JSValue result = toJS(exec, JSSVGStaticPODTypeWrapper::create(imp.multiply(secondMatrix)).get(), castedThisObj->context()); return result; } JSValue JSC_HOST_CALL jsSVGMatrixPrototypeFunctionInverse(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args) { UNUSED_PARAM(args); if (!thisValue.isObject(&JSSVGMatrix::s_info)) return throwError(exec, TypeError); JSSVGMatrix* castedThisObj = static_cast(asObject(thisValue)); return castedThisObj->inverse(exec, args); } JSValue JSC_HOST_CALL jsSVGMatrixPrototypeFunctionTranslate(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args) { UNUSED_PARAM(args); if (!thisValue.isObject(&JSSVGMatrix::s_info)) return throwError(exec, TypeError); JSSVGMatrix* castedThisObj = static_cast(asObject(thisValue)); JSSVGPODTypeWrapper* wrapper = castedThisObj->impl(); TransformationMatrix imp(*wrapper); float x = args.at(0).toFloat(exec); float y = args.at(1).toFloat(exec); JSC::JSValue result = toJS(exec, JSSVGStaticPODTypeWrapper::create(imp.translate(x, y)).get(), castedThisObj->context()); return result; } JSValue JSC_HOST_CALL jsSVGMatrixPrototypeFunctionScale(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args) { UNUSED_PARAM(args); if (!thisValue.isObject(&JSSVGMatrix::s_info)) return throwError(exec, TypeError); JSSVGMatrix* castedThisObj = static_cast(asObject(thisValue)); JSSVGPODTypeWrapper* wrapper = castedThisObj->impl(); TransformationMatrix imp(*wrapper); float scaleFactor = args.at(0).toFloat(exec); JSC::JSValue result = toJS(exec, JSSVGStaticPODTypeWrapper::create(imp.scale(scaleFactor)).get(), castedThisObj->context()); return result; } JSValue JSC_HOST_CALL jsSVGMatrixPrototypeFunctionScaleNonUniform(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args) { UNUSED_PARAM(args); if (!thisValue.isObject(&JSSVGMatrix::s_info)) return throwError(exec, TypeError); JSSVGMatrix* castedThisObj = static_cast(asObject(thisValue)); JSSVGPODTypeWrapper* wrapper = castedThisObj->impl(); TransformationMatrix imp(*wrapper); float scaleFactorX = args.at(0).toFloat(exec); float scaleFactorY = args.at(1).toFloat(exec); JSC::JSValue result = toJS(exec, JSSVGStaticPODTypeWrapper::create(imp.scaleNonUniform(scaleFactorX, scaleFactorY)).get(), castedThisObj->context()); return result; } JSValue JSC_HOST_CALL jsSVGMatrixPrototypeFunctionRotate(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args) { UNUSED_PARAM(args); if (!thisValue.isObject(&JSSVGMatrix::s_info)) return throwError(exec, TypeError); JSSVGMatrix* castedThisObj = static_cast(asObject(thisValue)); JSSVGPODTypeWrapper* wrapper = castedThisObj->impl(); TransformationMatrix imp(*wrapper); float angle = args.at(0).toFloat(exec); JSC::JSValue result = toJS(exec, JSSVGStaticPODTypeWrapper::create(imp.rotate(angle)).get(), castedThisObj->context()); return result; } JSValue JSC_HOST_CALL jsSVGMatrixPrototypeFunctionRotateFromVector(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args) { UNUSED_PARAM(args); if (!thisValue.isObject(&JSSVGMatrix::s_info)) return throwError(exec, TypeError); JSSVGMatrix* castedThisObj = static_cast(asObject(thisValue)); return castedThisObj->rotateFromVector(exec, args); } JSValue JSC_HOST_CALL jsSVGMatrixPrototypeFunctionFlipX(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args) { UNUSED_PARAM(args); if (!thisValue.isObject(&JSSVGMatrix::s_info)) return throwError(exec, TypeError); JSSVGMatrix* castedThisObj = static_cast(asObject(thisValue)); JSSVGPODTypeWrapper* wrapper = castedThisObj->impl(); TransformationMatrix imp(*wrapper); JSC::JSValue result = toJS(exec, JSSVGStaticPODTypeWrapper::create(imp.flipX()).get(), castedThisObj->context()); return result; } JSValue JSC_HOST_CALL jsSVGMatrixPrototypeFunctionFlipY(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args) { UNUSED_PARAM(args); if (!thisValue.isObject(&JSSVGMatrix::s_info)) return throwError(exec, TypeError); JSSVGMatrix* castedThisObj = static_cast(asObject(thisValue)); JSSVGPODTypeWrapper* wrapper = castedThisObj->impl(); TransformationMatrix imp(*wrapper); JSC::JSValue result = toJS(exec, JSSVGStaticPODTypeWrapper::create(imp.flipY()).get(), castedThisObj->context()); return result; } JSValue JSC_HOST_CALL jsSVGMatrixPrototypeFunctionSkewX(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args) { UNUSED_PARAM(args); if (!thisValue.isObject(&JSSVGMatrix::s_info)) return throwError(exec, TypeError); JSSVGMatrix* castedThisObj = static_cast(asObject(thisValue)); JSSVGPODTypeWrapper* wrapper = castedThisObj->impl(); TransformationMatrix imp(*wrapper); float angle = args.at(0).toFloat(exec); JSC::JSValue result = toJS(exec, JSSVGStaticPODTypeWrapper::create(imp.skewX(angle)).get(), castedThisObj->context()); return result; } JSValue JSC_HOST_CALL jsSVGMatrixPrototypeFunctionSkewY(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args) { UNUSED_PARAM(args); if (!thisValue.isObject(&JSSVGMatrix::s_info)) return throwError(exec, TypeError); JSSVGMatrix* castedThisObj = static_cast(asObject(thisValue)); JSSVGPODTypeWrapper* wrapper = castedThisObj->impl(); TransformationMatrix imp(*wrapper); float angle = args.at(0).toFloat(exec); JSC::JSValue result = toJS(exec, JSSVGStaticPODTypeWrapper::create(imp.skewY(angle)).get(), castedThisObj->context()); return result; } JSC::JSValue toJS(JSC::ExecState* exec, JSSVGPODTypeWrapper* object, SVGElement* context) { return getDOMObjectWrapper >(exec, object, context); } TransformationMatrix toSVGMatrix(JSC::JSValue value) { return value.isObject(&JSSVGMatrix::s_info) ? (TransformationMatrix) *static_cast(asObject(value))->impl() : TransformationMatrix(); } } #endif // ENABLE(SVG)