tizen beta release
[profile/ivi/webkit-efl.git] / DerivedSources / WebCore / JSHTMLOptionsCollection.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 "JSHTMLOptionsCollection.h"
23
24 #include "HTMLOptionsCollection.h"
25 #include <runtime/Error.h>
26 #include <wtf/GetPtr.h>
27
28 using namespace JSC;
29
30 namespace WebCore {
31
32 ASSERT_CLASS_FITS_IN_CELL(JSHTMLOptionsCollection);
33
34 /* Hash table */
35 #if ENABLE(JIT)
36 #define THUNK_GENERATOR(generator) , generator
37 #else
38 #define THUNK_GENERATOR(generator)
39 #endif
40 #if ENABLE(DFG_JIT)
41 #define INTRINSIC(intrinsic) , intrinsic
42 #else
43 #define INTRINSIC(intrinsic)
44 #endif
45
46 static const HashTableValue JSHTMLOptionsCollectionTableValues[] =
47 {
48     { "selectedIndex", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLOptionsCollectionSelectedIndex), (intptr_t)setJSHTMLOptionsCollectionSelectedIndex THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
49     { "length", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLOptionsCollectionLength), (intptr_t)setJSHTMLOptionsCollectionLength THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
50     { "constructor", DontEnum | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLOptionsCollectionConstructor), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
51     { 0, 0, 0, 0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) }
52 };
53
54 #undef THUNK_GENERATOR
55 static const HashTable JSHTMLOptionsCollectionTable = { 9, 7, JSHTMLOptionsCollectionTableValues, 0 };
56 /* Hash table for constructor */
57 #if ENABLE(JIT)
58 #define THUNK_GENERATOR(generator) , generator
59 #else
60 #define THUNK_GENERATOR(generator)
61 #endif
62 #if ENABLE(DFG_JIT)
63 #define INTRINSIC(intrinsic) , intrinsic
64 #else
65 #define INTRINSIC(intrinsic)
66 #endif
67
68 static const HashTableValue JSHTMLOptionsCollectionConstructorTableValues[] =
69 {
70     { 0, 0, 0, 0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) }
71 };
72
73 #undef THUNK_GENERATOR
74 static const HashTable JSHTMLOptionsCollectionConstructorTable = { 1, 0, JSHTMLOptionsCollectionConstructorTableValues, 0 };
75 const ClassInfo JSHTMLOptionsCollectionConstructor::s_info = { "HTMLOptionsCollectionConstructor", &DOMConstructorObject::s_info, &JSHTMLOptionsCollectionConstructorTable, 0, CREATE_METHOD_TABLE(JSHTMLOptionsCollectionConstructor) };
76
77 JSHTMLOptionsCollectionConstructor::JSHTMLOptionsCollectionConstructor(Structure* structure, JSDOMGlobalObject* globalObject)
78     : DOMConstructorObject(structure, globalObject)
79 {
80 }
81
82 void JSHTMLOptionsCollectionConstructor::finishCreation(ExecState* exec, JSDOMGlobalObject* globalObject)
83 {
84     Base::finishCreation(exec->globalData());
85     ASSERT(inherits(&s_info));
86     putDirect(exec->globalData(), exec->propertyNames().prototype, JSHTMLOptionsCollectionPrototype::self(exec, globalObject), DontDelete | ReadOnly);
87 }
88
89 bool JSHTMLOptionsCollectionConstructor::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
90 {
91     return getStaticValueSlot<JSHTMLOptionsCollectionConstructor, JSDOMWrapper>(exec, &JSHTMLOptionsCollectionConstructorTable, static_cast<JSHTMLOptionsCollectionConstructor*>(cell), propertyName, slot);
92 }
93
94 bool JSHTMLOptionsCollectionConstructor::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
95 {
96     return getStaticValueDescriptor<JSHTMLOptionsCollectionConstructor, JSDOMWrapper>(exec, &JSHTMLOptionsCollectionConstructorTable, static_cast<JSHTMLOptionsCollectionConstructor*>(object), propertyName, descriptor);
97 }
98
99 /* Hash table for prototype */
100 #if ENABLE(JIT)
101 #define THUNK_GENERATOR(generator) , generator
102 #else
103 #define THUNK_GENERATOR(generator)
104 #endif
105 #if ENABLE(DFG_JIT)
106 #define INTRINSIC(intrinsic) , intrinsic
107 #else
108 #define INTRINSIC(intrinsic)
109 #endif
110
111 static const HashTableValue JSHTMLOptionsCollectionPrototypeTableValues[] =
112 {
113     { "add", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsHTMLOptionsCollectionPrototypeFunctionAdd), (intptr_t)2 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
114     { "remove", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsHTMLOptionsCollectionPrototypeFunctionRemove), (intptr_t)1 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
115     { 0, 0, 0, 0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) }
116 };
117
118 #undef THUNK_GENERATOR
119 static const HashTable JSHTMLOptionsCollectionPrototypeTable = { 4, 3, JSHTMLOptionsCollectionPrototypeTableValues, 0 };
120 const ClassInfo JSHTMLOptionsCollectionPrototype::s_info = { "HTMLOptionsCollectionPrototype", &JSC::JSNonFinalObject::s_info, &JSHTMLOptionsCollectionPrototypeTable, 0, CREATE_METHOD_TABLE(JSHTMLOptionsCollectionPrototype) };
121
122 JSObject* JSHTMLOptionsCollectionPrototype::self(ExecState* exec, JSGlobalObject* globalObject)
123 {
124     return getDOMPrototype<JSHTMLOptionsCollection>(exec, globalObject);
125 }
126
127 bool JSHTMLOptionsCollectionPrototype::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
128 {
129     JSHTMLOptionsCollectionPrototype* thisObject = jsCast<JSHTMLOptionsCollectionPrototype*>(cell);
130     return getStaticFunctionSlot<JSObject>(exec, &JSHTMLOptionsCollectionPrototypeTable, thisObject, propertyName, slot);
131 }
132
133 bool JSHTMLOptionsCollectionPrototype::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
134 {
135     JSHTMLOptionsCollectionPrototype* thisObject = jsCast<JSHTMLOptionsCollectionPrototype*>(object);
136     return getStaticFunctionDescriptor<JSObject>(exec, &JSHTMLOptionsCollectionPrototypeTable, thisObject, propertyName, descriptor);
137 }
138
139 const ClassInfo JSHTMLOptionsCollection::s_info = { "HTMLOptionsCollection", &JSHTMLCollection::s_info, &JSHTMLOptionsCollectionTable, 0 , CREATE_METHOD_TABLE(JSHTMLOptionsCollection) };
140
141 JSHTMLOptionsCollection::JSHTMLOptionsCollection(Structure* structure, JSDOMGlobalObject* globalObject, PassRefPtr<HTMLOptionsCollection> impl)
142     : JSHTMLCollection(structure, globalObject, impl)
143 {
144 }
145
146 void JSHTMLOptionsCollection::finishCreation(JSGlobalData& globalData)
147 {
148     Base::finishCreation(globalData);
149     ASSERT(inherits(&s_info));
150 }
151
152 JSObject* JSHTMLOptionsCollection::createPrototype(ExecState* exec, JSGlobalObject* globalObject)
153 {
154     return JSHTMLOptionsCollectionPrototype::create(exec->globalData(), globalObject, JSHTMLOptionsCollectionPrototype::createStructure(exec->globalData(), globalObject, JSHTMLCollectionPrototype::self(exec, globalObject)));
155 }
156
157 bool JSHTMLOptionsCollection::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
158 {
159     JSHTMLOptionsCollection* thisObject = jsCast<JSHTMLOptionsCollection*>(cell);
160     ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info);
161     return getStaticValueSlot<JSHTMLOptionsCollection, Base>(exec, &JSHTMLOptionsCollectionTable, thisObject, propertyName, slot);
162 }
163
164 bool JSHTMLOptionsCollection::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
165 {
166     JSHTMLOptionsCollection* thisObject = jsCast<JSHTMLOptionsCollection*>(object);
167     ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info);
168     return getStaticValueDescriptor<JSHTMLOptionsCollection, Base>(exec, &JSHTMLOptionsCollectionTable, thisObject, propertyName, descriptor);
169 }
170
171 JSValue jsHTMLOptionsCollectionSelectedIndex(ExecState* exec, JSValue slotBase, const Identifier&)
172 {
173     JSHTMLOptionsCollection* castedThis = static_cast<JSHTMLOptionsCollection*>(asObject(slotBase));
174     UNUSED_PARAM(exec);
175     HTMLOptionsCollection* imp = static_cast<HTMLOptionsCollection*>(castedThis->impl());
176     JSValue result = jsNumber(imp->selectedIndex());
177     return result;
178 }
179
180
181 JSValue jsHTMLOptionsCollectionLength(ExecState* exec, JSValue slotBase, const Identifier&)
182 {
183     JSHTMLOptionsCollection* castedThis = static_cast<JSHTMLOptionsCollection*>(asObject(slotBase));
184     return castedThis->length(exec);
185 }
186
187
188 JSValue jsHTMLOptionsCollectionConstructor(ExecState* exec, JSValue slotBase, const Identifier&)
189 {
190     JSHTMLOptionsCollection* domObject = static_cast<JSHTMLOptionsCollection*>(asObject(slotBase));
191     return JSHTMLOptionsCollection::getConstructor(exec, domObject->globalObject());
192 }
193
194 void JSHTMLOptionsCollection::put(JSCell* cell, ExecState* exec, const Identifier& propertyName, JSValue value, PutPropertySlot& slot)
195 {
196     JSHTMLOptionsCollection* thisObject = jsCast<JSHTMLOptionsCollection*>(cell);
197     ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info);
198     bool ok;
199     unsigned index = propertyName.toUInt32(ok);
200     if (ok) {
201         thisObject->indexSetter(exec, index, value);
202         return;
203     }
204     lookupPut<JSHTMLOptionsCollection, Base>(exec, propertyName, value, &JSHTMLOptionsCollectionTable, thisObject, slot);
205 }
206
207 void JSHTMLOptionsCollection::putByIndex(JSCell* cell, ExecState* exec, unsigned propertyName, JSValue value)
208 {
209     JSHTMLOptionsCollection* thisObject = jsCast<JSHTMLOptionsCollection*>(cell);
210     ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info);
211     thisObject->indexSetter(exec, propertyName, value);
212     return;
213 }
214
215 void setJSHTMLOptionsCollectionSelectedIndex(ExecState* exec, JSObject* thisObject, JSValue value)
216 {
217     JSHTMLOptionsCollection* castedThis = static_cast<JSHTMLOptionsCollection*>(thisObject);
218     HTMLOptionsCollection* imp = static_cast<HTMLOptionsCollection*>(castedThis->impl());
219     imp->setSelectedIndex(value.toInt32(exec));
220 }
221
222
223 void setJSHTMLOptionsCollectionLength(ExecState* exec, JSObject* thisObject, JSValue value)
224 {
225     static_cast<JSHTMLOptionsCollection*>(thisObject)->setLength(exec, value);
226 }
227
228
229 JSValue JSHTMLOptionsCollection::getConstructor(ExecState* exec, JSGlobalObject* globalObject)
230 {
231     return getDOMConstructor<JSHTMLOptionsCollectionConstructor>(exec, static_cast<JSDOMGlobalObject*>(globalObject));
232 }
233
234 EncodedJSValue JSC_HOST_CALL jsHTMLOptionsCollectionPrototypeFunctionAdd(ExecState* exec)
235 {
236     JSValue thisValue = exec->hostThisValue();
237     if (!thisValue.inherits(&JSHTMLOptionsCollection::s_info))
238         return throwVMTypeError(exec);
239     JSHTMLOptionsCollection* castedThis = static_cast<JSHTMLOptionsCollection*>(asObject(thisValue));
240     ASSERT_GC_OBJECT_INHERITS(castedThis, &JSHTMLOptionsCollection::s_info);
241     return JSValue::encode(castedThis->add(exec));
242 }
243
244 EncodedJSValue JSC_HOST_CALL jsHTMLOptionsCollectionPrototypeFunctionRemove(ExecState* exec)
245 {
246     JSValue thisValue = exec->hostThisValue();
247     if (!thisValue.inherits(&JSHTMLOptionsCollection::s_info))
248         return throwVMTypeError(exec);
249     JSHTMLOptionsCollection* castedThis = static_cast<JSHTMLOptionsCollection*>(asObject(thisValue));
250     ASSERT_GC_OBJECT_INHERITS(castedThis, &JSHTMLOptionsCollection::s_info);
251     return JSValue::encode(castedThis->remove(exec));
252 }
253
254 HTMLOptionsCollection* toHTMLOptionsCollection(JSC::JSValue value)
255 {
256     return value.inherits(&JSHTMLOptionsCollection::s_info) ? static_cast<JSHTMLOptionsCollection*>(asObject(value))->impl() : 0;
257 }
258
259 }