blob: bd67a429a011c23ba60ce6af58d3864a1d1eb087 [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"
#if ENABLE(DEVICE_ORIENTATION)
#include "JSDeviceOrientationEvent.h"
#include "JSDOMBinding.h"
#include "JSDOMConstructor.h"
#include <runtime/Error.h>
#include <wtf/GetPtr.h>
using namespace JSC;
namespace WebCore {
// Functions
JSC::EncodedJSValue JSC_HOST_CALL jsDeviceOrientationEventPrototypeFunctionInitDeviceOrientationEvent(JSC::ExecState*);
// Attributes
JSC::EncodedJSValue jsDeviceOrientationEventAlpha(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
JSC::EncodedJSValue jsDeviceOrientationEventBeta(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
JSC::EncodedJSValue jsDeviceOrientationEventGamma(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
JSC::EncodedJSValue jsDeviceOrientationEventAbsolute(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
JSC::EncodedJSValue jsDeviceOrientationEventConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
bool setJSDeviceOrientationEventConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
class JSDeviceOrientationEventPrototype : public JSC::JSNonFinalObject {
public:
typedef JSC::JSNonFinalObject Base;
static JSDeviceOrientationEventPrototype* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure)
{
JSDeviceOrientationEventPrototype* ptr = new (NotNull, JSC::allocateCell<JSDeviceOrientationEventPrototype>(vm.heap)) JSDeviceOrientationEventPrototype(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:
JSDeviceOrientationEventPrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure)
: JSC::JSNonFinalObject(vm, structure)
{
}
void finishCreation(JSC::VM&);
};
typedef JSDOMConstructorNotConstructable<JSDeviceOrientationEvent> JSDeviceOrientationEventConstructor;
template<> JSValue JSDeviceOrientationEventConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject)
{
return JSEvent::getConstructor(vm, &globalObject);
}
template<> void JSDeviceOrientationEventConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject)
{
putDirect(vm, vm.propertyNames->prototype, JSDeviceOrientationEvent::prototype(vm, &globalObject), DontDelete | ReadOnly | DontEnum);
putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String(ASCIILiteral("DeviceOrientationEvent"))), ReadOnly | DontEnum);
putDirect(vm, vm.propertyNames->length, jsNumber(0), ReadOnly | DontEnum);
}
template<> const ClassInfo JSDeviceOrientationEventConstructor::s_info = { "DeviceOrientationEvent", &Base::s_info, 0, CREATE_METHOD_TABLE(JSDeviceOrientationEventConstructor) };
/* Hash table for prototype */
static const HashTableValue JSDeviceOrientationEventPrototypeTableValues[] =
{
{ "constructor", DontEnum, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsDeviceOrientationEventConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSDeviceOrientationEventConstructor) } },
{ "alpha", ReadOnly | CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsDeviceOrientationEventAlpha), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
{ "beta", ReadOnly | CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsDeviceOrientationEventBeta), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
{ "gamma", ReadOnly | CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsDeviceOrientationEventGamma), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
{ "absolute", ReadOnly | CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsDeviceOrientationEventAbsolute), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
{ "initDeviceOrientationEvent", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsDeviceOrientationEventPrototypeFunctionInitDeviceOrientationEvent), (intptr_t) (0) } },
};
const ClassInfo JSDeviceOrientationEventPrototype::s_info = { "DeviceOrientationEventPrototype", &Base::s_info, 0, CREATE_METHOD_TABLE(JSDeviceOrientationEventPrototype) };
void JSDeviceOrientationEventPrototype::finishCreation(VM& vm)
{
Base::finishCreation(vm);
reifyStaticProperties(vm, JSDeviceOrientationEventPrototypeTableValues, *this);
}
const ClassInfo JSDeviceOrientationEvent::s_info = { "DeviceOrientationEvent", &Base::s_info, 0, CREATE_METHOD_TABLE(JSDeviceOrientationEvent) };
JSDeviceOrientationEvent::JSDeviceOrientationEvent(Structure* structure, JSDOMGlobalObject& globalObject, Ref<DeviceOrientationEvent>&& impl)
: JSEvent(structure, globalObject, WTFMove(impl))
{
}
JSObject* JSDeviceOrientationEvent::createPrototype(VM& vm, JSGlobalObject* globalObject)
{
return JSDeviceOrientationEventPrototype::create(vm, globalObject, JSDeviceOrientationEventPrototype::createStructure(vm, globalObject, JSEvent::prototype(vm, globalObject)));
}
JSObject* JSDeviceOrientationEvent::prototype(VM& vm, JSGlobalObject* globalObject)
{
return getDOMPrototype<JSDeviceOrientationEvent>(vm, globalObject);
}
EncodedJSValue jsDeviceOrientationEventAlpha(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<JSDeviceOrientationEvent*>(decodedThisValue);
if (UNLIKELY(!castedThis)) {
return throwGetterTypeError(*state, throwScope, "DeviceOrientationEvent", "alpha");
}
return JSValue::encode(castedThis->alpha(*state));
}
EncodedJSValue jsDeviceOrientationEventBeta(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<JSDeviceOrientationEvent*>(decodedThisValue);
if (UNLIKELY(!castedThis)) {
return throwGetterTypeError(*state, throwScope, "DeviceOrientationEvent", "beta");
}
return JSValue::encode(castedThis->beta(*state));
}
EncodedJSValue jsDeviceOrientationEventGamma(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<JSDeviceOrientationEvent*>(decodedThisValue);
if (UNLIKELY(!castedThis)) {
return throwGetterTypeError(*state, throwScope, "DeviceOrientationEvent", "gamma");
}
return JSValue::encode(castedThis->gamma(*state));
}
EncodedJSValue jsDeviceOrientationEventAbsolute(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<JSDeviceOrientationEvent*>(decodedThisValue);
if (UNLIKELY(!castedThis)) {
return throwGetterTypeError(*state, throwScope, "DeviceOrientationEvent", "absolute");
}
return JSValue::encode(castedThis->absolute(*state));
}
EncodedJSValue jsDeviceOrientationEventConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName)
{
VM& vm = state->vm();
auto throwScope = DECLARE_THROW_SCOPE(vm);
JSDeviceOrientationEventPrototype* domObject = jsDynamicCast<JSDeviceOrientationEventPrototype*>(JSValue::decode(thisValue));
if (UNLIKELY(!domObject))
return throwVMTypeError(state, throwScope);
return JSValue::encode(JSDeviceOrientationEvent::getConstructor(state->vm(), domObject->globalObject()));
}
bool setJSDeviceOrientationEventConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
{
VM& vm = state->vm();
auto throwScope = DECLARE_THROW_SCOPE(vm);
JSValue value = JSValue::decode(encodedValue);
JSDeviceOrientationEventPrototype* domObject = jsDynamicCast<JSDeviceOrientationEventPrototype*>(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);
}
JSValue JSDeviceOrientationEvent::getConstructor(VM& vm, const JSGlobalObject* globalObject)
{
return getDOMConstructor<JSDeviceOrientationEventConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject));
}
EncodedJSValue JSC_HOST_CALL jsDeviceOrientationEventPrototypeFunctionInitDeviceOrientationEvent(ExecState* state)
{
VM& vm = state->vm();
auto throwScope = DECLARE_THROW_SCOPE(vm);
UNUSED_PARAM(throwScope);
JSValue thisValue = state->thisValue();
auto castedThis = jsDynamicCast<JSDeviceOrientationEvent*>(thisValue);
if (UNLIKELY(!castedThis))
return throwThisTypeError(*state, throwScope, "DeviceOrientationEvent", "initDeviceOrientationEvent");
ASSERT_GC_OBJECT_INHERITS(castedThis, JSDeviceOrientationEvent::info());
return JSValue::encode(castedThis->initDeviceOrientationEvent(*state));
}
}
#endif // ENABLE(DEVICE_ORIENTATION)