blob: c4871fbf314f5aa40adb27257cbfd7ef2e8134f3 [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(WEB_ANIMATIONS)
#include "JSKeyframeEffect.h"
#include "ExceptionCode.h"
#include "JSDOMBinding.h"
#include "JSDOMConstructor.h"
#include <runtime/Error.h>
#include <wtf/GetPtr.h>
#if ENABLE(WEB_ANIMATIONS)
#include "JSElement.h"
#endif
using namespace JSC;
namespace WebCore {
// Attributes
JSC::EncodedJSValue jsKeyframeEffectConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
bool setJSKeyframeEffectConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
class JSKeyframeEffectPrototype : public JSC::JSNonFinalObject {
public:
typedef JSC::JSNonFinalObject Base;
static JSKeyframeEffectPrototype* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure)
{
JSKeyframeEffectPrototype* ptr = new (NotNull, JSC::allocateCell<JSKeyframeEffectPrototype>(vm.heap)) JSKeyframeEffectPrototype(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:
JSKeyframeEffectPrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure)
: JSC::JSNonFinalObject(vm, structure)
{
}
void finishCreation(JSC::VM&);
};
typedef JSDOMConstructor<JSKeyframeEffect> JSKeyframeEffectConstructor;
template<> EncodedJSValue JSC_HOST_CALL JSKeyframeEffectConstructor::construct(ExecState* state)
{
VM& vm = state->vm();
auto throwScope = DECLARE_THROW_SCOPE(vm);
UNUSED_PARAM(throwScope);
auto* castedThis = jsCast<JSKeyframeEffectConstructor*>(state->callee());
ASSERT(castedThis);
if (UNLIKELY(state->argumentCount() < 1))
return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
Element* target = nullptr;
if (!state->uncheckedArgument(0).isUndefinedOrNull()) {
target = JSElement::toWrapped(state->uncheckedArgument(0));
if (UNLIKELY(!target))
return throwArgumentTypeError(*state, throwScope, 0, "target", "KeyframeEffect", nullptr, "Element");
}
auto object = KeyframeEffect::create(WTFMove(target));
return JSValue::encode(toJSNewlyCreated(state, castedThis->globalObject(), WTFMove(object)));
}
template<> JSValue JSKeyframeEffectConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject)
{
return JSAnimationEffect::getConstructor(vm, &globalObject);
}
template<> void JSKeyframeEffectConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject)
{
putDirect(vm, vm.propertyNames->prototype, JSKeyframeEffect::prototype(vm, &globalObject), DontDelete | ReadOnly | DontEnum);
putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String(ASCIILiteral("KeyframeEffect"))), ReadOnly | DontEnum);
putDirect(vm, vm.propertyNames->length, jsNumber(1), ReadOnly | DontEnum);
}
template<> const ClassInfo JSKeyframeEffectConstructor::s_info = { "KeyframeEffect", &Base::s_info, 0, CREATE_METHOD_TABLE(JSKeyframeEffectConstructor) };
/* Hash table for prototype */
static const HashTableValue JSKeyframeEffectPrototypeTableValues[] =
{
{ "constructor", DontEnum, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsKeyframeEffectConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSKeyframeEffectConstructor) } },
};
const ClassInfo JSKeyframeEffectPrototype::s_info = { "KeyframeEffectPrototype", &Base::s_info, 0, CREATE_METHOD_TABLE(JSKeyframeEffectPrototype) };
void JSKeyframeEffectPrototype::finishCreation(VM& vm)
{
Base::finishCreation(vm);
reifyStaticProperties(vm, JSKeyframeEffectPrototypeTableValues, *this);
}
const ClassInfo JSKeyframeEffect::s_info = { "KeyframeEffect", &Base::s_info, 0, CREATE_METHOD_TABLE(JSKeyframeEffect) };
JSKeyframeEffect::JSKeyframeEffect(Structure* structure, JSDOMGlobalObject& globalObject, Ref<KeyframeEffect>&& impl)
: JSAnimationEffect(structure, globalObject, WTFMove(impl))
{
}
JSObject* JSKeyframeEffect::createPrototype(VM& vm, JSGlobalObject* globalObject)
{
return JSKeyframeEffectPrototype::create(vm, globalObject, JSKeyframeEffectPrototype::createStructure(vm, globalObject, JSAnimationEffect::prototype(vm, globalObject)));
}
JSObject* JSKeyframeEffect::prototype(VM& vm, JSGlobalObject* globalObject)
{
return getDOMPrototype<JSKeyframeEffect>(vm, globalObject);
}
EncodedJSValue jsKeyframeEffectConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName)
{
VM& vm = state->vm();
auto throwScope = DECLARE_THROW_SCOPE(vm);
JSKeyframeEffectPrototype* domObject = jsDynamicCast<JSKeyframeEffectPrototype*>(JSValue::decode(thisValue));
if (UNLIKELY(!domObject))
return throwVMTypeError(state, throwScope);
return JSValue::encode(JSKeyframeEffect::getConstructor(state->vm(), domObject->globalObject()));
}
bool setJSKeyframeEffectConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
{
VM& vm = state->vm();
auto throwScope = DECLARE_THROW_SCOPE(vm);
JSValue value = JSValue::decode(encodedValue);
JSKeyframeEffectPrototype* domObject = jsDynamicCast<JSKeyframeEffectPrototype*>(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 JSKeyframeEffect::getConstructor(VM& vm, const JSGlobalObject* globalObject)
{
return getDOMConstructor<JSKeyframeEffectConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject));
}
#if ENABLE(BINDING_INTEGRITY)
#if PLATFORM(WIN)
#pragma warning(disable: 4483)
extern "C" { extern void (*const __identifier("??_7KeyframeEffect@WebCore@@6B@")[])(); }
#else
extern "C" { extern void* _ZTVN7WebCore14KeyframeEffectE[]; }
#endif
#endif
JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject* globalObject, Ref<KeyframeEffect>&& impl)
{
#if ENABLE(BINDING_INTEGRITY)
void* actualVTablePointer = *(reinterpret_cast<void**>(impl.ptr()));
#if PLATFORM(WIN)
void* expectedVTablePointer = reinterpret_cast<void*>(__identifier("??_7KeyframeEffect@WebCore@@6B@"));
#else
void* expectedVTablePointer = &_ZTVN7WebCore14KeyframeEffectE[2];
#if COMPILER(CLANG)
// If this fails KeyframeEffect does not have a vtable, so you need to add the
// ImplementationLacksVTable attribute to the interface definition
static_assert(__is_polymorphic(KeyframeEffect), "KeyframeEffect is not polymorphic");
#endif
#endif
// If you hit this assertion you either have a use after free bug, or
// KeyframeEffect has subclasses. If KeyframeEffect has subclasses that get passed
// to toJS() we currently require KeyframeEffect you to opt out of binding hardening
// by adding the SkipVTableValidation attribute to the interface IDL definition
RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer);
#endif
return createWrapper<KeyframeEffect>(globalObject, WTFMove(impl));
}
JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, KeyframeEffect& impl)
{
return wrap(state, globalObject, impl);
}
}
#endif // ENABLE(WEB_ANIMATIONS)