2 This file is part of the WebKit open source project.
3 This file has been generated by generate-bindings.pl. DO NOT MODIFY!
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version.
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details.
15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA.
22 #include "JSWebKitAnimationEvent.h"
24 #include "ExceptionCode.h"
25 #include "JSDOMBinding.h"
26 #include "JSDictionary.h"
28 #include "WebKitAnimationEvent.h"
29 #include <runtime/Error.h>
30 #include <runtime/JSString.h>
31 #include <wtf/GetPtr.h>
37 ASSERT_CLASS_FITS_IN_CELL(JSWebKitAnimationEvent);
41 #define THUNK_GENERATOR(generator) , generator
43 #define THUNK_GENERATOR(generator)
46 #define INTRINSIC(intrinsic) , intrinsic
48 #define INTRINSIC(intrinsic)
51 static const HashTableValue JSWebKitAnimationEventTableValues[] =
53 { "animationName", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsWebKitAnimationEventAnimationName), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
54 { "elapsedTime", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsWebKitAnimationEventElapsedTime), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
55 { "constructor", DontEnum | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsWebKitAnimationEventConstructor), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
56 { 0, 0, 0, 0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) }
59 #undef THUNK_GENERATOR
60 static const HashTable JSWebKitAnimationEventTable = { 9, 7, JSWebKitAnimationEventTableValues, 0 };
61 /* Hash table for constructor */
63 #define THUNK_GENERATOR(generator) , generator
65 #define THUNK_GENERATOR(generator)
68 #define INTRINSIC(intrinsic) , intrinsic
70 #define INTRINSIC(intrinsic)
73 static const HashTableValue JSWebKitAnimationEventConstructorTableValues[] =
75 { 0, 0, 0, 0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) }
78 #undef THUNK_GENERATOR
79 static const HashTable JSWebKitAnimationEventConstructorTable = { 1, 0, JSWebKitAnimationEventConstructorTableValues, 0 };
80 const ClassInfo JSWebKitAnimationEventConstructor::s_info = { "WebKitAnimationEventConstructor", &DOMConstructorObject::s_info, &JSWebKitAnimationEventConstructorTable, 0, CREATE_METHOD_TABLE(JSWebKitAnimationEventConstructor) };
82 JSWebKitAnimationEventConstructor::JSWebKitAnimationEventConstructor(Structure* structure, JSDOMGlobalObject* globalObject)
83 : DOMConstructorObject(structure, globalObject)
87 void JSWebKitAnimationEventConstructor::finishCreation(ExecState* exec, JSDOMGlobalObject* globalObject)
89 Base::finishCreation(exec->globalData());
90 ASSERT(inherits(&s_info));
91 putDirect(exec->globalData(), exec->propertyNames().prototype, JSWebKitAnimationEventPrototype::self(exec, globalObject), DontDelete | ReadOnly);
94 bool JSWebKitAnimationEventConstructor::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
96 return getStaticValueSlot<JSWebKitAnimationEventConstructor, JSDOMWrapper>(exec, &JSWebKitAnimationEventConstructorTable, static_cast<JSWebKitAnimationEventConstructor*>(cell), propertyName, slot);
99 bool JSWebKitAnimationEventConstructor::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
101 return getStaticValueDescriptor<JSWebKitAnimationEventConstructor, JSDOMWrapper>(exec, &JSWebKitAnimationEventConstructorTable, static_cast<JSWebKitAnimationEventConstructor*>(object), propertyName, descriptor);
104 EncodedJSValue JSC_HOST_CALL JSWebKitAnimationEventConstructor::constructJSWebKitAnimationEvent(ExecState* exec)
106 JSWebKitAnimationEventConstructor* jsConstructor = static_cast<JSWebKitAnimationEventConstructor*>(exec->callee());
108 ScriptExecutionContext* executionContext = jsConstructor->scriptExecutionContext();
109 if (!executionContext)
110 return throwVMError(exec, createReferenceError(exec, "Constructor associated execution context is unavailable"));
112 AtomicString eventType = ustringToAtomicString(exec->argument(0).toString(exec));
113 if (exec->hadException())
114 return JSValue::encode(jsUndefined());
116 WebKitAnimationEventInit eventInit;
118 JSValue initializerValue = exec->argument(1);
119 if (!initializerValue.isUndefinedOrNull()) {
120 // Given the above test, this will always yield an object.
121 JSObject* initializerObject = initializerValue.toObject(exec);
123 // Create the dictionary wrapper from the initializer object.
124 JSDictionary dictionary(exec, initializerObject);
126 // Attempt to fill in the EventInit.
127 if (!fillWebKitAnimationEventInit(eventInit, dictionary))
128 return JSValue::encode(jsUndefined());
131 RefPtr<WebKitAnimationEvent> event = WebKitAnimationEvent::create(eventType, eventInit);
132 return JSValue::encode(toJS(exec, jsConstructor->globalObject(), event.get()));
135 bool fillWebKitAnimationEventInit(WebKitAnimationEventInit& eventInit, JSDictionary& dictionary)
137 if (!fillEventInit(eventInit, dictionary))
140 if (!dictionary.tryGetProperty("animationName", eventInit.animationName))
142 if (!dictionary.tryGetProperty("elapsedTime", eventInit.elapsedTime))
147 ConstructType JSWebKitAnimationEventConstructor::getConstructData(JSCell*, ConstructData& constructData)
149 constructData.native.function = constructJSWebKitAnimationEvent;
150 return ConstructTypeHost;
153 /* Hash table for prototype */
155 #define THUNK_GENERATOR(generator) , generator
157 #define THUNK_GENERATOR(generator)
160 #define INTRINSIC(intrinsic) , intrinsic
162 #define INTRINSIC(intrinsic)
165 static const HashTableValue JSWebKitAnimationEventPrototypeTableValues[] =
167 { "initWebKitAnimationEvent", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsWebKitAnimationEventPrototypeFunctionInitWebKitAnimationEvent), (intptr_t)5 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
168 { 0, 0, 0, 0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) }
171 #undef THUNK_GENERATOR
172 static const HashTable JSWebKitAnimationEventPrototypeTable = { 2, 1, JSWebKitAnimationEventPrototypeTableValues, 0 };
173 const ClassInfo JSWebKitAnimationEventPrototype::s_info = { "WebKitAnimationEventPrototype", &JSC::JSNonFinalObject::s_info, &JSWebKitAnimationEventPrototypeTable, 0, CREATE_METHOD_TABLE(JSWebKitAnimationEventPrototype) };
175 JSObject* JSWebKitAnimationEventPrototype::self(ExecState* exec, JSGlobalObject* globalObject)
177 return getDOMPrototype<JSWebKitAnimationEvent>(exec, globalObject);
180 bool JSWebKitAnimationEventPrototype::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
182 JSWebKitAnimationEventPrototype* thisObject = jsCast<JSWebKitAnimationEventPrototype*>(cell);
183 return getStaticFunctionSlot<JSObject>(exec, &JSWebKitAnimationEventPrototypeTable, thisObject, propertyName, slot);
186 bool JSWebKitAnimationEventPrototype::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
188 JSWebKitAnimationEventPrototype* thisObject = jsCast<JSWebKitAnimationEventPrototype*>(object);
189 return getStaticFunctionDescriptor<JSObject>(exec, &JSWebKitAnimationEventPrototypeTable, thisObject, propertyName, descriptor);
192 const ClassInfo JSWebKitAnimationEvent::s_info = { "WebKitAnimationEvent", &JSEvent::s_info, &JSWebKitAnimationEventTable, 0 , CREATE_METHOD_TABLE(JSWebKitAnimationEvent) };
194 JSWebKitAnimationEvent::JSWebKitAnimationEvent(Structure* structure, JSDOMGlobalObject* globalObject, PassRefPtr<WebKitAnimationEvent> impl)
195 : JSEvent(structure, globalObject, impl)
199 void JSWebKitAnimationEvent::finishCreation(JSGlobalData& globalData)
201 Base::finishCreation(globalData);
202 ASSERT(inherits(&s_info));
205 JSObject* JSWebKitAnimationEvent::createPrototype(ExecState* exec, JSGlobalObject* globalObject)
207 return JSWebKitAnimationEventPrototype::create(exec->globalData(), globalObject, JSWebKitAnimationEventPrototype::createStructure(exec->globalData(), globalObject, JSEventPrototype::self(exec, globalObject)));
210 bool JSWebKitAnimationEvent::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
212 JSWebKitAnimationEvent* thisObject = jsCast<JSWebKitAnimationEvent*>(cell);
213 ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info);
214 return getStaticValueSlot<JSWebKitAnimationEvent, Base>(exec, &JSWebKitAnimationEventTable, thisObject, propertyName, slot);
217 bool JSWebKitAnimationEvent::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
219 JSWebKitAnimationEvent* thisObject = jsCast<JSWebKitAnimationEvent*>(object);
220 ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info);
221 return getStaticValueDescriptor<JSWebKitAnimationEvent, Base>(exec, &JSWebKitAnimationEventTable, thisObject, propertyName, descriptor);
224 JSValue jsWebKitAnimationEventAnimationName(ExecState* exec, JSValue slotBase, const Identifier&)
226 JSWebKitAnimationEvent* castedThis = static_cast<JSWebKitAnimationEvent*>(asObject(slotBase));
228 WebKitAnimationEvent* imp = static_cast<WebKitAnimationEvent*>(castedThis->impl());
229 JSValue result = jsString(exec, imp->animationName());
234 JSValue jsWebKitAnimationEventElapsedTime(ExecState* exec, JSValue slotBase, const Identifier&)
236 JSWebKitAnimationEvent* castedThis = static_cast<JSWebKitAnimationEvent*>(asObject(slotBase));
238 WebKitAnimationEvent* imp = static_cast<WebKitAnimationEvent*>(castedThis->impl());
239 JSValue result = jsNumber(imp->elapsedTime());
244 JSValue jsWebKitAnimationEventConstructor(ExecState* exec, JSValue slotBase, const Identifier&)
246 JSWebKitAnimationEvent* domObject = static_cast<JSWebKitAnimationEvent*>(asObject(slotBase));
247 return JSWebKitAnimationEvent::getConstructor(exec, domObject->globalObject());
250 JSValue JSWebKitAnimationEvent::getConstructor(ExecState* exec, JSGlobalObject* globalObject)
252 return getDOMConstructor<JSWebKitAnimationEventConstructor>(exec, static_cast<JSDOMGlobalObject*>(globalObject));
255 EncodedJSValue JSC_HOST_CALL jsWebKitAnimationEventPrototypeFunctionInitWebKitAnimationEvent(ExecState* exec)
257 JSValue thisValue = exec->hostThisValue();
258 if (!thisValue.inherits(&JSWebKitAnimationEvent::s_info))
259 return throwVMTypeError(exec);
260 JSWebKitAnimationEvent* castedThis = static_cast<JSWebKitAnimationEvent*>(asObject(thisValue));
261 ASSERT_GC_OBJECT_INHERITS(castedThis, &JSWebKitAnimationEvent::s_info);
262 WebKitAnimationEvent* imp = static_cast<WebKitAnimationEvent*>(castedThis->impl());
263 const String& typeArg(ustringToString(MAYBE_MISSING_PARAMETER(exec, 0, MissingIsUndefined).isEmpty() ? UString() : MAYBE_MISSING_PARAMETER(exec, 0, MissingIsUndefined).toString(exec)));
264 if (exec->hadException())
265 return JSValue::encode(jsUndefined());
266 bool canBubbleArg(MAYBE_MISSING_PARAMETER(exec, 1, MissingIsUndefined).toBoolean(exec));
267 if (exec->hadException())
268 return JSValue::encode(jsUndefined());
269 bool cancelableArg(MAYBE_MISSING_PARAMETER(exec, 2, MissingIsUndefined).toBoolean(exec));
270 if (exec->hadException())
271 return JSValue::encode(jsUndefined());
272 const String& animationNameArg(ustringToString(MAYBE_MISSING_PARAMETER(exec, 3, MissingIsUndefined).isEmpty() ? UString() : MAYBE_MISSING_PARAMETER(exec, 3, MissingIsUndefined).toString(exec)));
273 if (exec->hadException())
274 return JSValue::encode(jsUndefined());
275 double elapsedTimeArg(MAYBE_MISSING_PARAMETER(exec, 4, MissingIsUndefined).toNumber(exec));
276 if (exec->hadException())
277 return JSValue::encode(jsUndefined());
278 imp->initWebKitAnimationEvent(typeArg, canBubbleArg, cancelableArg, animationNameArg, elapsedTimeArg);
279 return JSValue::encode(jsUndefined());