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 "JSWebKitAnimation.h"
24 #include "ExceptionCode.h"
25 #include "JSDOMBinding.h"
27 #include "WebKitAnimation.h"
28 #include <runtime/Error.h>
29 #include <runtime/JSString.h>
30 #include <wtf/GetPtr.h>
36 ASSERT_CLASS_FITS_IN_CELL(JSWebKitAnimation);
40 #define THUNK_GENERATOR(generator) , generator
42 #define THUNK_GENERATOR(generator)
45 #define INTRINSIC(intrinsic) , intrinsic
47 #define INTRINSIC(intrinsic)
50 static const HashTableValue JSWebKitAnimationTableValues[] =
52 { "name", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsWebKitAnimationName), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
53 { "duration", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsWebKitAnimationDuration), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
54 { "elapsedTime", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsWebKitAnimationElapsedTime), (intptr_t)setJSWebKitAnimationElapsedTime THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
55 { "delay", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsWebKitAnimationDelay), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
56 { "iterationCount", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsWebKitAnimationIterationCount), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
57 { "paused", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsWebKitAnimationPaused), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
58 { "ended", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsWebKitAnimationEnded), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
59 { "direction", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsWebKitAnimationDirection), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
60 { "fillMode", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsWebKitAnimationFillMode), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
61 { "constructor", DontEnum | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsWebKitAnimationConstructor), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
62 { 0, 0, 0, 0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) }
65 #undef THUNK_GENERATOR
66 static const HashTable JSWebKitAnimationTable = { 33, 31, JSWebKitAnimationTableValues, 0 };
67 /* Hash table for constructor */
69 #define THUNK_GENERATOR(generator) , generator
71 #define THUNK_GENERATOR(generator)
74 #define INTRINSIC(intrinsic) , intrinsic
76 #define INTRINSIC(intrinsic)
79 static const HashTableValue JSWebKitAnimationConstructorTableValues[] =
81 { "DIRECTION_NORMAL", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsWebKitAnimationDIRECTION_NORMAL), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
82 { "DIRECTION_ALTERNATE", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsWebKitAnimationDIRECTION_ALTERNATE), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
83 { "FILL_NONE", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsWebKitAnimationFILL_NONE), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
84 { "FILL_BACKWARDS", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsWebKitAnimationFILL_BACKWARDS), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
85 { "FILL_FORWARDS", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsWebKitAnimationFILL_FORWARDS), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
86 { "FILL_BOTH", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsWebKitAnimationFILL_BOTH), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
87 { 0, 0, 0, 0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) }
90 #undef THUNK_GENERATOR
91 static const HashTable JSWebKitAnimationConstructorTable = { 16, 15, JSWebKitAnimationConstructorTableValues, 0 };
93 COMPILE_ASSERT(0 == WebKitAnimation::DIRECTION_NORMAL, WebKitAnimationEnumDIRECTION_NORMALIsWrongUseDontCheckEnums);
94 COMPILE_ASSERT(1 == WebKitAnimation::DIRECTION_ALTERNATE, WebKitAnimationEnumDIRECTION_ALTERNATEIsWrongUseDontCheckEnums);
95 COMPILE_ASSERT(0 == WebKitAnimation::FILL_NONE, WebKitAnimationEnumFILL_NONEIsWrongUseDontCheckEnums);
96 COMPILE_ASSERT(1 == WebKitAnimation::FILL_BACKWARDS, WebKitAnimationEnumFILL_BACKWARDSIsWrongUseDontCheckEnums);
97 COMPILE_ASSERT(2 == WebKitAnimation::FILL_FORWARDS, WebKitAnimationEnumFILL_FORWARDSIsWrongUseDontCheckEnums);
98 COMPILE_ASSERT(3 == WebKitAnimation::FILL_BOTH, WebKitAnimationEnumFILL_BOTHIsWrongUseDontCheckEnums);
100 const ClassInfo JSWebKitAnimationConstructor::s_info = { "WebKitAnimationConstructor", &DOMConstructorObject::s_info, &JSWebKitAnimationConstructorTable, 0, CREATE_METHOD_TABLE(JSWebKitAnimationConstructor) };
102 JSWebKitAnimationConstructor::JSWebKitAnimationConstructor(Structure* structure, JSDOMGlobalObject* globalObject)
103 : DOMConstructorObject(structure, globalObject)
107 void JSWebKitAnimationConstructor::finishCreation(ExecState* exec, JSDOMGlobalObject* globalObject)
109 Base::finishCreation(exec->globalData());
110 ASSERT(inherits(&s_info));
111 putDirect(exec->globalData(), exec->propertyNames().prototype, JSWebKitAnimationPrototype::self(exec, globalObject), DontDelete | ReadOnly);
114 bool JSWebKitAnimationConstructor::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
116 return getStaticValueSlot<JSWebKitAnimationConstructor, JSDOMWrapper>(exec, &JSWebKitAnimationConstructorTable, static_cast<JSWebKitAnimationConstructor*>(cell), propertyName, slot);
119 bool JSWebKitAnimationConstructor::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
121 return getStaticValueDescriptor<JSWebKitAnimationConstructor, JSDOMWrapper>(exec, &JSWebKitAnimationConstructorTable, static_cast<JSWebKitAnimationConstructor*>(object), propertyName, descriptor);
124 /* Hash table for prototype */
126 #define THUNK_GENERATOR(generator) , generator
128 #define THUNK_GENERATOR(generator)
131 #define INTRINSIC(intrinsic) , intrinsic
133 #define INTRINSIC(intrinsic)
136 static const HashTableValue JSWebKitAnimationPrototypeTableValues[] =
138 { "DIRECTION_NORMAL", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsWebKitAnimationDIRECTION_NORMAL), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
139 { "DIRECTION_ALTERNATE", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsWebKitAnimationDIRECTION_ALTERNATE), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
140 { "FILL_NONE", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsWebKitAnimationFILL_NONE), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
141 { "FILL_BACKWARDS", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsWebKitAnimationFILL_BACKWARDS), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
142 { "FILL_FORWARDS", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsWebKitAnimationFILL_FORWARDS), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
143 { "FILL_BOTH", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsWebKitAnimationFILL_BOTH), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
144 { "play", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsWebKitAnimationPrototypeFunctionPlay), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
145 { "pause", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsWebKitAnimationPrototypeFunctionPause), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
146 { 0, 0, 0, 0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) }
149 #undef THUNK_GENERATOR
150 static const HashTable JSWebKitAnimationPrototypeTable = { 17, 15, JSWebKitAnimationPrototypeTableValues, 0 };
151 const ClassInfo JSWebKitAnimationPrototype::s_info = { "WebKitAnimationPrototype", &JSC::JSNonFinalObject::s_info, &JSWebKitAnimationPrototypeTable, 0, CREATE_METHOD_TABLE(JSWebKitAnimationPrototype) };
153 JSObject* JSWebKitAnimationPrototype::self(ExecState* exec, JSGlobalObject* globalObject)
155 return getDOMPrototype<JSWebKitAnimation>(exec, globalObject);
158 bool JSWebKitAnimationPrototype::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
160 JSWebKitAnimationPrototype* thisObject = jsCast<JSWebKitAnimationPrototype*>(cell);
161 return getStaticPropertySlot<JSWebKitAnimationPrototype, JSObject>(exec, &JSWebKitAnimationPrototypeTable, thisObject, propertyName, slot);
164 bool JSWebKitAnimationPrototype::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
166 JSWebKitAnimationPrototype* thisObject = jsCast<JSWebKitAnimationPrototype*>(object);
167 return getStaticPropertyDescriptor<JSWebKitAnimationPrototype, JSObject>(exec, &JSWebKitAnimationPrototypeTable, thisObject, propertyName, descriptor);
170 const ClassInfo JSWebKitAnimation::s_info = { "WebKitAnimation", &JSDOMWrapper::s_info, &JSWebKitAnimationTable, 0 , CREATE_METHOD_TABLE(JSWebKitAnimation) };
172 JSWebKitAnimation::JSWebKitAnimation(Structure* structure, JSDOMGlobalObject* globalObject, PassRefPtr<WebKitAnimation> impl)
173 : JSDOMWrapper(structure, globalObject)
174 , m_impl(impl.leakRef())
178 void JSWebKitAnimation::finishCreation(JSGlobalData& globalData)
180 Base::finishCreation(globalData);
181 ASSERT(inherits(&s_info));
184 JSObject* JSWebKitAnimation::createPrototype(ExecState* exec, JSGlobalObject* globalObject)
186 return JSWebKitAnimationPrototype::create(exec->globalData(), globalObject, JSWebKitAnimationPrototype::createStructure(globalObject->globalData(), globalObject, globalObject->objectPrototype()));
189 bool JSWebKitAnimation::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
191 JSWebKitAnimation* thisObject = jsCast<JSWebKitAnimation*>(cell);
192 ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info);
193 return getStaticValueSlot<JSWebKitAnimation, Base>(exec, &JSWebKitAnimationTable, thisObject, propertyName, slot);
196 bool JSWebKitAnimation::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
198 JSWebKitAnimation* thisObject = jsCast<JSWebKitAnimation*>(object);
199 ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info);
200 return getStaticValueDescriptor<JSWebKitAnimation, Base>(exec, &JSWebKitAnimationTable, thisObject, propertyName, descriptor);
203 JSValue jsWebKitAnimationName(ExecState* exec, JSValue slotBase, const Identifier&)
205 JSWebKitAnimation* castedThis = static_cast<JSWebKitAnimation*>(asObject(slotBase));
207 WebKitAnimation* imp = static_cast<WebKitAnimation*>(castedThis->impl());
208 JSValue result = jsString(exec, imp->name());
213 JSValue jsWebKitAnimationDuration(ExecState* exec, JSValue slotBase, const Identifier&)
215 JSWebKitAnimation* castedThis = static_cast<JSWebKitAnimation*>(asObject(slotBase));
217 WebKitAnimation* imp = static_cast<WebKitAnimation*>(castedThis->impl());
218 JSValue result = jsNumber(imp->duration());
223 JSValue jsWebKitAnimationElapsedTime(ExecState* exec, JSValue slotBase, const Identifier&)
225 JSWebKitAnimation* castedThis = static_cast<JSWebKitAnimation*>(asObject(slotBase));
227 WebKitAnimation* imp = static_cast<WebKitAnimation*>(castedThis->impl());
228 JSValue result = jsNumber(imp->elapsedTime());
233 JSValue jsWebKitAnimationDelay(ExecState* exec, JSValue slotBase, const Identifier&)
235 JSWebKitAnimation* castedThis = static_cast<JSWebKitAnimation*>(asObject(slotBase));
237 WebKitAnimation* imp = static_cast<WebKitAnimation*>(castedThis->impl());
238 JSValue result = jsNumber(imp->delay());
243 JSValue jsWebKitAnimationIterationCount(ExecState* exec, JSValue slotBase, const Identifier&)
245 JSWebKitAnimation* castedThis = static_cast<JSWebKitAnimation*>(asObject(slotBase));
246 return castedThis->iterationCount(exec);
250 JSValue jsWebKitAnimationPaused(ExecState* exec, JSValue slotBase, const Identifier&)
252 JSWebKitAnimation* castedThis = static_cast<JSWebKitAnimation*>(asObject(slotBase));
254 WebKitAnimation* imp = static_cast<WebKitAnimation*>(castedThis->impl());
255 JSValue result = jsBoolean(imp->paused());
260 JSValue jsWebKitAnimationEnded(ExecState* exec, JSValue slotBase, const Identifier&)
262 JSWebKitAnimation* castedThis = static_cast<JSWebKitAnimation*>(asObject(slotBase));
264 WebKitAnimation* imp = static_cast<WebKitAnimation*>(castedThis->impl());
265 JSValue result = jsBoolean(imp->ended());
270 JSValue jsWebKitAnimationDirection(ExecState* exec, JSValue slotBase, const Identifier&)
272 JSWebKitAnimation* castedThis = static_cast<JSWebKitAnimation*>(asObject(slotBase));
274 WebKitAnimation* imp = static_cast<WebKitAnimation*>(castedThis->impl());
275 JSValue result = jsNumber(imp->direction());
280 JSValue jsWebKitAnimationFillMode(ExecState* exec, JSValue slotBase, const Identifier&)
282 JSWebKitAnimation* castedThis = static_cast<JSWebKitAnimation*>(asObject(slotBase));
284 WebKitAnimation* imp = static_cast<WebKitAnimation*>(castedThis->impl());
285 JSValue result = jsNumber(imp->fillMode());
290 JSValue jsWebKitAnimationConstructor(ExecState* exec, JSValue slotBase, const Identifier&)
292 JSWebKitAnimation* domObject = static_cast<JSWebKitAnimation*>(asObject(slotBase));
293 return JSWebKitAnimation::getConstructor(exec, domObject->globalObject());
296 void JSWebKitAnimation::put(JSCell* cell, ExecState* exec, const Identifier& propertyName, JSValue value, PutPropertySlot& slot)
298 JSWebKitAnimation* thisObject = jsCast<JSWebKitAnimation*>(cell);
299 ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info);
300 lookupPut<JSWebKitAnimation, Base>(exec, propertyName, value, &JSWebKitAnimationTable, thisObject, slot);
303 void setJSWebKitAnimationElapsedTime(ExecState* exec, JSObject* thisObject, JSValue value)
305 JSWebKitAnimation* castedThis = static_cast<JSWebKitAnimation*>(thisObject);
306 WebKitAnimation* imp = static_cast<WebKitAnimation*>(castedThis->impl());
307 imp->setElapsedTime(value.toNumber(exec));
311 JSValue JSWebKitAnimation::getConstructor(ExecState* exec, JSGlobalObject* globalObject)
313 return getDOMConstructor<JSWebKitAnimationConstructor>(exec, static_cast<JSDOMGlobalObject*>(globalObject));
316 EncodedJSValue JSC_HOST_CALL jsWebKitAnimationPrototypeFunctionPlay(ExecState* exec)
318 JSValue thisValue = exec->hostThisValue();
319 if (!thisValue.inherits(&JSWebKitAnimation::s_info))
320 return throwVMTypeError(exec);
321 JSWebKitAnimation* castedThis = static_cast<JSWebKitAnimation*>(asObject(thisValue));
322 ASSERT_GC_OBJECT_INHERITS(castedThis, &JSWebKitAnimation::s_info);
323 WebKitAnimation* imp = static_cast<WebKitAnimation*>(castedThis->impl());
325 return JSValue::encode(jsUndefined());
328 EncodedJSValue JSC_HOST_CALL jsWebKitAnimationPrototypeFunctionPause(ExecState* exec)
330 JSValue thisValue = exec->hostThisValue();
331 if (!thisValue.inherits(&JSWebKitAnimation::s_info))
332 return throwVMTypeError(exec);
333 JSWebKitAnimation* castedThis = static_cast<JSWebKitAnimation*>(asObject(thisValue));
334 ASSERT_GC_OBJECT_INHERITS(castedThis, &JSWebKitAnimation::s_info);
335 WebKitAnimation* imp = static_cast<WebKitAnimation*>(castedThis->impl());
337 return JSValue::encode(jsUndefined());
342 JSValue jsWebKitAnimationDIRECTION_NORMAL(ExecState* exec, JSValue, const Identifier&)
345 return jsNumber(static_cast<int>(0));
348 JSValue jsWebKitAnimationDIRECTION_ALTERNATE(ExecState* exec, JSValue, const Identifier&)
351 return jsNumber(static_cast<int>(1));
354 JSValue jsWebKitAnimationFILL_NONE(ExecState* exec, JSValue, const Identifier&)
357 return jsNumber(static_cast<int>(0));
360 JSValue jsWebKitAnimationFILL_BACKWARDS(ExecState* exec, JSValue, const Identifier&)
363 return jsNumber(static_cast<int>(1));
366 JSValue jsWebKitAnimationFILL_FORWARDS(ExecState* exec, JSValue, const Identifier&)
369 return jsNumber(static_cast<int>(2));
372 JSValue jsWebKitAnimationFILL_BOTH(ExecState* exec, JSValue, const Identifier&)
375 return jsNumber(static_cast<int>(3));
378 static inline bool isObservable(JSWebKitAnimation* jsWebKitAnimation)
380 if (jsWebKitAnimation->hasCustomProperties())
385 bool JSWebKitAnimationOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor)
387 JSWebKitAnimation* jsWebKitAnimation = static_cast<JSWebKitAnimation*>(handle.get().asCell());
388 if (!isObservable(jsWebKitAnimation))
390 UNUSED_PARAM(visitor);
394 void JSWebKitAnimationOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context)
396 JSWebKitAnimation* jsWebKitAnimation = static_cast<JSWebKitAnimation*>(handle.get().asCell());
397 DOMWrapperWorld* world = static_cast<DOMWrapperWorld*>(context);
398 uncacheWrapper(world, jsWebKitAnimation->impl(), jsWebKitAnimation);
399 jsWebKitAnimation->releaseImpl();
402 JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, WebKitAnimation* impl)
404 return wrap<JSWebKitAnimation>(exec, globalObject, impl);
407 WebKitAnimation* toWebKitAnimation(JSC::JSValue value)
409 return value.inherits(&JSWebKitAnimation::s_info) ? static_cast<JSWebKitAnimation*>(asObject(value))->impl() : 0;