tizen beta release
[framework/web/webkit-efl.git] / DerivedSources / WebCore / JSHTMLSelectElement.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 "JSHTMLSelectElement.h"
23
24 #include "ExceptionCode.h"
25 #include "HTMLFormElement.h"
26 #include "HTMLNames.h"
27 #include "HTMLOptionsCollection.h"
28 #include "HTMLSelectElement.h"
29 #include "JSDOMBinding.h"
30 #include "JSHTMLElement.h"
31 #include "JSHTMLFormElement.h"
32 #include "JSHTMLOptionsCollection.h"
33 #include "JSNode.h"
34 #include "JSNodeList.h"
35 #include "JSValidityState.h"
36 #include "KURL.h"
37 #include "NameNodeList.h"
38 #include "Node.h"
39 #include "NodeList.h"
40 #include "ValidityState.h"
41 #include <runtime/Error.h>
42 #include <runtime/JSString.h>
43 #include <runtime/PropertyNameArray.h>
44 #include <wtf/GetPtr.h>
45
46 using namespace JSC;
47
48 namespace WebCore {
49
50 ASSERT_CLASS_FITS_IN_CELL(JSHTMLSelectElement);
51
52 /* Hash table */
53 #if ENABLE(JIT)
54 #define THUNK_GENERATOR(generator) , generator
55 #else
56 #define THUNK_GENERATOR(generator)
57 #endif
58 #if ENABLE(DFG_JIT)
59 #define INTRINSIC(intrinsic) , intrinsic
60 #else
61 #define INTRINSIC(intrinsic)
62 #endif
63
64 static const HashTableValue JSHTMLSelectElementTableValues[] =
65 {
66     { "type", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLSelectElementType), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
67     { "selectedIndex", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLSelectElementSelectedIndex), (intptr_t)setJSHTMLSelectElementSelectedIndex THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
68     { "value", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLSelectElementValue), (intptr_t)setJSHTMLSelectElementValue THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
69     { "length", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLSelectElementLength), (intptr_t)setJSHTMLSelectElementLength THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
70     { "form", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLSelectElementForm), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
71     { "validity", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLSelectElementValidity), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
72     { "willValidate", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLSelectElementWillValidate), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
73     { "validationMessage", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLSelectElementValidationMessage), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
74     { "options", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLSelectElementOptions), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
75     { "disabled", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLSelectElementDisabled), (intptr_t)setJSHTMLSelectElementDisabled THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
76     { "autofocus", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLSelectElementAutofocus), (intptr_t)setJSHTMLSelectElementAutofocus THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
77     { "multiple", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLSelectElementMultiple), (intptr_t)setJSHTMLSelectElementMultiple THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
78     { "name", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLSelectElementName), (intptr_t)setJSHTMLSelectElementName THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
79     { "required", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLSelectElementRequired), (intptr_t)setJSHTMLSelectElementRequired THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
80     { "size", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLSelectElementSize), (intptr_t)setJSHTMLSelectElementSize THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
81     { "labels", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLSelectElementLabels), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
82     { "constructor", DontEnum | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLSelectElementConstructor), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
83     { 0, 0, 0, 0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) }
84 };
85
86 #undef THUNK_GENERATOR
87 static const HashTable JSHTMLSelectElementTable = { 67, 63, JSHTMLSelectElementTableValues, 0 };
88 /* Hash table for constructor */
89 #if ENABLE(JIT)
90 #define THUNK_GENERATOR(generator) , generator
91 #else
92 #define THUNK_GENERATOR(generator)
93 #endif
94 #if ENABLE(DFG_JIT)
95 #define INTRINSIC(intrinsic) , intrinsic
96 #else
97 #define INTRINSIC(intrinsic)
98 #endif
99
100 static const HashTableValue JSHTMLSelectElementConstructorTableValues[] =
101 {
102     { 0, 0, 0, 0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) }
103 };
104
105 #undef THUNK_GENERATOR
106 static const HashTable JSHTMLSelectElementConstructorTable = { 1, 0, JSHTMLSelectElementConstructorTableValues, 0 };
107 const ClassInfo JSHTMLSelectElementConstructor::s_info = { "HTMLSelectElementConstructor", &DOMConstructorObject::s_info, &JSHTMLSelectElementConstructorTable, 0, CREATE_METHOD_TABLE(JSHTMLSelectElementConstructor) };
108
109 JSHTMLSelectElementConstructor::JSHTMLSelectElementConstructor(Structure* structure, JSDOMGlobalObject* globalObject)
110     : DOMConstructorObject(structure, globalObject)
111 {
112 }
113
114 void JSHTMLSelectElementConstructor::finishCreation(ExecState* exec, JSDOMGlobalObject* globalObject)
115 {
116     Base::finishCreation(exec->globalData());
117     ASSERT(inherits(&s_info));
118     putDirect(exec->globalData(), exec->propertyNames().prototype, JSHTMLSelectElementPrototype::self(exec, globalObject), DontDelete | ReadOnly);
119 }
120
121 bool JSHTMLSelectElementConstructor::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
122 {
123     return getStaticValueSlot<JSHTMLSelectElementConstructor, JSDOMWrapper>(exec, &JSHTMLSelectElementConstructorTable, static_cast<JSHTMLSelectElementConstructor*>(cell), propertyName, slot);
124 }
125
126 bool JSHTMLSelectElementConstructor::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
127 {
128     return getStaticValueDescriptor<JSHTMLSelectElementConstructor, JSDOMWrapper>(exec, &JSHTMLSelectElementConstructorTable, static_cast<JSHTMLSelectElementConstructor*>(object), propertyName, descriptor);
129 }
130
131 /* Hash table for prototype */
132 #if ENABLE(JIT)
133 #define THUNK_GENERATOR(generator) , generator
134 #else
135 #define THUNK_GENERATOR(generator)
136 #endif
137 #if ENABLE(DFG_JIT)
138 #define INTRINSIC(intrinsic) , intrinsic
139 #else
140 #define INTRINSIC(intrinsic)
141 #endif
142
143 static const HashTableValue JSHTMLSelectElementPrototypeTableValues[] =
144 {
145     { "checkValidity", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsHTMLSelectElementPrototypeFunctionCheckValidity), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
146     { "setCustomValidity", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsHTMLSelectElementPrototypeFunctionSetCustomValidity), (intptr_t)1 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
147     { "add", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsHTMLSelectElementPrototypeFunctionAdd), (intptr_t)2 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
148     { "remove", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsHTMLSelectElementPrototypeFunctionRemove), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
149     { "item", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsHTMLSelectElementPrototypeFunctionItem), (intptr_t)1 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
150     { "namedItem", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsHTMLSelectElementPrototypeFunctionNamedItem), (intptr_t)1 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
151     { 0, 0, 0, 0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) }
152 };
153
154 #undef THUNK_GENERATOR
155 static const HashTable JSHTMLSelectElementPrototypeTable = { 16, 15, JSHTMLSelectElementPrototypeTableValues, 0 };
156 const ClassInfo JSHTMLSelectElementPrototype::s_info = { "HTMLSelectElementPrototype", &JSC::JSNonFinalObject::s_info, &JSHTMLSelectElementPrototypeTable, 0, CREATE_METHOD_TABLE(JSHTMLSelectElementPrototype) };
157
158 JSObject* JSHTMLSelectElementPrototype::self(ExecState* exec, JSGlobalObject* globalObject)
159 {
160     return getDOMPrototype<JSHTMLSelectElement>(exec, globalObject);
161 }
162
163 bool JSHTMLSelectElementPrototype::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
164 {
165     JSHTMLSelectElementPrototype* thisObject = jsCast<JSHTMLSelectElementPrototype*>(cell);
166     return getStaticFunctionSlot<JSObject>(exec, &JSHTMLSelectElementPrototypeTable, thisObject, propertyName, slot);
167 }
168
169 bool JSHTMLSelectElementPrototype::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
170 {
171     JSHTMLSelectElementPrototype* thisObject = jsCast<JSHTMLSelectElementPrototype*>(object);
172     return getStaticFunctionDescriptor<JSObject>(exec, &JSHTMLSelectElementPrototypeTable, thisObject, propertyName, descriptor);
173 }
174
175 const ClassInfo JSHTMLSelectElement::s_info = { "HTMLSelectElement", &JSHTMLElement::s_info, &JSHTMLSelectElementTable, 0 , CREATE_METHOD_TABLE(JSHTMLSelectElement) };
176
177 JSHTMLSelectElement::JSHTMLSelectElement(Structure* structure, JSDOMGlobalObject* globalObject, PassRefPtr<HTMLSelectElement> impl)
178     : JSHTMLElement(structure, globalObject, impl)
179 {
180 }
181
182 void JSHTMLSelectElement::finishCreation(JSGlobalData& globalData)
183 {
184     Base::finishCreation(globalData);
185     ASSERT(inherits(&s_info));
186 }
187
188 JSObject* JSHTMLSelectElement::createPrototype(ExecState* exec, JSGlobalObject* globalObject)
189 {
190     return JSHTMLSelectElementPrototype::create(exec->globalData(), globalObject, JSHTMLSelectElementPrototype::createStructure(exec->globalData(), globalObject, JSHTMLElementPrototype::self(exec, globalObject)));
191 }
192
193 bool JSHTMLSelectElement::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
194 {
195     JSHTMLSelectElement* thisObject = jsCast<JSHTMLSelectElement*>(cell);
196     ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info);
197     const HashEntry* entry = JSHTMLSelectElementTable.entry(exec, propertyName);
198     if (entry) {
199         slot.setCustom(thisObject, entry->propertyGetter());
200         return true;
201     }
202     bool ok;
203     unsigned index = propertyName.toUInt32(ok);
204     if (ok && index < static_cast<HTMLSelectElement*>(thisObject->impl())->length()) {
205         slot.setCustomIndex(thisObject, index, indexGetter);
206         return true;
207     }
208     return getStaticValueSlot<JSHTMLSelectElement, Base>(exec, &JSHTMLSelectElementTable, thisObject, propertyName, slot);
209 }
210
211 bool JSHTMLSelectElement::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
212 {
213     JSHTMLSelectElement* thisObject = jsCast<JSHTMLSelectElement*>(object);
214     ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info);
215     const HashEntry* entry = JSHTMLSelectElementTable.entry(exec, propertyName);
216     if (entry) {
217         PropertySlot slot;
218         slot.setCustom(thisObject, entry->propertyGetter());
219         descriptor.setDescriptor(slot.getValue(exec, propertyName), entry->attributes());
220         return true;
221     }
222     bool ok;
223     unsigned index = propertyName.toUInt32(ok);
224     if (ok && index < static_cast<HTMLSelectElement*>(thisObject->impl())->length()) {
225         PropertySlot slot;
226         slot.setCustomIndex(thisObject, index, indexGetter);
227         descriptor.setDescriptor(slot.getValue(exec, propertyName), DontDelete);
228         return true;
229     }
230     return getStaticValueDescriptor<JSHTMLSelectElement, Base>(exec, &JSHTMLSelectElementTable, thisObject, propertyName, descriptor);
231 }
232
233 bool JSHTMLSelectElement::getOwnPropertySlotByIndex(JSCell* cell, ExecState* exec, unsigned propertyName, PropertySlot& slot)
234 {
235     JSHTMLSelectElement* thisObject = jsCast<JSHTMLSelectElement*>(cell);
236     ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info);
237     if (propertyName < static_cast<HTMLSelectElement*>(thisObject->impl())->length()) {
238         slot.setCustomIndex(thisObject, propertyName, thisObject->indexGetter);
239         return true;
240     }
241     return thisObject->methodTable()->getOwnPropertySlot(thisObject, exec, Identifier::from(exec, propertyName), slot);
242 }
243
244 JSValue jsHTMLSelectElementType(ExecState* exec, JSValue slotBase, const Identifier&)
245 {
246     JSHTMLSelectElement* castedThis = static_cast<JSHTMLSelectElement*>(asObject(slotBase));
247     UNUSED_PARAM(exec);
248     HTMLSelectElement* imp = static_cast<HTMLSelectElement*>(castedThis->impl());
249     JSValue result = jsString(exec, imp->type());
250     return result;
251 }
252
253
254 JSValue jsHTMLSelectElementSelectedIndex(ExecState* exec, JSValue slotBase, const Identifier&)
255 {
256     JSHTMLSelectElement* castedThis = static_cast<JSHTMLSelectElement*>(asObject(slotBase));
257     UNUSED_PARAM(exec);
258     HTMLSelectElement* imp = static_cast<HTMLSelectElement*>(castedThis->impl());
259     JSValue result = jsNumber(imp->selectedIndex());
260     return result;
261 }
262
263
264 JSValue jsHTMLSelectElementValue(ExecState* exec, JSValue slotBase, const Identifier&)
265 {
266     JSHTMLSelectElement* castedThis = static_cast<JSHTMLSelectElement*>(asObject(slotBase));
267     UNUSED_PARAM(exec);
268     HTMLSelectElement* imp = static_cast<HTMLSelectElement*>(castedThis->impl());
269     JSValue result = jsString(exec, imp->value());
270     return result;
271 }
272
273
274 JSValue jsHTMLSelectElementLength(ExecState* exec, JSValue slotBase, const Identifier&)
275 {
276     JSHTMLSelectElement* castedThis = static_cast<JSHTMLSelectElement*>(asObject(slotBase));
277     UNUSED_PARAM(exec);
278     HTMLSelectElement* imp = static_cast<HTMLSelectElement*>(castedThis->impl());
279     JSValue result = jsNumber(imp->length());
280     return result;
281 }
282
283
284 JSValue jsHTMLSelectElementForm(ExecState* exec, JSValue slotBase, const Identifier&)
285 {
286     JSHTMLSelectElement* castedThis = static_cast<JSHTMLSelectElement*>(asObject(slotBase));
287     UNUSED_PARAM(exec);
288     HTMLSelectElement* imp = static_cast<HTMLSelectElement*>(castedThis->impl());
289     JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->form()));
290     return result;
291 }
292
293
294 JSValue jsHTMLSelectElementValidity(ExecState* exec, JSValue slotBase, const Identifier&)
295 {
296     JSHTMLSelectElement* castedThis = static_cast<JSHTMLSelectElement*>(asObject(slotBase));
297     UNUSED_PARAM(exec);
298     HTMLSelectElement* imp = static_cast<HTMLSelectElement*>(castedThis->impl());
299     JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->validity()));
300     return result;
301 }
302
303
304 JSValue jsHTMLSelectElementWillValidate(ExecState* exec, JSValue slotBase, const Identifier&)
305 {
306     JSHTMLSelectElement* castedThis = static_cast<JSHTMLSelectElement*>(asObject(slotBase));
307     UNUSED_PARAM(exec);
308     HTMLSelectElement* imp = static_cast<HTMLSelectElement*>(castedThis->impl());
309     JSValue result = jsBoolean(imp->willValidate());
310     return result;
311 }
312
313
314 JSValue jsHTMLSelectElementValidationMessage(ExecState* exec, JSValue slotBase, const Identifier&)
315 {
316     JSHTMLSelectElement* castedThis = static_cast<JSHTMLSelectElement*>(asObject(slotBase));
317     UNUSED_PARAM(exec);
318     HTMLSelectElement* imp = static_cast<HTMLSelectElement*>(castedThis->impl());
319     JSValue result = jsString(exec, imp->validationMessage());
320     return result;
321 }
322
323
324 JSValue jsHTMLSelectElementOptions(ExecState* exec, JSValue slotBase, const Identifier&)
325 {
326     JSHTMLSelectElement* castedThis = static_cast<JSHTMLSelectElement*>(asObject(slotBase));
327     UNUSED_PARAM(exec);
328     HTMLSelectElement* imp = static_cast<HTMLSelectElement*>(castedThis->impl());
329     JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->options()));
330     return result;
331 }
332
333
334 JSValue jsHTMLSelectElementDisabled(ExecState* exec, JSValue slotBase, const Identifier&)
335 {
336     JSHTMLSelectElement* castedThis = static_cast<JSHTMLSelectElement*>(asObject(slotBase));
337     UNUSED_PARAM(exec);
338     HTMLSelectElement* imp = static_cast<HTMLSelectElement*>(castedThis->impl());
339     JSValue result = jsBoolean(imp->hasAttribute(WebCore::HTMLNames::disabledAttr));
340     return result;
341 }
342
343
344 JSValue jsHTMLSelectElementAutofocus(ExecState* exec, JSValue slotBase, const Identifier&)
345 {
346     JSHTMLSelectElement* castedThis = static_cast<JSHTMLSelectElement*>(asObject(slotBase));
347     UNUSED_PARAM(exec);
348     HTMLSelectElement* imp = static_cast<HTMLSelectElement*>(castedThis->impl());
349     JSValue result = jsBoolean(imp->hasAttribute(WebCore::HTMLNames::autofocusAttr));
350     return result;
351 }
352
353
354 JSValue jsHTMLSelectElementMultiple(ExecState* exec, JSValue slotBase, const Identifier&)
355 {
356     JSHTMLSelectElement* castedThis = static_cast<JSHTMLSelectElement*>(asObject(slotBase));
357     UNUSED_PARAM(exec);
358     HTMLSelectElement* imp = static_cast<HTMLSelectElement*>(castedThis->impl());
359     JSValue result = jsBoolean(imp->multiple());
360     return result;
361 }
362
363
364 JSValue jsHTMLSelectElementName(ExecState* exec, JSValue slotBase, const Identifier&)
365 {
366     JSHTMLSelectElement* castedThis = static_cast<JSHTMLSelectElement*>(asObject(slotBase));
367     UNUSED_PARAM(exec);
368     HTMLSelectElement* imp = static_cast<HTMLSelectElement*>(castedThis->impl());
369     JSValue result = jsString(exec, imp->name());
370     return result;
371 }
372
373
374 JSValue jsHTMLSelectElementRequired(ExecState* exec, JSValue slotBase, const Identifier&)
375 {
376     JSHTMLSelectElement* castedThis = static_cast<JSHTMLSelectElement*>(asObject(slotBase));
377     UNUSED_PARAM(exec);
378     HTMLSelectElement* imp = static_cast<HTMLSelectElement*>(castedThis->impl());
379     JSValue result = jsBoolean(imp->hasAttribute(WebCore::HTMLNames::requiredAttr));
380     return result;
381 }
382
383
384 JSValue jsHTMLSelectElementSize(ExecState* exec, JSValue slotBase, const Identifier&)
385 {
386     JSHTMLSelectElement* castedThis = static_cast<JSHTMLSelectElement*>(asObject(slotBase));
387     UNUSED_PARAM(exec);
388     HTMLSelectElement* imp = static_cast<HTMLSelectElement*>(castedThis->impl());
389     JSValue result = jsNumber(imp->size());
390     return result;
391 }
392
393
394 JSValue jsHTMLSelectElementLabels(ExecState* exec, JSValue slotBase, const Identifier&)
395 {
396     JSHTMLSelectElement* castedThis = static_cast<JSHTMLSelectElement*>(asObject(slotBase));
397     UNUSED_PARAM(exec);
398     HTMLSelectElement* imp = static_cast<HTMLSelectElement*>(castedThis->impl());
399     JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->labels()));
400     return result;
401 }
402
403
404 JSValue jsHTMLSelectElementConstructor(ExecState* exec, JSValue slotBase, const Identifier&)
405 {
406     JSHTMLSelectElement* domObject = static_cast<JSHTMLSelectElement*>(asObject(slotBase));
407     return JSHTMLSelectElement::getConstructor(exec, domObject->globalObject());
408 }
409
410 void JSHTMLSelectElement::put(JSCell* cell, ExecState* exec, const Identifier& propertyName, JSValue value, PutPropertySlot& slot)
411 {
412     JSHTMLSelectElement* thisObject = jsCast<JSHTMLSelectElement*>(cell);
413     ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info);
414     bool ok;
415     unsigned index = propertyName.toUInt32(ok);
416     if (ok) {
417         thisObject->indexSetter(exec, index, value);
418         return;
419     }
420     lookupPut<JSHTMLSelectElement, Base>(exec, propertyName, value, &JSHTMLSelectElementTable, thisObject, slot);
421 }
422
423 void JSHTMLSelectElement::putByIndex(JSCell* cell, ExecState* exec, unsigned propertyName, JSValue value)
424 {
425     JSHTMLSelectElement* thisObject = jsCast<JSHTMLSelectElement*>(cell);
426     ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info);
427     thisObject->indexSetter(exec, propertyName, value);
428     return;
429 }
430
431 void setJSHTMLSelectElementSelectedIndex(ExecState* exec, JSObject* thisObject, JSValue value)
432 {
433     JSHTMLSelectElement* castedThis = static_cast<JSHTMLSelectElement*>(thisObject);
434     HTMLSelectElement* imp = static_cast<HTMLSelectElement*>(castedThis->impl());
435     imp->setSelectedIndex(value.toInt32(exec));
436 }
437
438
439 void setJSHTMLSelectElementValue(ExecState* exec, JSObject* thisObject, JSValue value)
440 {
441     JSHTMLSelectElement* castedThis = static_cast<JSHTMLSelectElement*>(thisObject);
442     HTMLSelectElement* imp = static_cast<HTMLSelectElement*>(castedThis->impl());
443     imp->setValue(valueToStringWithNullCheck(exec, value));
444 }
445
446
447 void setJSHTMLSelectElementLength(ExecState* exec, JSObject* thisObject, JSValue value)
448 {
449     JSHTMLSelectElement* castedThis = static_cast<JSHTMLSelectElement*>(thisObject);
450     HTMLSelectElement* imp = static_cast<HTMLSelectElement*>(castedThis->impl());
451     ExceptionCode ec = 0;
452     imp->setLength(value.toUInt32(exec), ec);
453     setDOMException(exec, ec);
454 }
455
456
457 void setJSHTMLSelectElementDisabled(ExecState* exec, JSObject* thisObject, JSValue value)
458 {
459     JSHTMLSelectElement* castedThis = static_cast<JSHTMLSelectElement*>(thisObject);
460     HTMLSelectElement* imp = static_cast<HTMLSelectElement*>(castedThis->impl());
461     imp->setBooleanAttribute(WebCore::HTMLNames::disabledAttr, value.toBoolean(exec));
462 }
463
464
465 void setJSHTMLSelectElementAutofocus(ExecState* exec, JSObject* thisObject, JSValue value)
466 {
467     JSHTMLSelectElement* castedThis = static_cast<JSHTMLSelectElement*>(thisObject);
468     HTMLSelectElement* imp = static_cast<HTMLSelectElement*>(castedThis->impl());
469     imp->setBooleanAttribute(WebCore::HTMLNames::autofocusAttr, value.toBoolean(exec));
470 }
471
472
473 void setJSHTMLSelectElementMultiple(ExecState* exec, JSObject* thisObject, JSValue value)
474 {
475     JSHTMLSelectElement* castedThis = static_cast<JSHTMLSelectElement*>(thisObject);
476     HTMLSelectElement* imp = static_cast<HTMLSelectElement*>(castedThis->impl());
477     imp->setMultiple(value.toBoolean(exec));
478 }
479
480
481 void setJSHTMLSelectElementName(ExecState* exec, JSObject* thisObject, JSValue value)
482 {
483     JSHTMLSelectElement* castedThis = static_cast<JSHTMLSelectElement*>(thisObject);
484     HTMLSelectElement* imp = static_cast<HTMLSelectElement*>(castedThis->impl());
485     imp->setName(valueToStringWithNullCheck(exec, value));
486 }
487
488
489 void setJSHTMLSelectElementRequired(ExecState* exec, JSObject* thisObject, JSValue value)
490 {
491     JSHTMLSelectElement* castedThis = static_cast<JSHTMLSelectElement*>(thisObject);
492     HTMLSelectElement* imp = static_cast<HTMLSelectElement*>(castedThis->impl());
493     imp->setBooleanAttribute(WebCore::HTMLNames::requiredAttr, value.toBoolean(exec));
494 }
495
496
497 void setJSHTMLSelectElementSize(ExecState* exec, JSObject* thisObject, JSValue value)
498 {
499     JSHTMLSelectElement* castedThis = static_cast<JSHTMLSelectElement*>(thisObject);
500     HTMLSelectElement* imp = static_cast<HTMLSelectElement*>(castedThis->impl());
501     imp->setSize(value.toInt32(exec));
502 }
503
504
505 void JSHTMLSelectElement::getOwnPropertyNames(JSObject* object, ExecState* exec, PropertyNameArray& propertyNames, EnumerationMode mode)
506 {
507     JSHTMLSelectElement* thisObject = jsCast<JSHTMLSelectElement*>(object);
508     ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info);
509     for (unsigned i = 0; i < static_cast<HTMLSelectElement*>(thisObject->impl())->length(); ++i)
510         propertyNames.add(Identifier::from(exec, i));
511      Base::getOwnPropertyNames(thisObject, exec, propertyNames, mode);
512 }
513
514 JSValue JSHTMLSelectElement::getConstructor(ExecState* exec, JSGlobalObject* globalObject)
515 {
516     return getDOMConstructor<JSHTMLSelectElementConstructor>(exec, static_cast<JSDOMGlobalObject*>(globalObject));
517 }
518
519 EncodedJSValue JSC_HOST_CALL jsHTMLSelectElementPrototypeFunctionCheckValidity(ExecState* exec)
520 {
521     JSValue thisValue = exec->hostThisValue();
522     if (!thisValue.inherits(&JSHTMLSelectElement::s_info))
523         return throwVMTypeError(exec);
524     JSHTMLSelectElement* castedThis = static_cast<JSHTMLSelectElement*>(asObject(thisValue));
525     ASSERT_GC_OBJECT_INHERITS(castedThis, &JSHTMLSelectElement::s_info);
526     HTMLSelectElement* imp = static_cast<HTMLSelectElement*>(castedThis->impl());
527
528     JSC::JSValue result = jsBoolean(imp->checkValidity());
529     return JSValue::encode(result);
530 }
531
532 EncodedJSValue JSC_HOST_CALL jsHTMLSelectElementPrototypeFunctionSetCustomValidity(ExecState* exec)
533 {
534     JSValue thisValue = exec->hostThisValue();
535     if (!thisValue.inherits(&JSHTMLSelectElement::s_info))
536         return throwVMTypeError(exec);
537     JSHTMLSelectElement* castedThis = static_cast<JSHTMLSelectElement*>(asObject(thisValue));
538     ASSERT_GC_OBJECT_INHERITS(castedThis, &JSHTMLSelectElement::s_info);
539     HTMLSelectElement* imp = static_cast<HTMLSelectElement*>(castedThis->impl());
540     if (exec->argumentCount() < 1)
541         return throwVMError(exec, createTypeError(exec, "Not enough arguments"));
542     const String& error(valueToStringWithUndefinedOrNullCheck(exec, MAYBE_MISSING_PARAMETER(exec, 0, MissingIsUndefined)));
543     if (exec->hadException())
544         return JSValue::encode(jsUndefined());
545     imp->setCustomValidity(error);
546     return JSValue::encode(jsUndefined());
547 }
548
549 EncodedJSValue JSC_HOST_CALL jsHTMLSelectElementPrototypeFunctionAdd(ExecState* exec)
550 {
551     JSValue thisValue = exec->hostThisValue();
552     if (!thisValue.inherits(&JSHTMLSelectElement::s_info))
553         return throwVMTypeError(exec);
554     JSHTMLSelectElement* castedThis = static_cast<JSHTMLSelectElement*>(asObject(thisValue));
555     ASSERT_GC_OBJECT_INHERITS(castedThis, &JSHTMLSelectElement::s_info);
556     HTMLSelectElement* imp = static_cast<HTMLSelectElement*>(castedThis->impl());
557     ExceptionCode ec = 0;
558     HTMLElement* element(toHTMLElement(MAYBE_MISSING_PARAMETER(exec, 0, MissingIsUndefined)));
559     if (exec->hadException())
560         return JSValue::encode(jsUndefined());
561     HTMLElement* before(toHTMLElement(MAYBE_MISSING_PARAMETER(exec, 1, MissingIsUndefined)));
562     if (exec->hadException())
563         return JSValue::encode(jsUndefined());
564     imp->add(element, before, ec);
565     setDOMException(exec, ec);
566     return JSValue::encode(jsUndefined());
567 }
568
569 EncodedJSValue JSC_HOST_CALL jsHTMLSelectElementPrototypeFunctionRemove(ExecState* exec)
570 {
571     JSValue thisValue = exec->hostThisValue();
572     if (!thisValue.inherits(&JSHTMLSelectElement::s_info))
573         return throwVMTypeError(exec);
574     JSHTMLSelectElement* castedThis = static_cast<JSHTMLSelectElement*>(asObject(thisValue));
575     ASSERT_GC_OBJECT_INHERITS(castedThis, &JSHTMLSelectElement::s_info);
576     return JSValue::encode(castedThis->remove(exec));
577 }
578
579 EncodedJSValue JSC_HOST_CALL jsHTMLSelectElementPrototypeFunctionItem(ExecState* exec)
580 {
581     JSValue thisValue = exec->hostThisValue();
582     if (!thisValue.inherits(&JSHTMLSelectElement::s_info))
583         return throwVMTypeError(exec);
584     JSHTMLSelectElement* castedThis = static_cast<JSHTMLSelectElement*>(asObject(thisValue));
585     ASSERT_GC_OBJECT_INHERITS(castedThis, &JSHTMLSelectElement::s_info);
586     HTMLSelectElement* imp = static_cast<HTMLSelectElement*>(castedThis->impl());
587     int index(MAYBE_MISSING_PARAMETER(exec, 0, MissingIsUndefined).toUInt32(exec));
588     if (index < 0) {
589         setDOMException(exec, INDEX_SIZE_ERR);
590         return JSValue::encode(jsUndefined());
591     }
592     if (exec->hadException())
593         return JSValue::encode(jsUndefined());
594
595     JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->item(index)));
596     return JSValue::encode(result);
597 }
598
599 EncodedJSValue JSC_HOST_CALL jsHTMLSelectElementPrototypeFunctionNamedItem(ExecState* exec)
600 {
601     JSValue thisValue = exec->hostThisValue();
602     if (!thisValue.inherits(&JSHTMLSelectElement::s_info))
603         return throwVMTypeError(exec);
604     JSHTMLSelectElement* castedThis = static_cast<JSHTMLSelectElement*>(asObject(thisValue));
605     ASSERT_GC_OBJECT_INHERITS(castedThis, &JSHTMLSelectElement::s_info);
606     HTMLSelectElement* imp = static_cast<HTMLSelectElement*>(castedThis->impl());
607     const String& name(ustringToString(MAYBE_MISSING_PARAMETER(exec, 0, MissingIsUndefined).isEmpty() ? UString() : MAYBE_MISSING_PARAMETER(exec, 0, MissingIsUndefined).toString(exec)));
608     if (exec->hadException())
609         return JSValue::encode(jsUndefined());
610
611     JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->namedItem(name)));
612     return JSValue::encode(result);
613 }
614
615
616 JSValue JSHTMLSelectElement::indexGetter(ExecState* exec, JSValue slotBase, unsigned index)
617 {
618     JSHTMLSelectElement* thisObj = static_cast<JSHTMLSelectElement*>(asObject(slotBase));
619     ASSERT_GC_OBJECT_INHERITS(thisObj, &s_info);
620     return toJS(exec, thisObj->globalObject(), static_cast<HTMLSelectElement*>(thisObj->impl())->item(index));
621 }
622
623
624 }