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
41 static const HashTableValue JSHTMLOptionsCollectionTableValues[4] =
42 {
43 { "selectedIndex", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLOptionsCollectionSelectedIndex), (intptr_t)setJSHTMLOptionsCollectionSelectedIndex THUNK_GENERATOR(0) },
44 { "length", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLOptionsCollectionLength), (intptr_t)setJSHTMLOptionsCollectionLength THUNK_GENERATOR(0) },
45 { "constructor", DontEnum | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLOptionsCollectionConstructor), (intptr_t)0 THUNK_GENERATOR(0) },
46 { 0, 0, 0, 0 THUNK_GENERATOR(0) }
47 };
48
49 #undef THUNK_GENERATOR
50 static JSC_CONST_HASHTABLE HashTable JSHTMLOptionsCollectionTable = { 9, 7, JSHTMLOptionsCollectionTableValues, 0 };
51 /* Hash table for constructor */
52 #if ENABLE(JIT)
53 #define THUNK_GENERATOR(generator) , generator
54 #else
55 #define THUNK_GENERATOR(generator)
56 #endif
57
58 static const HashTableValue JSHTMLOptionsCollectionConstructorTableValues[1] =
59 {
60 { 0, 0, 0, 0 THUNK_GENERATOR(0) }
61 };
62
63 #undef THUNK_GENERATOR
64 static JSC_CONST_HASHTABLE HashTable JSHTMLOptionsCollectionConstructorTable = { 1, 0, JSHTMLOptionsCollectionConstructorTableValues, 0 };
65 class JSHTMLOptionsCollectionConstructor : public DOMConstructorObject {
66 public:
67 JSHTMLOptionsCollectionConstructor(JSC::ExecState*, JSC::Structure*, JSDOMGlobalObject*);
68
69 virtual bool getOwnPropertySlot(JSC::ExecState*, const JSC::Identifier&, JSC::PropertySlot&);
70 virtual bool getOwnPropertyDescriptor(JSC::ExecState*, const JSC::Identifier&, JSC::PropertyDescriptor&);
71 static const JSC::ClassInfo s_info;
createStructure(JSC::JSGlobalData & globalData,JSC::JSValue prototype)72 static JSC::Structure* createStructure(JSC::JSGlobalData& globalData, JSC::JSValue prototype)
73 {
74 return JSC::Structure::create(globalData, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), AnonymousSlotCount, &s_info);
75 }
76 protected:
77 static const unsigned StructureFlags = JSC::OverridesGetOwnPropertySlot | JSC::ImplementsHasInstance | DOMConstructorObject::StructureFlags;
78 };
79
80 const ClassInfo JSHTMLOptionsCollectionConstructor::s_info = { "HTMLOptionsCollectionConstructor", &DOMConstructorObject::s_info, &JSHTMLOptionsCollectionConstructorTable, 0 };
81
JSHTMLOptionsCollectionConstructor(ExecState * exec,Structure * structure,JSDOMGlobalObject * globalObject)82 JSHTMLOptionsCollectionConstructor::JSHTMLOptionsCollectionConstructor(ExecState* exec, Structure* structure, JSDOMGlobalObject* globalObject)
83 : DOMConstructorObject(structure, globalObject)
84 {
85 ASSERT(inherits(&s_info));
86 putDirect(exec->globalData(), exec->propertyNames().prototype, JSHTMLOptionsCollectionPrototype::self(exec, globalObject), DontDelete | ReadOnly);
87 }
88
getOwnPropertySlot(ExecState * exec,const Identifier & propertyName,PropertySlot & slot)89 bool JSHTMLOptionsCollectionConstructor::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
90 {
91 return getStaticValueSlot<JSHTMLOptionsCollectionConstructor, JSDOMWrapper>(exec, &JSHTMLOptionsCollectionConstructorTable, this, propertyName, slot);
92 }
93
getOwnPropertyDescriptor(ExecState * exec,const Identifier & propertyName,PropertyDescriptor & descriptor)94 bool JSHTMLOptionsCollectionConstructor::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
95 {
96 return getStaticValueDescriptor<JSHTMLOptionsCollectionConstructor, JSDOMWrapper>(exec, &JSHTMLOptionsCollectionConstructorTable, this, 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
106 static const HashTableValue JSHTMLOptionsCollectionPrototypeTableValues[3] =
107 {
108 { "add", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsHTMLOptionsCollectionPrototypeFunctionAdd), (intptr_t)2 THUNK_GENERATOR(0) },
109 { "remove", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsHTMLOptionsCollectionPrototypeFunctionRemove), (intptr_t)1 THUNK_GENERATOR(0) },
110 { 0, 0, 0, 0 THUNK_GENERATOR(0) }
111 };
112
113 #undef THUNK_GENERATOR
114 static JSC_CONST_HASHTABLE HashTable JSHTMLOptionsCollectionPrototypeTable = { 4, 3, JSHTMLOptionsCollectionPrototypeTableValues, 0 };
115 const ClassInfo JSHTMLOptionsCollectionPrototype::s_info = { "HTMLOptionsCollectionPrototype", &JSC::JSObjectWithGlobalObject::s_info, &JSHTMLOptionsCollectionPrototypeTable, 0 };
116
self(ExecState * exec,JSGlobalObject * globalObject)117 JSObject* JSHTMLOptionsCollectionPrototype::self(ExecState* exec, JSGlobalObject* globalObject)
118 {
119 return getDOMPrototype<JSHTMLOptionsCollection>(exec, globalObject);
120 }
121
getOwnPropertySlot(ExecState * exec,const Identifier & propertyName,PropertySlot & slot)122 bool JSHTMLOptionsCollectionPrototype::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
123 {
124 return getStaticFunctionSlot<JSObject>(exec, &JSHTMLOptionsCollectionPrototypeTable, this, propertyName, slot);
125 }
126
getOwnPropertyDescriptor(ExecState * exec,const Identifier & propertyName,PropertyDescriptor & descriptor)127 bool JSHTMLOptionsCollectionPrototype::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
128 {
129 return getStaticFunctionDescriptor<JSObject>(exec, &JSHTMLOptionsCollectionPrototypeTable, this, propertyName, descriptor);
130 }
131
132 const ClassInfo JSHTMLOptionsCollection::s_info = { "HTMLOptionsCollection", &JSHTMLCollection::s_info, &JSHTMLOptionsCollectionTable, 0 };
133
JSHTMLOptionsCollection(Structure * structure,JSDOMGlobalObject * globalObject,PassRefPtr<HTMLOptionsCollection> impl)134 JSHTMLOptionsCollection::JSHTMLOptionsCollection(Structure* structure, JSDOMGlobalObject* globalObject, PassRefPtr<HTMLOptionsCollection> impl)
135 : JSHTMLCollection(structure, globalObject, impl)
136 {
137 ASSERT(inherits(&s_info));
138 }
139
createPrototype(ExecState * exec,JSGlobalObject * globalObject)140 JSObject* JSHTMLOptionsCollection::createPrototype(ExecState* exec, JSGlobalObject* globalObject)
141 {
142 return new (exec) JSHTMLOptionsCollectionPrototype(exec->globalData(), globalObject, JSHTMLOptionsCollectionPrototype::createStructure(exec->globalData(), JSHTMLCollectionPrototype::self(exec, globalObject)));
143 }
144
getOwnPropertySlot(ExecState * exec,const Identifier & propertyName,PropertySlot & slot)145 bool JSHTMLOptionsCollection::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
146 {
147 return getStaticValueSlot<JSHTMLOptionsCollection, Base>(exec, &JSHTMLOptionsCollectionTable, this, propertyName, slot);
148 }
149
getOwnPropertyDescriptor(ExecState * exec,const Identifier & propertyName,PropertyDescriptor & descriptor)150 bool JSHTMLOptionsCollection::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
151 {
152 return getStaticValueDescriptor<JSHTMLOptionsCollection, Base>(exec, &JSHTMLOptionsCollectionTable, this, propertyName, descriptor);
153 }
154
jsHTMLOptionsCollectionSelectedIndex(ExecState * exec,JSValue slotBase,const Identifier &)155 JSValue jsHTMLOptionsCollectionSelectedIndex(ExecState* exec, JSValue slotBase, const Identifier&)
156 {
157 JSHTMLOptionsCollection* castedThis = static_cast<JSHTMLOptionsCollection*>(asObject(slotBase));
158 UNUSED_PARAM(exec);
159 HTMLOptionsCollection* imp = static_cast<HTMLOptionsCollection*>(castedThis->impl());
160 JSValue result = jsNumber(imp->selectedIndex());
161 return result;
162 }
163
164
jsHTMLOptionsCollectionLength(ExecState * exec,JSValue slotBase,const Identifier &)165 JSValue jsHTMLOptionsCollectionLength(ExecState* exec, JSValue slotBase, const Identifier&)
166 {
167 JSHTMLOptionsCollection* castedThis = static_cast<JSHTMLOptionsCollection*>(asObject(slotBase));
168 return castedThis->length(exec);
169 }
170
171
jsHTMLOptionsCollectionConstructor(ExecState * exec,JSValue slotBase,const Identifier &)172 JSValue jsHTMLOptionsCollectionConstructor(ExecState* exec, JSValue slotBase, const Identifier&)
173 {
174 JSHTMLOptionsCollection* domObject = static_cast<JSHTMLOptionsCollection*>(asObject(slotBase));
175 return JSHTMLOptionsCollection::getConstructor(exec, domObject->globalObject());
176 }
177
put(ExecState * exec,const Identifier & propertyName,JSValue value,PutPropertySlot & slot)178 void JSHTMLOptionsCollection::put(ExecState* exec, const Identifier& propertyName, JSValue value, PutPropertySlot& slot)
179 {
180 bool ok;
181 unsigned index = propertyName.toUInt32(ok);
182 if (ok) {
183 indexSetter(exec, index, value);
184 return;
185 }
186 lookupPut<JSHTMLOptionsCollection, Base>(exec, propertyName, value, &JSHTMLOptionsCollectionTable, this, slot);
187 }
188
put(ExecState * exec,unsigned propertyName,JSValue value)189 void JSHTMLOptionsCollection::put(ExecState* exec, unsigned propertyName, JSValue value)
190 {
191 indexSetter(exec, propertyName, value);
192 return;
193 }
194
setJSHTMLOptionsCollectionSelectedIndex(ExecState * exec,JSObject * thisObject,JSValue value)195 void setJSHTMLOptionsCollectionSelectedIndex(ExecState* exec, JSObject* thisObject, JSValue value)
196 {
197 JSHTMLOptionsCollection* castedThis = static_cast<JSHTMLOptionsCollection*>(thisObject);
198 HTMLOptionsCollection* imp = static_cast<HTMLOptionsCollection*>(castedThis->impl());
199 imp->setSelectedIndex(value.toInt32(exec));
200 }
201
202
setJSHTMLOptionsCollectionLength(ExecState * exec,JSObject * thisObject,JSValue value)203 void setJSHTMLOptionsCollectionLength(ExecState* exec, JSObject* thisObject, JSValue value)
204 {
205 static_cast<JSHTMLOptionsCollection*>(thisObject)->setLength(exec, value);
206 }
207
208
getConstructor(ExecState * exec,JSGlobalObject * globalObject)209 JSValue JSHTMLOptionsCollection::getConstructor(ExecState* exec, JSGlobalObject* globalObject)
210 {
211 return getDOMConstructor<JSHTMLOptionsCollectionConstructor>(exec, static_cast<JSDOMGlobalObject*>(globalObject));
212 }
213
jsHTMLOptionsCollectionPrototypeFunctionAdd(ExecState * exec)214 EncodedJSValue JSC_HOST_CALL jsHTMLOptionsCollectionPrototypeFunctionAdd(ExecState* exec)
215 {
216 JSValue thisValue = exec->hostThisValue();
217 if (!thisValue.inherits(&JSHTMLOptionsCollection::s_info))
218 return throwVMTypeError(exec);
219 JSHTMLOptionsCollection* castedThis = static_cast<JSHTMLOptionsCollection*>(asObject(thisValue));
220 return JSValue::encode(castedThis->add(exec));
221 }
222
jsHTMLOptionsCollectionPrototypeFunctionRemove(ExecState * exec)223 EncodedJSValue JSC_HOST_CALL jsHTMLOptionsCollectionPrototypeFunctionRemove(ExecState* exec)
224 {
225 JSValue thisValue = exec->hostThisValue();
226 if (!thisValue.inherits(&JSHTMLOptionsCollection::s_info))
227 return throwVMTypeError(exec);
228 JSHTMLOptionsCollection* castedThis = static_cast<JSHTMLOptionsCollection*>(asObject(thisValue));
229 return JSValue::encode(castedThis->remove(exec));
230 }
231
toHTMLOptionsCollection(JSC::JSValue value)232 HTMLOptionsCollection* toHTMLOptionsCollection(JSC::JSValue value)
233 {
234 return value.inherits(&JSHTMLOptionsCollection::s_info) ? static_cast<JSHTMLOptionsCollection*>(asObject(value))->impl() : 0;
235 }
236
237 }
238