tizen beta release
[profile/ivi/webkit-efl.git] / DerivedSources / WebCore / JSClientRectList.cpp
1 /*
2     This file is part of the WebKit open source project.
3     This file has been generated by generate-bindings.pl. DO NOT MODIFY!
4
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.
9
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.
14
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.
19 */
20
21 #include "config.h"
22 #include "JSClientRectList.h"
23
24 #include "ClientRect.h"
25 #include "ClientRectList.h"
26 #include "ExceptionCode.h"
27 #include "JSClientRect.h"
28 #include "JSDOMBinding.h"
29 #include <runtime/Error.h>
30 #include <runtime/PropertyNameArray.h>
31 #include <wtf/GetPtr.h>
32
33 using namespace JSC;
34
35 namespace WebCore {
36
37 ASSERT_CLASS_FITS_IN_CELL(JSClientRectList);
38
39 /* Hash table */
40 #if ENABLE(JIT)
41 #define THUNK_GENERATOR(generator) , generator
42 #else
43 #define THUNK_GENERATOR(generator)
44 #endif
45 #if ENABLE(DFG_JIT)
46 #define INTRINSIC(intrinsic) , intrinsic
47 #else
48 #define INTRINSIC(intrinsic)
49 #endif
50
51 static const HashTableValue JSClientRectListTableValues[] =
52 {
53     { "length", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsClientRectListLength), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
54     { "constructor", DontEnum | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsClientRectListConstructor), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
55     { 0, 0, 0, 0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) }
56 };
57
58 #undef THUNK_GENERATOR
59 static const HashTable JSClientRectListTable = { 5, 3, JSClientRectListTableValues, 0 };
60 /* Hash table for constructor */
61 #if ENABLE(JIT)
62 #define THUNK_GENERATOR(generator) , generator
63 #else
64 #define THUNK_GENERATOR(generator)
65 #endif
66 #if ENABLE(DFG_JIT)
67 #define INTRINSIC(intrinsic) , intrinsic
68 #else
69 #define INTRINSIC(intrinsic)
70 #endif
71
72 static const HashTableValue JSClientRectListConstructorTableValues[] =
73 {
74     { 0, 0, 0, 0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) }
75 };
76
77 #undef THUNK_GENERATOR
78 static const HashTable JSClientRectListConstructorTable = { 1, 0, JSClientRectListConstructorTableValues, 0 };
79 const ClassInfo JSClientRectListConstructor::s_info = { "ClientRectListConstructor", &DOMConstructorObject::s_info, &JSClientRectListConstructorTable, 0, CREATE_METHOD_TABLE(JSClientRectListConstructor) };
80
81 JSClientRectListConstructor::JSClientRectListConstructor(Structure* structure, JSDOMGlobalObject* globalObject)
82     : DOMConstructorObject(structure, globalObject)
83 {
84 }
85
86 void JSClientRectListConstructor::finishCreation(ExecState* exec, JSDOMGlobalObject* globalObject)
87 {
88     Base::finishCreation(exec->globalData());
89     ASSERT(inherits(&s_info));
90     putDirect(exec->globalData(), exec->propertyNames().prototype, JSClientRectListPrototype::self(exec, globalObject), DontDelete | ReadOnly);
91 }
92
93 bool JSClientRectListConstructor::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
94 {
95     return getStaticValueSlot<JSClientRectListConstructor, JSDOMWrapper>(exec, &JSClientRectListConstructorTable, static_cast<JSClientRectListConstructor*>(cell), propertyName, slot);
96 }
97
98 bool JSClientRectListConstructor::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
99 {
100     return getStaticValueDescriptor<JSClientRectListConstructor, JSDOMWrapper>(exec, &JSClientRectListConstructorTable, static_cast<JSClientRectListConstructor*>(object), propertyName, descriptor);
101 }
102
103 /* Hash table for prototype */
104 #if ENABLE(JIT)
105 #define THUNK_GENERATOR(generator) , generator
106 #else
107 #define THUNK_GENERATOR(generator)
108 #endif
109 #if ENABLE(DFG_JIT)
110 #define INTRINSIC(intrinsic) , intrinsic
111 #else
112 #define INTRINSIC(intrinsic)
113 #endif
114
115 static const HashTableValue JSClientRectListPrototypeTableValues[] =
116 {
117     { "item", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsClientRectListPrototypeFunctionItem), (intptr_t)1 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
118     { 0, 0, 0, 0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) }
119 };
120
121 #undef THUNK_GENERATOR
122 static const HashTable JSClientRectListPrototypeTable = { 2, 1, JSClientRectListPrototypeTableValues, 0 };
123 const ClassInfo JSClientRectListPrototype::s_info = { "ClientRectListPrototype", &JSC::JSNonFinalObject::s_info, &JSClientRectListPrototypeTable, 0, CREATE_METHOD_TABLE(JSClientRectListPrototype) };
124
125 JSObject* JSClientRectListPrototype::self(ExecState* exec, JSGlobalObject* globalObject)
126 {
127     return getDOMPrototype<JSClientRectList>(exec, globalObject);
128 }
129
130 bool JSClientRectListPrototype::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
131 {
132     JSClientRectListPrototype* thisObject = jsCast<JSClientRectListPrototype*>(cell);
133     return getStaticFunctionSlot<JSObject>(exec, &JSClientRectListPrototypeTable, thisObject, propertyName, slot);
134 }
135
136 bool JSClientRectListPrototype::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
137 {
138     JSClientRectListPrototype* thisObject = jsCast<JSClientRectListPrototype*>(object);
139     return getStaticFunctionDescriptor<JSObject>(exec, &JSClientRectListPrototypeTable, thisObject, propertyName, descriptor);
140 }
141
142 const ClassInfo JSClientRectList::s_info = { "ClientRectList", &JSDOMWrapper::s_info, &JSClientRectListTable, 0 , CREATE_METHOD_TABLE(JSClientRectList) };
143
144 JSClientRectList::JSClientRectList(Structure* structure, JSDOMGlobalObject* globalObject, PassRefPtr<ClientRectList> impl)
145     : JSDOMWrapper(structure, globalObject)
146     , m_impl(impl.leakRef())
147 {
148 }
149
150 void JSClientRectList::finishCreation(JSGlobalData& globalData)
151 {
152     Base::finishCreation(globalData);
153     ASSERT(inherits(&s_info));
154 }
155
156 JSObject* JSClientRectList::createPrototype(ExecState* exec, JSGlobalObject* globalObject)
157 {
158     return JSClientRectListPrototype::create(exec->globalData(), globalObject, JSClientRectListPrototype::createStructure(globalObject->globalData(), globalObject, globalObject->objectPrototype()));
159 }
160
161 bool JSClientRectList::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
162 {
163     JSClientRectList* thisObject = jsCast<JSClientRectList*>(cell);
164     ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info);
165     const HashEntry* entry = JSClientRectListTable.entry(exec, propertyName);
166     if (entry) {
167         slot.setCustom(thisObject, entry->propertyGetter());
168         return true;
169     }
170     bool ok;
171     unsigned index = propertyName.toUInt32(ok);
172     if (ok && index < static_cast<ClientRectList*>(thisObject->impl())->length()) {
173         slot.setCustomIndex(thisObject, index, indexGetter);
174         return true;
175     }
176     return getStaticValueSlot<JSClientRectList, Base>(exec, &JSClientRectListTable, thisObject, propertyName, slot);
177 }
178
179 bool JSClientRectList::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
180 {
181     JSClientRectList* thisObject = jsCast<JSClientRectList*>(object);
182     ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info);
183     const HashEntry* entry = JSClientRectListTable.entry(exec, propertyName);
184     if (entry) {
185         PropertySlot slot;
186         slot.setCustom(thisObject, entry->propertyGetter());
187         descriptor.setDescriptor(slot.getValue(exec, propertyName), entry->attributes());
188         return true;
189     }
190     bool ok;
191     unsigned index = propertyName.toUInt32(ok);
192     if (ok && index < static_cast<ClientRectList*>(thisObject->impl())->length()) {
193         PropertySlot slot;
194         slot.setCustomIndex(thisObject, index, indexGetter);
195         descriptor.setDescriptor(slot.getValue(exec, propertyName), DontDelete | ReadOnly);
196         return true;
197     }
198     return getStaticValueDescriptor<JSClientRectList, Base>(exec, &JSClientRectListTable, thisObject, propertyName, descriptor);
199 }
200
201 bool JSClientRectList::getOwnPropertySlotByIndex(JSCell* cell, ExecState* exec, unsigned propertyName, PropertySlot& slot)
202 {
203     JSClientRectList* thisObject = jsCast<JSClientRectList*>(cell);
204     ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info);
205     if (propertyName < static_cast<ClientRectList*>(thisObject->impl())->length()) {
206         slot.setCustomIndex(thisObject, propertyName, thisObject->indexGetter);
207         return true;
208     }
209     return thisObject->methodTable()->getOwnPropertySlot(thisObject, exec, Identifier::from(exec, propertyName), slot);
210 }
211
212 JSValue jsClientRectListLength(ExecState* exec, JSValue slotBase, const Identifier&)
213 {
214     JSClientRectList* castedThis = static_cast<JSClientRectList*>(asObject(slotBase));
215     UNUSED_PARAM(exec);
216     ClientRectList* imp = static_cast<ClientRectList*>(castedThis->impl());
217     JSValue result = jsNumber(imp->length());
218     return result;
219 }
220
221
222 JSValue jsClientRectListConstructor(ExecState* exec, JSValue slotBase, const Identifier&)
223 {
224     JSClientRectList* domObject = static_cast<JSClientRectList*>(asObject(slotBase));
225     return JSClientRectList::getConstructor(exec, domObject->globalObject());
226 }
227
228 void JSClientRectList::getOwnPropertyNames(JSObject* object, ExecState* exec, PropertyNameArray& propertyNames, EnumerationMode mode)
229 {
230     JSClientRectList* thisObject = jsCast<JSClientRectList*>(object);
231     ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info);
232     for (unsigned i = 0; i < static_cast<ClientRectList*>(thisObject->impl())->length(); ++i)
233         propertyNames.add(Identifier::from(exec, i));
234      Base::getOwnPropertyNames(thisObject, exec, propertyNames, mode);
235 }
236
237 JSValue JSClientRectList::getConstructor(ExecState* exec, JSGlobalObject* globalObject)
238 {
239     return getDOMConstructor<JSClientRectListConstructor>(exec, static_cast<JSDOMGlobalObject*>(globalObject));
240 }
241
242 EncodedJSValue JSC_HOST_CALL jsClientRectListPrototypeFunctionItem(ExecState* exec)
243 {
244     JSValue thisValue = exec->hostThisValue();
245     if (!thisValue.inherits(&JSClientRectList::s_info))
246         return throwVMTypeError(exec);
247     JSClientRectList* castedThis = static_cast<JSClientRectList*>(asObject(thisValue));
248     ASSERT_GC_OBJECT_INHERITS(castedThis, &JSClientRectList::s_info);
249     ClientRectList* imp = static_cast<ClientRectList*>(castedThis->impl());
250     int index(MAYBE_MISSING_PARAMETER(exec, 0, MissingIsUndefined).toUInt32(exec));
251     if (index < 0) {
252         setDOMException(exec, INDEX_SIZE_ERR);
253         return JSValue::encode(jsUndefined());
254     }
255     if (exec->hadException())
256         return JSValue::encode(jsUndefined());
257
258     JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->item(index)));
259     return JSValue::encode(result);
260 }
261
262
263 JSValue JSClientRectList::indexGetter(ExecState* exec, JSValue slotBase, unsigned index)
264 {
265     JSClientRectList* thisObj = static_cast<JSClientRectList*>(asObject(slotBase));
266     ASSERT_GC_OBJECT_INHERITS(thisObj, &s_info);
267     return toJS(exec, thisObj->globalObject(), static_cast<ClientRectList*>(thisObj->impl())->item(index));
268 }
269
270 static inline bool isObservable(JSClientRectList* jsClientRectList)
271 {
272     if (jsClientRectList->hasCustomProperties())
273         return true;
274     return false;
275 }
276
277 bool JSClientRectListOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor)
278 {
279     JSClientRectList* jsClientRectList = static_cast<JSClientRectList*>(handle.get().asCell());
280     if (!isObservable(jsClientRectList))
281         return false;
282     UNUSED_PARAM(visitor);
283     return false;
284 }
285
286 void JSClientRectListOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context)
287 {
288     JSClientRectList* jsClientRectList = static_cast<JSClientRectList*>(handle.get().asCell());
289     DOMWrapperWorld* world = static_cast<DOMWrapperWorld*>(context);
290     uncacheWrapper(world, jsClientRectList->impl(), jsClientRectList);
291     jsClientRectList->releaseImpl();
292 }
293
294 JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, ClientRectList* impl)
295 {
296     return wrap<JSClientRectList>(exec, globalObject, impl);
297 }
298
299 ClientRectList* toClientRectList(JSC::JSValue value)
300 {
301     return value.inherits(&JSClientRectList::s_info) ? static_cast<JSClientRectList*>(asObject(value))->impl() : 0;
302 }
303
304 }