blob: 29c89d3f64e4c23ed685d6f1fc10b8d7423fee36 [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 "JSWebKitTransitionEvent.h"
#include "JSDOMBinding.h"
#include "JSDOMConstructor.h"
#include "JSDictionary.h"
#include "URL.h"
#include <runtime/Error.h>
#include <runtime/JSString.h>
#include <wtf/GetPtr.h>
using namespace JSC;
namespace WebCore {
// Attributes
JSC::EncodedJSValue jsWebKitTransitionEventPropertyName(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
JSC::EncodedJSValue jsWebKitTransitionEventElapsedTime(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
JSC::EncodedJSValue jsWebKitTransitionEventPseudoElement(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
JSC::EncodedJSValue jsWebKitTransitionEventConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
bool setJSWebKitTransitionEventConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
class JSWebKitTransitionEventPrototype : public JSC::JSNonFinalObject {
public:
typedef JSC::JSNonFinalObject Base;
static JSWebKitTransitionEventPrototype* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure)
{
JSWebKitTransitionEventPrototype* ptr = new (NotNull, JSC::allocateCell<JSWebKitTransitionEventPrototype>(vm.heap)) JSWebKitTransitionEventPrototype(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:
JSWebKitTransitionEventPrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure)
: JSC::JSNonFinalObject(vm, structure)
{
}
void finishCreation(JSC::VM&);
};
typedef JSDOMConstructor<JSWebKitTransitionEvent> JSWebKitTransitionEventConstructor;
template<> EncodedJSValue JSC_HOST_CALL JSWebKitTransitionEventConstructor::construct(ExecState* state)
{
VM& vm = state->vm();
auto throwScope = DECLARE_THROW_SCOPE(vm);
auto* jsConstructor = jsCast<JSWebKitTransitionEventConstructor*>(state->callee());
ASSERT(jsConstructor);
if (!jsConstructor->scriptExecutionContext())
return throwConstructorScriptExecutionContextUnavailableError(*state, throwScope, "WebKitTransitionEvent");
if (UNLIKELY(state->argumentCount() < 1))
return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
AtomicString eventType = state->uncheckedArgument(0).toString(state)->toAtomicString(state);
RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
WebKitTransitionEventInit eventInit;
JSValue initializerValue = state->argument(1);
if (!initializerValue.isUndefinedOrNull()) {
// Given the above test, this will always yield an object.
JSObject* initializerObject = initializerValue.toObject(state);
ASSERT(!throwScope.exception());
// Create the dictionary wrapper from the initializer object.
JSDictionary dictionary(state, initializerObject);
// Attempt to fill in the EventInit.
if (!fillWebKitTransitionEventInit(eventInit, dictionary))
return JSValue::encode(jsUndefined());
}
Ref<WebKitTransitionEvent> event = WebKitTransitionEvent::createForBindings(eventType, eventInit);
return JSValue::encode(createWrapper<WebKitTransitionEvent>(jsConstructor->globalObject(), WTFMove(event)));
}
bool fillWebKitTransitionEventInit(WebKitTransitionEventInit& eventInit, JSDictionary& dictionary)
{
if (!fillEventInit(eventInit, dictionary))
return false;
if (!dictionary.tryGetProperty("propertyName", eventInit.propertyName))
return false;
if (!dictionary.tryGetProperty("elapsedTime", eventInit.elapsedTime))
return false;
if (!dictionary.tryGetProperty("pseudoElement", eventInit.pseudoElement))
return false;
return true;
}
template<> JSValue JSWebKitTransitionEventConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject)
{
return JSEvent::getConstructor(vm, &globalObject);
}
template<> void JSWebKitTransitionEventConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject)
{
putDirect(vm, vm.propertyNames->prototype, JSWebKitTransitionEvent::prototype(vm, &globalObject), DontDelete | ReadOnly | DontEnum);
putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String(ASCIILiteral("WebKitTransitionEvent"))), ReadOnly | DontEnum);
putDirect(vm, vm.propertyNames->length, jsNumber(1), ReadOnly | DontEnum);
}
template<> const ClassInfo JSWebKitTransitionEventConstructor::s_info = { "WebKitTransitionEvent", &Base::s_info, 0, CREATE_METHOD_TABLE(JSWebKitTransitionEventConstructor) };
/* Hash table for prototype */
static const HashTableValue JSWebKitTransitionEventPrototypeTableValues[] =
{
{ "constructor", DontEnum, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsWebKitTransitionEventConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSWebKitTransitionEventConstructor) } },
{ "propertyName", ReadOnly | CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsWebKitTransitionEventPropertyName), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
{ "elapsedTime", ReadOnly | CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsWebKitTransitionEventElapsedTime), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
{ "pseudoElement", ReadOnly | CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsWebKitTransitionEventPseudoElement), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
};
const ClassInfo JSWebKitTransitionEventPrototype::s_info = { "WebKitTransitionEventPrototype", &Base::s_info, 0, CREATE_METHOD_TABLE(JSWebKitTransitionEventPrototype) };
void JSWebKitTransitionEventPrototype::finishCreation(VM& vm)
{
Base::finishCreation(vm);
reifyStaticProperties(vm, JSWebKitTransitionEventPrototypeTableValues, *this);
}
const ClassInfo JSWebKitTransitionEvent::s_info = { "WebKitTransitionEvent", &Base::s_info, 0, CREATE_METHOD_TABLE(JSWebKitTransitionEvent) };
JSWebKitTransitionEvent::JSWebKitTransitionEvent(Structure* structure, JSDOMGlobalObject& globalObject, Ref<WebKitTransitionEvent>&& impl)
: JSEvent(structure, globalObject, WTFMove(impl))
{
}
JSObject* JSWebKitTransitionEvent::createPrototype(VM& vm, JSGlobalObject* globalObject)
{
return JSWebKitTransitionEventPrototype::create(vm, globalObject, JSWebKitTransitionEventPrototype::createStructure(vm, globalObject, JSEvent::prototype(vm, globalObject)));
}
JSObject* JSWebKitTransitionEvent::prototype(VM& vm, JSGlobalObject* globalObject)
{
return getDOMPrototype<JSWebKitTransitionEvent>(vm, globalObject);
}
EncodedJSValue jsWebKitTransitionEventPropertyName(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<JSWebKitTransitionEvent*>(decodedThisValue);
if (UNLIKELY(!castedThis)) {
return throwGetterTypeError(*state, throwScope, "WebKitTransitionEvent", "propertyName");
}
auto& impl = castedThis->wrapped();
JSValue result = jsStringWithCache(state, impl.propertyName());
return JSValue::encode(result);
}
EncodedJSValue jsWebKitTransitionEventElapsedTime(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<JSWebKitTransitionEvent*>(decodedThisValue);
if (UNLIKELY(!castedThis)) {
return throwGetterTypeError(*state, throwScope, "WebKitTransitionEvent", "elapsedTime");
}
auto& impl = castedThis->wrapped();
JSValue result = jsNumber(impl.elapsedTime());
return JSValue::encode(result);
}
EncodedJSValue jsWebKitTransitionEventPseudoElement(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<JSWebKitTransitionEvent*>(decodedThisValue);
if (UNLIKELY(!castedThis)) {
return throwGetterTypeError(*state, throwScope, "WebKitTransitionEvent", "pseudoElement");
}
auto& impl = castedThis->wrapped();
JSValue result = jsStringWithCache(state, impl.pseudoElement());
return JSValue::encode(result);
}
EncodedJSValue jsWebKitTransitionEventConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName)
{
VM& vm = state->vm();
auto throwScope = DECLARE_THROW_SCOPE(vm);
JSWebKitTransitionEventPrototype* domObject = jsDynamicCast<JSWebKitTransitionEventPrototype*>(JSValue::decode(thisValue));
if (UNLIKELY(!domObject))
return throwVMTypeError(state, throwScope);
return JSValue::encode(JSWebKitTransitionEvent::getConstructor(state->vm(), domObject->globalObject()));
}
bool setJSWebKitTransitionEventConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
{
VM& vm = state->vm();
auto throwScope = DECLARE_THROW_SCOPE(vm);
JSValue value = JSValue::decode(encodedValue);
JSWebKitTransitionEventPrototype* domObject = jsDynamicCast<JSWebKitTransitionEventPrototype*>(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 JSWebKitTransitionEvent::getConstructor(VM& vm, const JSGlobalObject* globalObject)
{
return getDOMConstructor<JSWebKitTransitionEventConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject));
}
}