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.
23 #if ENABLE(TOUCH_EVENTS)
25 #include "JSTouchList.h"
27 #include "ExceptionCode.h"
28 #include "JSDOMBinding.h"
31 #include "TouchList.h"
32 #include <runtime/Error.h>
33 #include <runtime/PropertyNameArray.h>
34 #include <wtf/GetPtr.h>
40 ASSERT_CLASS_FITS_IN_CELL(JSTouchList);
44 #define THUNK_GENERATOR(generator) , generator
46 #define THUNK_GENERATOR(generator)
49 #define INTRINSIC(intrinsic) , intrinsic
51 #define INTRINSIC(intrinsic)
54 static const HashTableValue JSTouchListTableValues[] =
56 { "length", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTouchListLength), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
57 { "constructor", DontEnum | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTouchListConstructor), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
58 { 0, 0, 0, 0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) }
61 #undef THUNK_GENERATOR
62 static const HashTable JSTouchListTable = { 5, 3, JSTouchListTableValues, 0 };
63 /* Hash table for constructor */
65 #define THUNK_GENERATOR(generator) , generator
67 #define THUNK_GENERATOR(generator)
70 #define INTRINSIC(intrinsic) , intrinsic
72 #define INTRINSIC(intrinsic)
75 static const HashTableValue JSTouchListConstructorTableValues[] =
77 { 0, 0, 0, 0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) }
80 #undef THUNK_GENERATOR
81 static const HashTable JSTouchListConstructorTable = { 1, 0, JSTouchListConstructorTableValues, 0 };
82 const ClassInfo JSTouchListConstructor::s_info = { "TouchListConstructor", &DOMConstructorObject::s_info, &JSTouchListConstructorTable, 0, CREATE_METHOD_TABLE(JSTouchListConstructor) };
84 JSTouchListConstructor::JSTouchListConstructor(Structure* structure, JSDOMGlobalObject* globalObject)
85 : DOMConstructorObject(structure, globalObject)
89 void JSTouchListConstructor::finishCreation(ExecState* exec, JSDOMGlobalObject* globalObject)
91 Base::finishCreation(exec->globalData());
92 ASSERT(inherits(&s_info));
93 putDirect(exec->globalData(), exec->propertyNames().prototype, JSTouchListPrototype::self(exec, globalObject), DontDelete | ReadOnly);
96 bool JSTouchListConstructor::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
98 return getStaticValueSlot<JSTouchListConstructor, JSDOMWrapper>(exec, &JSTouchListConstructorTable, static_cast<JSTouchListConstructor*>(cell), propertyName, slot);
101 bool JSTouchListConstructor::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
103 return getStaticValueDescriptor<JSTouchListConstructor, JSDOMWrapper>(exec, &JSTouchListConstructorTable, static_cast<JSTouchListConstructor*>(object), propertyName, descriptor);
106 /* Hash table for prototype */
108 #define THUNK_GENERATOR(generator) , generator
110 #define THUNK_GENERATOR(generator)
113 #define INTRINSIC(intrinsic) , intrinsic
115 #define INTRINSIC(intrinsic)
118 static const HashTableValue JSTouchListPrototypeTableValues[] =
120 { "item", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsTouchListPrototypeFunctionItem), (intptr_t)1 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
121 { 0, 0, 0, 0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) }
124 #undef THUNK_GENERATOR
125 static const HashTable JSTouchListPrototypeTable = { 2, 1, JSTouchListPrototypeTableValues, 0 };
126 const ClassInfo JSTouchListPrototype::s_info = { "TouchListPrototype", &JSC::JSNonFinalObject::s_info, &JSTouchListPrototypeTable, 0, CREATE_METHOD_TABLE(JSTouchListPrototype) };
128 JSObject* JSTouchListPrototype::self(ExecState* exec, JSGlobalObject* globalObject)
130 return getDOMPrototype<JSTouchList>(exec, globalObject);
133 bool JSTouchListPrototype::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
135 JSTouchListPrototype* thisObject = jsCast<JSTouchListPrototype*>(cell);
136 return getStaticFunctionSlot<JSObject>(exec, &JSTouchListPrototypeTable, thisObject, propertyName, slot);
139 bool JSTouchListPrototype::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
141 JSTouchListPrototype* thisObject = jsCast<JSTouchListPrototype*>(object);
142 return getStaticFunctionDescriptor<JSObject>(exec, &JSTouchListPrototypeTable, thisObject, propertyName, descriptor);
145 const ClassInfo JSTouchList::s_info = { "TouchList", &JSDOMWrapper::s_info, &JSTouchListTable, 0 , CREATE_METHOD_TABLE(JSTouchList) };
147 JSTouchList::JSTouchList(Structure* structure, JSDOMGlobalObject* globalObject, PassRefPtr<TouchList> impl)
148 : JSDOMWrapper(structure, globalObject)
149 , m_impl(impl.leakRef())
153 void JSTouchList::finishCreation(JSGlobalData& globalData)
155 Base::finishCreation(globalData);
156 ASSERT(inherits(&s_info));
159 JSObject* JSTouchList::createPrototype(ExecState* exec, JSGlobalObject* globalObject)
161 return JSTouchListPrototype::create(exec->globalData(), globalObject, JSTouchListPrototype::createStructure(globalObject->globalData(), globalObject, globalObject->objectPrototype()));
164 bool JSTouchList::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
166 JSTouchList* thisObject = jsCast<JSTouchList*>(cell);
167 ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info);
168 const HashEntry* entry = JSTouchListTable.entry(exec, propertyName);
170 slot.setCustom(thisObject, entry->propertyGetter());
174 unsigned index = propertyName.toUInt32(ok);
175 if (ok && index < static_cast<TouchList*>(thisObject->impl())->length()) {
176 slot.setCustomIndex(thisObject, index, indexGetter);
179 return getStaticValueSlot<JSTouchList, Base>(exec, &JSTouchListTable, thisObject, propertyName, slot);
182 bool JSTouchList::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
184 JSTouchList* thisObject = jsCast<JSTouchList*>(object);
185 ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info);
186 const HashEntry* entry = JSTouchListTable.entry(exec, propertyName);
189 slot.setCustom(thisObject, entry->propertyGetter());
190 descriptor.setDescriptor(slot.getValue(exec, propertyName), entry->attributes());
194 unsigned index = propertyName.toUInt32(ok);
195 if (ok && index < static_cast<TouchList*>(thisObject->impl())->length()) {
197 slot.setCustomIndex(thisObject, index, indexGetter);
198 descriptor.setDescriptor(slot.getValue(exec, propertyName), DontDelete | ReadOnly);
201 return getStaticValueDescriptor<JSTouchList, Base>(exec, &JSTouchListTable, thisObject, propertyName, descriptor);
204 bool JSTouchList::getOwnPropertySlotByIndex(JSCell* cell, ExecState* exec, unsigned propertyName, PropertySlot& slot)
206 JSTouchList* thisObject = jsCast<JSTouchList*>(cell);
207 ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info);
208 if (propertyName < static_cast<TouchList*>(thisObject->impl())->length()) {
209 slot.setCustomIndex(thisObject, propertyName, thisObject->indexGetter);
212 return thisObject->methodTable()->getOwnPropertySlot(thisObject, exec, Identifier::from(exec, propertyName), slot);
215 JSValue jsTouchListLength(ExecState* exec, JSValue slotBase, const Identifier&)
217 JSTouchList* castedThis = static_cast<JSTouchList*>(asObject(slotBase));
219 TouchList* imp = static_cast<TouchList*>(castedThis->impl());
220 JSValue result = jsNumber(imp->length());
225 JSValue jsTouchListConstructor(ExecState* exec, JSValue slotBase, const Identifier&)
227 JSTouchList* domObject = static_cast<JSTouchList*>(asObject(slotBase));
228 return JSTouchList::getConstructor(exec, domObject->globalObject());
231 void JSTouchList::getOwnPropertyNames(JSObject* object, ExecState* exec, PropertyNameArray& propertyNames, EnumerationMode mode)
233 JSTouchList* thisObject = jsCast<JSTouchList*>(object);
234 ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info);
235 for (unsigned i = 0; i < static_cast<TouchList*>(thisObject->impl())->length(); ++i)
236 propertyNames.add(Identifier::from(exec, i));
237 Base::getOwnPropertyNames(thisObject, exec, propertyNames, mode);
240 JSValue JSTouchList::getConstructor(ExecState* exec, JSGlobalObject* globalObject)
242 return getDOMConstructor<JSTouchListConstructor>(exec, static_cast<JSDOMGlobalObject*>(globalObject));
245 EncodedJSValue JSC_HOST_CALL jsTouchListPrototypeFunctionItem(ExecState* exec)
247 JSValue thisValue = exec->hostThisValue();
248 if (!thisValue.inherits(&JSTouchList::s_info))
249 return throwVMTypeError(exec);
250 JSTouchList* castedThis = static_cast<JSTouchList*>(asObject(thisValue));
251 ASSERT_GC_OBJECT_INHERITS(castedThis, &JSTouchList::s_info);
252 TouchList* imp = static_cast<TouchList*>(castedThis->impl());
253 if (exec->argumentCount() < 1)
254 return throwVMError(exec, createTypeError(exec, "Not enough arguments"));
255 unsigned index(MAYBE_MISSING_PARAMETER(exec, 0, MissingIsUndefined).toUInt32(exec));
256 if (exec->hadException())
257 return JSValue::encode(jsUndefined());
259 JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->item(index)));
260 return JSValue::encode(result);
264 JSValue JSTouchList::indexGetter(ExecState* exec, JSValue slotBase, unsigned index)
266 JSTouchList* thisObj = static_cast<JSTouchList*>(asObject(slotBase));
267 ASSERT_GC_OBJECT_INHERITS(thisObj, &s_info);
268 return toJS(exec, thisObj->globalObject(), static_cast<TouchList*>(thisObj->impl())->item(index));
271 static inline bool isObservable(JSTouchList* jsTouchList)
273 if (jsTouchList->hasCustomProperties())
278 bool JSTouchListOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor)
280 JSTouchList* jsTouchList = static_cast<JSTouchList*>(handle.get().asCell());
281 if (!isObservable(jsTouchList))
283 UNUSED_PARAM(visitor);
287 void JSTouchListOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context)
289 JSTouchList* jsTouchList = static_cast<JSTouchList*>(handle.get().asCell());
290 DOMWrapperWorld* world = static_cast<DOMWrapperWorld*>(context);
291 uncacheWrapper(world, jsTouchList->impl(), jsTouchList);
292 jsTouchList->releaseImpl();
295 JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, TouchList* impl)
297 return wrap<JSTouchList>(exec, globalObject, impl);
300 TouchList* toTouchList(JSC::JSValue value)
302 return value.inherits(&JSTouchList::s_info) ? static_cast<JSTouchList*>(asObject(value))->impl() : 0;
307 #endif // ENABLE(TOUCH_EVENTS)