blob: 7dfccc1db6e3e4472419c853f00410b038a98c5e [file] [log] [blame]
/*
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"
#include "JSSVGMatrix.h"
#include "ExceptionCode.h"
#include "JSDOMBinding.h"
#include "JSDOMConstructor.h"
#include "JSDOMConvert.h"
#include "JSSVGMatrix.h"
#include "SVGMatrix.h"
#include <runtime/Error.h>
#include <runtime/FunctionPrototype.h>
#include <wtf/GetPtr.h>
using namespace JSC;
namespace WebCore {
// Functions
JSC::EncodedJSValue JSC_HOST_CALL jsSVGMatrixPrototypeFunctionMultiply(JSC::ExecState*);
JSC::EncodedJSValue JSC_HOST_CALL jsSVGMatrixPrototypeFunctionInverse(JSC::ExecState*);
JSC::EncodedJSValue JSC_HOST_CALL jsSVGMatrixPrototypeFunctionTranslate(JSC::ExecState*);
JSC::EncodedJSValue JSC_HOST_CALL jsSVGMatrixPrototypeFunctionScale(JSC::ExecState*);
JSC::EncodedJSValue JSC_HOST_CALL jsSVGMatrixPrototypeFunctionScaleNonUniform(JSC::ExecState*);
JSC::EncodedJSValue JSC_HOST_CALL jsSVGMatrixPrototypeFunctionRotate(JSC::ExecState*);
JSC::EncodedJSValue JSC_HOST_CALL jsSVGMatrixPrototypeFunctionRotateFromVector(JSC::ExecState*);
JSC::EncodedJSValue JSC_HOST_CALL jsSVGMatrixPrototypeFunctionFlipX(JSC::ExecState*);
JSC::EncodedJSValue JSC_HOST_CALL jsSVGMatrixPrototypeFunctionFlipY(JSC::ExecState*);
JSC::EncodedJSValue JSC_HOST_CALL jsSVGMatrixPrototypeFunctionSkewX(JSC::ExecState*);
JSC::EncodedJSValue JSC_HOST_CALL jsSVGMatrixPrototypeFunctionSkewY(JSC::ExecState*);
// Attributes
JSC::EncodedJSValue jsSVGMatrixA(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
bool setJSSVGMatrixA(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
JSC::EncodedJSValue jsSVGMatrixB(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
bool setJSSVGMatrixB(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
JSC::EncodedJSValue jsSVGMatrixC(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
bool setJSSVGMatrixC(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
JSC::EncodedJSValue jsSVGMatrixD(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
bool setJSSVGMatrixD(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
JSC::EncodedJSValue jsSVGMatrixE(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
bool setJSSVGMatrixE(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
JSC::EncodedJSValue jsSVGMatrixF(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
bool setJSSVGMatrixF(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
JSC::EncodedJSValue jsSVGMatrixConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
bool setJSSVGMatrixConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
class JSSVGMatrixPrototype : public JSC::JSNonFinalObject {
public:
typedef JSC::JSNonFinalObject Base;
static JSSVGMatrixPrototype* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure)
{
JSSVGMatrixPrototype* ptr = new (NotNull, JSC::allocateCell<JSSVGMatrixPrototype>(vm.heap)) JSSVGMatrixPrototype(vm, globalObject, structure);
ptr->finishCreation(vm);
return ptr;
}
DECLARE_INFO;
static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype)
{
return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info());
}
private:
JSSVGMatrixPrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure)
: JSC::JSNonFinalObject(vm, structure)
{
}
void finishCreation(JSC::VM&);
};
typedef JSDOMConstructorNotConstructable<JSSVGMatrix> JSSVGMatrixConstructor;
template<> JSValue JSSVGMatrixConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject)
{
UNUSED_PARAM(vm);
return globalObject.functionPrototype();
}
template<> void JSSVGMatrixConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject)
{
putDirect(vm, vm.propertyNames->prototype, JSSVGMatrix::prototype(vm, &globalObject), DontDelete | ReadOnly | DontEnum);
putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String(ASCIILiteral("SVGMatrix"))), ReadOnly | DontEnum);
putDirect(vm, vm.propertyNames->length, jsNumber(0), ReadOnly | DontEnum);
}
template<> const ClassInfo JSSVGMatrixConstructor::s_info = { "SVGMatrix", &Base::s_info, 0, CREATE_METHOD_TABLE(JSSVGMatrixConstructor) };
/* Hash table for prototype */
static const HashTableValue JSSVGMatrixPrototypeTableValues[] =
{
{ "constructor", DontEnum, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGMatrixConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSSVGMatrixConstructor) } },
{ "a", CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGMatrixA), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSSVGMatrixA) } },
{ "b", CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGMatrixB), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSSVGMatrixB) } },
{ "c", CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGMatrixC), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSSVGMatrixC) } },
{ "d", CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGMatrixD), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSSVGMatrixD) } },
{ "e", CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGMatrixE), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSSVGMatrixE) } },
{ "f", CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGMatrixF), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSSVGMatrixF) } },
{ "multiply", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsSVGMatrixPrototypeFunctionMultiply), (intptr_t) (1) } },
{ "inverse", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsSVGMatrixPrototypeFunctionInverse), (intptr_t) (0) } },
{ "translate", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsSVGMatrixPrototypeFunctionTranslate), (intptr_t) (2) } },
{ "scale", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsSVGMatrixPrototypeFunctionScale), (intptr_t) (1) } },
{ "scaleNonUniform", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsSVGMatrixPrototypeFunctionScaleNonUniform), (intptr_t) (2) } },
{ "rotate", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsSVGMatrixPrototypeFunctionRotate), (intptr_t) (1) } },
{ "rotateFromVector", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsSVGMatrixPrototypeFunctionRotateFromVector), (intptr_t) (2) } },
{ "flipX", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsSVGMatrixPrototypeFunctionFlipX), (intptr_t) (0) } },
{ "flipY", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsSVGMatrixPrototypeFunctionFlipY), (intptr_t) (0) } },
{ "skewX", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsSVGMatrixPrototypeFunctionSkewX), (intptr_t) (1) } },
{ "skewY", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsSVGMatrixPrototypeFunctionSkewY), (intptr_t) (1) } },
};
const ClassInfo JSSVGMatrixPrototype::s_info = { "SVGMatrixPrototype", &Base::s_info, 0, CREATE_METHOD_TABLE(JSSVGMatrixPrototype) };
void JSSVGMatrixPrototype::finishCreation(VM& vm)
{
Base::finishCreation(vm);
reifyStaticProperties(vm, JSSVGMatrixPrototypeTableValues, *this);
}
const ClassInfo JSSVGMatrix::s_info = { "SVGMatrix", &Base::s_info, 0, CREATE_METHOD_TABLE(JSSVGMatrix) };
JSSVGMatrix::JSSVGMatrix(Structure* structure, JSDOMGlobalObject& globalObject, Ref<SVGPropertyTearOff<SVGMatrix>>&& impl)
: JSDOMWrapper<SVGPropertyTearOff<SVGMatrix>>(structure, globalObject, WTFMove(impl))
{
}
JSObject* JSSVGMatrix::createPrototype(VM& vm, JSGlobalObject* globalObject)
{
return JSSVGMatrixPrototype::create(vm, globalObject, JSSVGMatrixPrototype::createStructure(vm, globalObject, globalObject->objectPrototype()));
}
JSObject* JSSVGMatrix::prototype(VM& vm, JSGlobalObject* globalObject)
{
return getDOMPrototype<JSSVGMatrix>(vm, globalObject);
}
void JSSVGMatrix::destroy(JSC::JSCell* cell)
{
JSSVGMatrix* thisObject = static_cast<JSSVGMatrix*>(cell);
thisObject->JSSVGMatrix::~JSSVGMatrix();
}
EncodedJSValue jsSVGMatrixA(ExecState* state, EncodedJSValue thisValue, PropertyName)
{
VM& vm = state->vm();
auto throwScope = DECLARE_THROW_SCOPE(vm);
UNUSED_PARAM(throwScope);
UNUSED_PARAM(thisValue);
JSValue decodedThisValue = JSValue::decode(thisValue);
auto* castedThis = jsDynamicCast<JSSVGMatrix*>(decodedThisValue);
if (UNLIKELY(!castedThis)) {
return throwGetterTypeError(*state, throwScope, "SVGMatrix", "a");
}
SVGMatrix& impl = castedThis->wrapped().propertyReference();
JSValue result = jsNumber(impl.a());
return JSValue::encode(result);
}
EncodedJSValue jsSVGMatrixB(ExecState* state, EncodedJSValue thisValue, PropertyName)
{
VM& vm = state->vm();
auto throwScope = DECLARE_THROW_SCOPE(vm);
UNUSED_PARAM(throwScope);
UNUSED_PARAM(thisValue);
JSValue decodedThisValue = JSValue::decode(thisValue);
auto* castedThis = jsDynamicCast<JSSVGMatrix*>(decodedThisValue);
if (UNLIKELY(!castedThis)) {
return throwGetterTypeError(*state, throwScope, "SVGMatrix", "b");
}
SVGMatrix& impl = castedThis->wrapped().propertyReference();
JSValue result = jsNumber(impl.b());
return JSValue::encode(result);
}
EncodedJSValue jsSVGMatrixC(ExecState* state, EncodedJSValue thisValue, PropertyName)
{
VM& vm = state->vm();
auto throwScope = DECLARE_THROW_SCOPE(vm);
UNUSED_PARAM(throwScope);
UNUSED_PARAM(thisValue);
JSValue decodedThisValue = JSValue::decode(thisValue);
auto* castedThis = jsDynamicCast<JSSVGMatrix*>(decodedThisValue);
if (UNLIKELY(!castedThis)) {
return throwGetterTypeError(*state, throwScope, "SVGMatrix", "c");
}
SVGMatrix& impl = castedThis->wrapped().propertyReference();
JSValue result = jsNumber(impl.c());
return JSValue::encode(result);
}
EncodedJSValue jsSVGMatrixD(ExecState* state, EncodedJSValue thisValue, PropertyName)
{
VM& vm = state->vm();
auto throwScope = DECLARE_THROW_SCOPE(vm);
UNUSED_PARAM(throwScope);
UNUSED_PARAM(thisValue);
JSValue decodedThisValue = JSValue::decode(thisValue);
auto* castedThis = jsDynamicCast<JSSVGMatrix*>(decodedThisValue);
if (UNLIKELY(!castedThis)) {
return throwGetterTypeError(*state, throwScope, "SVGMatrix", "d");
}
SVGMatrix& impl = castedThis->wrapped().propertyReference();
JSValue result = jsNumber(impl.d());
return JSValue::encode(result);
}
EncodedJSValue jsSVGMatrixE(ExecState* state, EncodedJSValue thisValue, PropertyName)
{
VM& vm = state->vm();
auto throwScope = DECLARE_THROW_SCOPE(vm);
UNUSED_PARAM(throwScope);
UNUSED_PARAM(thisValue);
JSValue decodedThisValue = JSValue::decode(thisValue);
auto* castedThis = jsDynamicCast<JSSVGMatrix*>(decodedThisValue);
if (UNLIKELY(!castedThis)) {
return throwGetterTypeError(*state, throwScope, "SVGMatrix", "e");
}
SVGMatrix& impl = castedThis->wrapped().propertyReference();
JSValue result = jsNumber(impl.e());
return JSValue::encode(result);
}
EncodedJSValue jsSVGMatrixF(ExecState* state, EncodedJSValue thisValue, PropertyName)
{
VM& vm = state->vm();
auto throwScope = DECLARE_THROW_SCOPE(vm);
UNUSED_PARAM(throwScope);
UNUSED_PARAM(thisValue);
JSValue decodedThisValue = JSValue::decode(thisValue);
auto* castedThis = jsDynamicCast<JSSVGMatrix*>(decodedThisValue);
if (UNLIKELY(!castedThis)) {
return throwGetterTypeError(*state, throwScope, "SVGMatrix", "f");
}
SVGMatrix& impl = castedThis->wrapped().propertyReference();
JSValue result = jsNumber(impl.f());
return JSValue::encode(result);
}
EncodedJSValue jsSVGMatrixConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName)
{
VM& vm = state->vm();
auto throwScope = DECLARE_THROW_SCOPE(vm);
JSSVGMatrixPrototype* domObject = jsDynamicCast<JSSVGMatrixPrototype*>(JSValue::decode(thisValue));
if (UNLIKELY(!domObject))
return throwVMTypeError(state, throwScope);
return JSValue::encode(JSSVGMatrix::getConstructor(state->vm(), domObject->globalObject()));
}
bool setJSSVGMatrixConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
{
VM& vm = state->vm();
auto throwScope = DECLARE_THROW_SCOPE(vm);
JSValue value = JSValue::decode(encodedValue);
JSSVGMatrixPrototype* domObject = jsDynamicCast<JSSVGMatrixPrototype*>(JSValue::decode(thisValue));
if (UNLIKELY(!domObject)) {
throwVMTypeError(state, throwScope);
return false;
}
// Shadowing a built-in constructor
return domObject->putDirect(state->vm(), state->propertyNames().constructor, value);
}
bool setJSSVGMatrixA(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
{
VM& vm = state->vm();
auto throwScope = DECLARE_THROW_SCOPE(vm);
UNUSED_PARAM(throwScope);
JSValue value = JSValue::decode(encodedValue);
UNUSED_PARAM(thisValue);
JSSVGMatrix* castedThis = jsDynamicCast<JSSVGMatrix*>(JSValue::decode(thisValue));
if (UNLIKELY(!castedThis)) {
return throwSetterTypeError(*state, throwScope, "SVGMatrix", "a");
}
auto& impl = castedThis->wrapped();
auto nativeValue = convert<double>(*state, value, ShouldAllowNonFinite::Yes);
RETURN_IF_EXCEPTION(throwScope, false);
if (impl.isReadOnly()) {
setDOMException(state, throwScope, NO_MODIFICATION_ALLOWED_ERR);
return false;
}
SVGMatrix& podImpl = impl.propertyReference();
podImpl.setA(nativeValue);
impl.commitChange();
return true;
}
bool setJSSVGMatrixB(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
{
VM& vm = state->vm();
auto throwScope = DECLARE_THROW_SCOPE(vm);
UNUSED_PARAM(throwScope);
JSValue value = JSValue::decode(encodedValue);
UNUSED_PARAM(thisValue);
JSSVGMatrix* castedThis = jsDynamicCast<JSSVGMatrix*>(JSValue::decode(thisValue));
if (UNLIKELY(!castedThis)) {
return throwSetterTypeError(*state, throwScope, "SVGMatrix", "b");
}
auto& impl = castedThis->wrapped();
auto nativeValue = convert<double>(*state, value, ShouldAllowNonFinite::Yes);
RETURN_IF_EXCEPTION(throwScope, false);
if (impl.isReadOnly()) {
setDOMException(state, throwScope, NO_MODIFICATION_ALLOWED_ERR);
return false;
}
SVGMatrix& podImpl = impl.propertyReference();
podImpl.setB(nativeValue);
impl.commitChange();
return true;
}
bool setJSSVGMatrixC(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
{
VM& vm = state->vm();
auto throwScope = DECLARE_THROW_SCOPE(vm);
UNUSED_PARAM(throwScope);
JSValue value = JSValue::decode(encodedValue);
UNUSED_PARAM(thisValue);
JSSVGMatrix* castedThis = jsDynamicCast<JSSVGMatrix*>(JSValue::decode(thisValue));
if (UNLIKELY(!castedThis)) {
return throwSetterTypeError(*state, throwScope, "SVGMatrix", "c");
}
auto& impl = castedThis->wrapped();
auto nativeValue = convert<double>(*state, value, ShouldAllowNonFinite::Yes);
RETURN_IF_EXCEPTION(throwScope, false);
if (impl.isReadOnly()) {
setDOMException(state, throwScope, NO_MODIFICATION_ALLOWED_ERR);
return false;
}
SVGMatrix& podImpl = impl.propertyReference();
podImpl.setC(nativeValue);
impl.commitChange();
return true;
}
bool setJSSVGMatrixD(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
{
VM& vm = state->vm();
auto throwScope = DECLARE_THROW_SCOPE(vm);
UNUSED_PARAM(throwScope);
JSValue value = JSValue::decode(encodedValue);
UNUSED_PARAM(thisValue);
JSSVGMatrix* castedThis = jsDynamicCast<JSSVGMatrix*>(JSValue::decode(thisValue));
if (UNLIKELY(!castedThis)) {
return throwSetterTypeError(*state, throwScope, "SVGMatrix", "d");
}
auto& impl = castedThis->wrapped();
auto nativeValue = convert<double>(*state, value, ShouldAllowNonFinite::Yes);
RETURN_IF_EXCEPTION(throwScope, false);
if (impl.isReadOnly()) {
setDOMException(state, throwScope, NO_MODIFICATION_ALLOWED_ERR);
return false;
}
SVGMatrix& podImpl = impl.propertyReference();
podImpl.setD(nativeValue);
impl.commitChange();
return true;
}
bool setJSSVGMatrixE(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
{
VM& vm = state->vm();
auto throwScope = DECLARE_THROW_SCOPE(vm);
UNUSED_PARAM(throwScope);
JSValue value = JSValue::decode(encodedValue);
UNUSED_PARAM(thisValue);
JSSVGMatrix* castedThis = jsDynamicCast<JSSVGMatrix*>(JSValue::decode(thisValue));
if (UNLIKELY(!castedThis)) {
return throwSetterTypeError(*state, throwScope, "SVGMatrix", "e");
}
auto& impl = castedThis->wrapped();
auto nativeValue = convert<double>(*state, value, ShouldAllowNonFinite::Yes);
RETURN_IF_EXCEPTION(throwScope, false);
if (impl.isReadOnly()) {
setDOMException(state, throwScope, NO_MODIFICATION_ALLOWED_ERR);
return false;
}
SVGMatrix& podImpl = impl.propertyReference();
podImpl.setE(nativeValue);
impl.commitChange();
return true;
}
bool setJSSVGMatrixF(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
{
VM& vm = state->vm();
auto throwScope = DECLARE_THROW_SCOPE(vm);
UNUSED_PARAM(throwScope);
JSValue value = JSValue::decode(encodedValue);
UNUSED_PARAM(thisValue);
JSSVGMatrix* castedThis = jsDynamicCast<JSSVGMatrix*>(JSValue::decode(thisValue));
if (UNLIKELY(!castedThis)) {
return throwSetterTypeError(*state, throwScope, "SVGMatrix", "f");
}
auto& impl = castedThis->wrapped();
auto nativeValue = convert<double>(*state, value, ShouldAllowNonFinite::Yes);
RETURN_IF_EXCEPTION(throwScope, false);
if (impl.isReadOnly()) {
setDOMException(state, throwScope, NO_MODIFICATION_ALLOWED_ERR);
return false;
}
SVGMatrix& podImpl = impl.propertyReference();
podImpl.setF(nativeValue);
impl.commitChange();
return true;
}
JSValue JSSVGMatrix::getConstructor(VM& vm, const JSGlobalObject* globalObject)
{
return getDOMConstructor<JSSVGMatrixConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject));
}
EncodedJSValue JSC_HOST_CALL jsSVGMatrixPrototypeFunctionMultiply(ExecState* state)
{
VM& vm = state->vm();
auto throwScope = DECLARE_THROW_SCOPE(vm);
UNUSED_PARAM(throwScope);
JSValue thisValue = state->thisValue();
auto castedThis = jsDynamicCast<JSSVGMatrix*>(thisValue);
if (UNLIKELY(!castedThis))
return throwThisTypeError(*state, throwScope, "SVGMatrix", "multiply");
ASSERT_GC_OBJECT_INHERITS(castedThis, JSSVGMatrix::info());
auto& impl = castedThis->wrapped();
if (impl.isReadOnly()) {
setDOMException(state, throwScope, NO_MODIFICATION_ALLOWED_ERR);
return JSValue::encode(jsUndefined());
}
SVGMatrix& podImpl = impl.propertyReference();
if (UNLIKELY(state->argumentCount() < 1))
return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
auto secondMatrix = JSSVGMatrix::toWrapped(state->uncheckedArgument(0));
if (UNLIKELY(!secondMatrix))
return throwArgumentTypeError(*state, throwScope, 0, "secondMatrix", "SVGMatrix", "multiply", "SVGMatrix");
JSValue result = toJS(state, castedThis->globalObject(), SVGPropertyTearOff<SVGMatrix>::create(podImpl.multiply(secondMatrix->propertyReference())));
return JSValue::encode(result);
}
EncodedJSValue JSC_HOST_CALL jsSVGMatrixPrototypeFunctionInverse(ExecState* state)
{
VM& vm = state->vm();
auto throwScope = DECLARE_THROW_SCOPE(vm);
UNUSED_PARAM(throwScope);
JSValue thisValue = state->thisValue();
auto castedThis = jsDynamicCast<JSSVGMatrix*>(thisValue);
if (UNLIKELY(!castedThis))
return throwThisTypeError(*state, throwScope, "SVGMatrix", "inverse");
ASSERT_GC_OBJECT_INHERITS(castedThis, JSSVGMatrix::info());
auto& impl = castedThis->wrapped();
if (impl.isReadOnly()) {
setDOMException(state, throwScope, NO_MODIFICATION_ALLOWED_ERR);
return JSValue::encode(jsUndefined());
}
SVGMatrix& podImpl = impl.propertyReference();
ExceptionCode ec = 0;
JSValue result = toJS(state, castedThis->globalObject(), SVGPropertyTearOff<SVGMatrix>::create(podImpl.inverse(ec)));
setDOMException(state, throwScope, ec);
return JSValue::encode(result);
}
EncodedJSValue JSC_HOST_CALL jsSVGMatrixPrototypeFunctionTranslate(ExecState* state)
{
VM& vm = state->vm();
auto throwScope = DECLARE_THROW_SCOPE(vm);
UNUSED_PARAM(throwScope);
JSValue thisValue = state->thisValue();
auto castedThis = jsDynamicCast<JSSVGMatrix*>(thisValue);
if (UNLIKELY(!castedThis))
return throwThisTypeError(*state, throwScope, "SVGMatrix", "translate");
ASSERT_GC_OBJECT_INHERITS(castedThis, JSSVGMatrix::info());
auto& impl = castedThis->wrapped();
if (impl.isReadOnly()) {
setDOMException(state, throwScope, NO_MODIFICATION_ALLOWED_ERR);
return JSValue::encode(jsUndefined());
}
SVGMatrix& podImpl = impl.propertyReference();
if (UNLIKELY(state->argumentCount() < 2))
return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
auto x = convert<float>(*state, state->uncheckedArgument(0), ShouldAllowNonFinite::Yes);
RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
auto y = convert<float>(*state, state->uncheckedArgument(1), ShouldAllowNonFinite::Yes);
RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
JSValue result = toJS(state, castedThis->globalObject(), SVGPropertyTearOff<SVGMatrix>::create(podImpl.translate(WTFMove(x), WTFMove(y))));
return JSValue::encode(result);
}
EncodedJSValue JSC_HOST_CALL jsSVGMatrixPrototypeFunctionScale(ExecState* state)
{
VM& vm = state->vm();
auto throwScope = DECLARE_THROW_SCOPE(vm);
UNUSED_PARAM(throwScope);
JSValue thisValue = state->thisValue();
auto castedThis = jsDynamicCast<JSSVGMatrix*>(thisValue);
if (UNLIKELY(!castedThis))
return throwThisTypeError(*state, throwScope, "SVGMatrix", "scale");
ASSERT_GC_OBJECT_INHERITS(castedThis, JSSVGMatrix::info());
auto& impl = castedThis->wrapped();
if (impl.isReadOnly()) {
setDOMException(state, throwScope, NO_MODIFICATION_ALLOWED_ERR);
return JSValue::encode(jsUndefined());
}
SVGMatrix& podImpl = impl.propertyReference();
if (UNLIKELY(state->argumentCount() < 1))
return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
auto scaleFactor = convert<float>(*state, state->uncheckedArgument(0), ShouldAllowNonFinite::Yes);
RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
JSValue result = toJS(state, castedThis->globalObject(), SVGPropertyTearOff<SVGMatrix>::create(podImpl.scale(WTFMove(scaleFactor))));
return JSValue::encode(result);
}
EncodedJSValue JSC_HOST_CALL jsSVGMatrixPrototypeFunctionScaleNonUniform(ExecState* state)
{
VM& vm = state->vm();
auto throwScope = DECLARE_THROW_SCOPE(vm);
UNUSED_PARAM(throwScope);
JSValue thisValue = state->thisValue();
auto castedThis = jsDynamicCast<JSSVGMatrix*>(thisValue);
if (UNLIKELY(!castedThis))
return throwThisTypeError(*state, throwScope, "SVGMatrix", "scaleNonUniform");
ASSERT_GC_OBJECT_INHERITS(castedThis, JSSVGMatrix::info());
auto& impl = castedThis->wrapped();
if (impl.isReadOnly()) {
setDOMException(state, throwScope, NO_MODIFICATION_ALLOWED_ERR);
return JSValue::encode(jsUndefined());
}
SVGMatrix& podImpl = impl.propertyReference();
if (UNLIKELY(state->argumentCount() < 2))
return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
auto scaleFactorX = convert<float>(*state, state->uncheckedArgument(0), ShouldAllowNonFinite::Yes);
RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
auto scaleFactorY = convert<float>(*state, state->uncheckedArgument(1), ShouldAllowNonFinite::Yes);
RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
JSValue result = toJS(state, castedThis->globalObject(), SVGPropertyTearOff<SVGMatrix>::create(podImpl.scaleNonUniform(WTFMove(scaleFactorX), WTFMove(scaleFactorY))));
return JSValue::encode(result);
}
EncodedJSValue JSC_HOST_CALL jsSVGMatrixPrototypeFunctionRotate(ExecState* state)
{
VM& vm = state->vm();
auto throwScope = DECLARE_THROW_SCOPE(vm);
UNUSED_PARAM(throwScope);
JSValue thisValue = state->thisValue();
auto castedThis = jsDynamicCast<JSSVGMatrix*>(thisValue);
if (UNLIKELY(!castedThis))
return throwThisTypeError(*state, throwScope, "SVGMatrix", "rotate");
ASSERT_GC_OBJECT_INHERITS(castedThis, JSSVGMatrix::info());
auto& impl = castedThis->wrapped();
if (impl.isReadOnly()) {
setDOMException(state, throwScope, NO_MODIFICATION_ALLOWED_ERR);
return JSValue::encode(jsUndefined());
}
SVGMatrix& podImpl = impl.propertyReference();
if (UNLIKELY(state->argumentCount() < 1))
return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
auto angle = convert<float>(*state, state->uncheckedArgument(0), ShouldAllowNonFinite::Yes);
RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
JSValue result = toJS(state, castedThis->globalObject(), SVGPropertyTearOff<SVGMatrix>::create(podImpl.rotate(WTFMove(angle))));
return JSValue::encode(result);
}
EncodedJSValue JSC_HOST_CALL jsSVGMatrixPrototypeFunctionRotateFromVector(ExecState* state)
{
VM& vm = state->vm();
auto throwScope = DECLARE_THROW_SCOPE(vm);
UNUSED_PARAM(throwScope);
JSValue thisValue = state->thisValue();
auto castedThis = jsDynamicCast<JSSVGMatrix*>(thisValue);
if (UNLIKELY(!castedThis))
return throwThisTypeError(*state, throwScope, "SVGMatrix", "rotateFromVector");
ASSERT_GC_OBJECT_INHERITS(castedThis, JSSVGMatrix::info());
auto& impl = castedThis->wrapped();
if (impl.isReadOnly()) {
setDOMException(state, throwScope, NO_MODIFICATION_ALLOWED_ERR);
return JSValue::encode(jsUndefined());
}
SVGMatrix& podImpl = impl.propertyReference();
if (UNLIKELY(state->argumentCount() < 2))
return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
ExceptionCode ec = 0;
auto x = convert<float>(*state, state->uncheckedArgument(0), ShouldAllowNonFinite::Yes);
RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
auto y = convert<float>(*state, state->uncheckedArgument(1), ShouldAllowNonFinite::Yes);
RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
JSValue result = toJS(state, castedThis->globalObject(), SVGPropertyTearOff<SVGMatrix>::create(podImpl.rotateFromVector(WTFMove(x), WTFMove(y), ec)));
setDOMException(state, throwScope, ec);
return JSValue::encode(result);
}
EncodedJSValue JSC_HOST_CALL jsSVGMatrixPrototypeFunctionFlipX(ExecState* state)
{
VM& vm = state->vm();
auto throwScope = DECLARE_THROW_SCOPE(vm);
UNUSED_PARAM(throwScope);
JSValue thisValue = state->thisValue();
auto castedThis = jsDynamicCast<JSSVGMatrix*>(thisValue);
if (UNLIKELY(!castedThis))
return throwThisTypeError(*state, throwScope, "SVGMatrix", "flipX");
ASSERT_GC_OBJECT_INHERITS(castedThis, JSSVGMatrix::info());
auto& impl = castedThis->wrapped();
if (impl.isReadOnly()) {
setDOMException(state, throwScope, NO_MODIFICATION_ALLOWED_ERR);
return JSValue::encode(jsUndefined());
}
SVGMatrix& podImpl = impl.propertyReference();
JSValue result = toJS(state, castedThis->globalObject(), SVGPropertyTearOff<SVGMatrix>::create(podImpl.flipX()));
return JSValue::encode(result);
}
EncodedJSValue JSC_HOST_CALL jsSVGMatrixPrototypeFunctionFlipY(ExecState* state)
{
VM& vm = state->vm();
auto throwScope = DECLARE_THROW_SCOPE(vm);
UNUSED_PARAM(throwScope);
JSValue thisValue = state->thisValue();
auto castedThis = jsDynamicCast<JSSVGMatrix*>(thisValue);
if (UNLIKELY(!castedThis))
return throwThisTypeError(*state, throwScope, "SVGMatrix", "flipY");
ASSERT_GC_OBJECT_INHERITS(castedThis, JSSVGMatrix::info());
auto& impl = castedThis->wrapped();
if (impl.isReadOnly()) {
setDOMException(state, throwScope, NO_MODIFICATION_ALLOWED_ERR);
return JSValue::encode(jsUndefined());
}
SVGMatrix& podImpl = impl.propertyReference();
JSValue result = toJS(state, castedThis->globalObject(), SVGPropertyTearOff<SVGMatrix>::create(podImpl.flipY()));
return JSValue::encode(result);
}
EncodedJSValue JSC_HOST_CALL jsSVGMatrixPrototypeFunctionSkewX(ExecState* state)
{
VM& vm = state->vm();
auto throwScope = DECLARE_THROW_SCOPE(vm);
UNUSED_PARAM(throwScope);
JSValue thisValue = state->thisValue();
auto castedThis = jsDynamicCast<JSSVGMatrix*>(thisValue);
if (UNLIKELY(!castedThis))
return throwThisTypeError(*state, throwScope, "SVGMatrix", "skewX");
ASSERT_GC_OBJECT_INHERITS(castedThis, JSSVGMatrix::info());
auto& impl = castedThis->wrapped();
if (impl.isReadOnly()) {
setDOMException(state, throwScope, NO_MODIFICATION_ALLOWED_ERR);
return JSValue::encode(jsUndefined());
}
SVGMatrix& podImpl = impl.propertyReference();
if (UNLIKELY(state->argumentCount() < 1))
return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
auto angle = convert<float>(*state, state->uncheckedArgument(0), ShouldAllowNonFinite::Yes);
RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
JSValue result = toJS(state, castedThis->globalObject(), SVGPropertyTearOff<SVGMatrix>::create(podImpl.skewX(WTFMove(angle))));
return JSValue::encode(result);
}
EncodedJSValue JSC_HOST_CALL jsSVGMatrixPrototypeFunctionSkewY(ExecState* state)
{
VM& vm = state->vm();
auto throwScope = DECLARE_THROW_SCOPE(vm);
UNUSED_PARAM(throwScope);
JSValue thisValue = state->thisValue();
auto castedThis = jsDynamicCast<JSSVGMatrix*>(thisValue);
if (UNLIKELY(!castedThis))
return throwThisTypeError(*state, throwScope, "SVGMatrix", "skewY");
ASSERT_GC_OBJECT_INHERITS(castedThis, JSSVGMatrix::info());
auto& impl = castedThis->wrapped();
if (impl.isReadOnly()) {
setDOMException(state, throwScope, NO_MODIFICATION_ALLOWED_ERR);
return JSValue::encode(jsUndefined());
}
SVGMatrix& podImpl = impl.propertyReference();
if (UNLIKELY(state->argumentCount() < 1))
return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
auto angle = convert<float>(*state, state->uncheckedArgument(0), ShouldAllowNonFinite::Yes);
RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
JSValue result = toJS(state, castedThis->globalObject(), SVGPropertyTearOff<SVGMatrix>::create(podImpl.skewY(WTFMove(angle))));
return JSValue::encode(result);
}
bool JSSVGMatrixOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor)
{
UNUSED_PARAM(handle);
UNUSED_PARAM(visitor);
return false;
}
void JSSVGMatrixOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context)
{
auto* jsSVGMatrix = jsCast<JSSVGMatrix*>(handle.slot()->asCell());
auto& world = *static_cast<DOMWrapperWorld*>(context);
uncacheWrapper(world, &jsSVGMatrix->wrapped(), jsSVGMatrix);
}
JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject* globalObject, Ref<SVGPropertyTearOff<SVGMatrix>>&& impl)
{
return createWrapper<SVGPropertyTearOff<SVGMatrix>>(globalObject, WTFMove(impl));
}
JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, SVGPropertyTearOff<SVGMatrix>& impl)
{
return wrap(state, globalObject, impl);
}
SVGPropertyTearOff<SVGMatrix>* JSSVGMatrix::toWrapped(JSC::JSValue value)
{
if (auto* wrapper = jsDynamicCast<JSSVGMatrix*>(value))
return &wrapper->wrapped();
return nullptr;
}
}