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.
22 #include "JSHTMLSelectElement.h"
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"
34 #include "JSNodeList.h"
35 #include "JSValidityState.h"
37 #include "NameNodeList.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>
50 ASSERT_CLASS_FITS_IN_CELL(JSHTMLSelectElement);
54 #define THUNK_GENERATOR(generator) , generator
56 #define THUNK_GENERATOR(generator)
59 #define INTRINSIC(intrinsic) , intrinsic
61 #define INTRINSIC(intrinsic)
64 static const HashTableValue JSHTMLSelectElementTableValues[] =
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) }
86 #undef THUNK_GENERATOR
87 static const HashTable JSHTMLSelectElementTable = { 67, 63, JSHTMLSelectElementTableValues, 0 };
88 /* Hash table for constructor */
90 #define THUNK_GENERATOR(generator) , generator
92 #define THUNK_GENERATOR(generator)
95 #define INTRINSIC(intrinsic) , intrinsic
97 #define INTRINSIC(intrinsic)
100 static const HashTableValue JSHTMLSelectElementConstructorTableValues[] =
102 { 0, 0, 0, 0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) }
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) };
109 JSHTMLSelectElementConstructor::JSHTMLSelectElementConstructor(Structure* structure, JSDOMGlobalObject* globalObject)
110 : DOMConstructorObject(structure, globalObject)
114 void JSHTMLSelectElementConstructor::finishCreation(ExecState* exec, JSDOMGlobalObject* globalObject)
116 Base::finishCreation(exec->globalData());
117 ASSERT(inherits(&s_info));
118 putDirect(exec->globalData(), exec->propertyNames().prototype, JSHTMLSelectElementPrototype::self(exec, globalObject), DontDelete | ReadOnly);
121 bool JSHTMLSelectElementConstructor::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
123 return getStaticValueSlot<JSHTMLSelectElementConstructor, JSDOMWrapper>(exec, &JSHTMLSelectElementConstructorTable, static_cast<JSHTMLSelectElementConstructor*>(cell), propertyName, slot);
126 bool JSHTMLSelectElementConstructor::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
128 return getStaticValueDescriptor<JSHTMLSelectElementConstructor, JSDOMWrapper>(exec, &JSHTMLSelectElementConstructorTable, static_cast<JSHTMLSelectElementConstructor*>(object), propertyName, descriptor);
131 /* Hash table for prototype */
133 #define THUNK_GENERATOR(generator) , generator
135 #define THUNK_GENERATOR(generator)
138 #define INTRINSIC(intrinsic) , intrinsic
140 #define INTRINSIC(intrinsic)
143 static const HashTableValue JSHTMLSelectElementPrototypeTableValues[] =
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) }
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) };
158 JSObject* JSHTMLSelectElementPrototype::self(ExecState* exec, JSGlobalObject* globalObject)
160 return getDOMPrototype<JSHTMLSelectElement>(exec, globalObject);
163 bool JSHTMLSelectElementPrototype::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
165 JSHTMLSelectElementPrototype* thisObject = jsCast<JSHTMLSelectElementPrototype*>(cell);
166 return getStaticFunctionSlot<JSObject>(exec, &JSHTMLSelectElementPrototypeTable, thisObject, propertyName, slot);
169 bool JSHTMLSelectElementPrototype::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
171 JSHTMLSelectElementPrototype* thisObject = jsCast<JSHTMLSelectElementPrototype*>(object);
172 return getStaticFunctionDescriptor<JSObject>(exec, &JSHTMLSelectElementPrototypeTable, thisObject, propertyName, descriptor);
175 const ClassInfo JSHTMLSelectElement::s_info = { "HTMLSelectElement", &JSHTMLElement::s_info, &JSHTMLSelectElementTable, 0 , CREATE_METHOD_TABLE(JSHTMLSelectElement) };
177 JSHTMLSelectElement::JSHTMLSelectElement(Structure* structure, JSDOMGlobalObject* globalObject, PassRefPtr<HTMLSelectElement> impl)
178 : JSHTMLElement(structure, globalObject, impl)
182 void JSHTMLSelectElement::finishCreation(JSGlobalData& globalData)
184 Base::finishCreation(globalData);
185 ASSERT(inherits(&s_info));
188 JSObject* JSHTMLSelectElement::createPrototype(ExecState* exec, JSGlobalObject* globalObject)
190 return JSHTMLSelectElementPrototype::create(exec->globalData(), globalObject, JSHTMLSelectElementPrototype::createStructure(exec->globalData(), globalObject, JSHTMLElementPrototype::self(exec, globalObject)));
193 bool JSHTMLSelectElement::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
195 JSHTMLSelectElement* thisObject = jsCast<JSHTMLSelectElement*>(cell);
196 ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info);
197 const HashEntry* entry = JSHTMLSelectElementTable.entry(exec, propertyName);
199 slot.setCustom(thisObject, entry->propertyGetter());
203 unsigned index = propertyName.toUInt32(ok);
204 if (ok && index < static_cast<HTMLSelectElement*>(thisObject->impl())->length()) {
205 slot.setCustomIndex(thisObject, index, indexGetter);
208 return getStaticValueSlot<JSHTMLSelectElement, Base>(exec, &JSHTMLSelectElementTable, thisObject, propertyName, slot);
211 bool JSHTMLSelectElement::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
213 JSHTMLSelectElement* thisObject = jsCast<JSHTMLSelectElement*>(object);
214 ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info);
215 const HashEntry* entry = JSHTMLSelectElementTable.entry(exec, propertyName);
218 slot.setCustom(thisObject, entry->propertyGetter());
219 descriptor.setDescriptor(slot.getValue(exec, propertyName), entry->attributes());
223 unsigned index = propertyName.toUInt32(ok);
224 if (ok && index < static_cast<HTMLSelectElement*>(thisObject->impl())->length()) {
226 slot.setCustomIndex(thisObject, index, indexGetter);
227 descriptor.setDescriptor(slot.getValue(exec, propertyName), DontDelete);
230 return getStaticValueDescriptor<JSHTMLSelectElement, Base>(exec, &JSHTMLSelectElementTable, thisObject, propertyName, descriptor);
233 bool JSHTMLSelectElement::getOwnPropertySlotByIndex(JSCell* cell, ExecState* exec, unsigned propertyName, PropertySlot& slot)
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);
241 return thisObject->methodTable()->getOwnPropertySlot(thisObject, exec, Identifier::from(exec, propertyName), slot);
244 JSValue jsHTMLSelectElementType(ExecState* exec, JSValue slotBase, const Identifier&)
246 JSHTMLSelectElement* castedThis = static_cast<JSHTMLSelectElement*>(asObject(slotBase));
248 HTMLSelectElement* imp = static_cast<HTMLSelectElement*>(castedThis->impl());
249 JSValue result = jsString(exec, imp->type());
254 JSValue jsHTMLSelectElementSelectedIndex(ExecState* exec, JSValue slotBase, const Identifier&)
256 JSHTMLSelectElement* castedThis = static_cast<JSHTMLSelectElement*>(asObject(slotBase));
258 HTMLSelectElement* imp = static_cast<HTMLSelectElement*>(castedThis->impl());
259 JSValue result = jsNumber(imp->selectedIndex());
264 JSValue jsHTMLSelectElementValue(ExecState* exec, JSValue slotBase, const Identifier&)
266 JSHTMLSelectElement* castedThis = static_cast<JSHTMLSelectElement*>(asObject(slotBase));
268 HTMLSelectElement* imp = static_cast<HTMLSelectElement*>(castedThis->impl());
269 JSValue result = jsString(exec, imp->value());
274 JSValue jsHTMLSelectElementLength(ExecState* exec, JSValue slotBase, const Identifier&)
276 JSHTMLSelectElement* castedThis = static_cast<JSHTMLSelectElement*>(asObject(slotBase));
278 HTMLSelectElement* imp = static_cast<HTMLSelectElement*>(castedThis->impl());
279 JSValue result = jsNumber(imp->length());
284 JSValue jsHTMLSelectElementForm(ExecState* exec, JSValue slotBase, const Identifier&)
286 JSHTMLSelectElement* castedThis = static_cast<JSHTMLSelectElement*>(asObject(slotBase));
288 HTMLSelectElement* imp = static_cast<HTMLSelectElement*>(castedThis->impl());
289 JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->form()));
294 JSValue jsHTMLSelectElementValidity(ExecState* exec, JSValue slotBase, const Identifier&)
296 JSHTMLSelectElement* castedThis = static_cast<JSHTMLSelectElement*>(asObject(slotBase));
298 HTMLSelectElement* imp = static_cast<HTMLSelectElement*>(castedThis->impl());
299 JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->validity()));
304 JSValue jsHTMLSelectElementWillValidate(ExecState* exec, JSValue slotBase, const Identifier&)
306 JSHTMLSelectElement* castedThis = static_cast<JSHTMLSelectElement*>(asObject(slotBase));
308 HTMLSelectElement* imp = static_cast<HTMLSelectElement*>(castedThis->impl());
309 JSValue result = jsBoolean(imp->willValidate());
314 JSValue jsHTMLSelectElementValidationMessage(ExecState* exec, JSValue slotBase, const Identifier&)
316 JSHTMLSelectElement* castedThis = static_cast<JSHTMLSelectElement*>(asObject(slotBase));
318 HTMLSelectElement* imp = static_cast<HTMLSelectElement*>(castedThis->impl());
319 JSValue result = jsString(exec, imp->validationMessage());
324 JSValue jsHTMLSelectElementOptions(ExecState* exec, JSValue slotBase, const Identifier&)
326 JSHTMLSelectElement* castedThis = static_cast<JSHTMLSelectElement*>(asObject(slotBase));
328 HTMLSelectElement* imp = static_cast<HTMLSelectElement*>(castedThis->impl());
329 JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->options()));
334 JSValue jsHTMLSelectElementDisabled(ExecState* exec, JSValue slotBase, const Identifier&)
336 JSHTMLSelectElement* castedThis = static_cast<JSHTMLSelectElement*>(asObject(slotBase));
338 HTMLSelectElement* imp = static_cast<HTMLSelectElement*>(castedThis->impl());
339 JSValue result = jsBoolean(imp->hasAttribute(WebCore::HTMLNames::disabledAttr));
344 JSValue jsHTMLSelectElementAutofocus(ExecState* exec, JSValue slotBase, const Identifier&)
346 JSHTMLSelectElement* castedThis = static_cast<JSHTMLSelectElement*>(asObject(slotBase));
348 HTMLSelectElement* imp = static_cast<HTMLSelectElement*>(castedThis->impl());
349 JSValue result = jsBoolean(imp->hasAttribute(WebCore::HTMLNames::autofocusAttr));
354 JSValue jsHTMLSelectElementMultiple(ExecState* exec, JSValue slotBase, const Identifier&)
356 JSHTMLSelectElement* castedThis = static_cast<JSHTMLSelectElement*>(asObject(slotBase));
358 HTMLSelectElement* imp = static_cast<HTMLSelectElement*>(castedThis->impl());
359 JSValue result = jsBoolean(imp->multiple());
364 JSValue jsHTMLSelectElementName(ExecState* exec, JSValue slotBase, const Identifier&)
366 JSHTMLSelectElement* castedThis = static_cast<JSHTMLSelectElement*>(asObject(slotBase));
368 HTMLSelectElement* imp = static_cast<HTMLSelectElement*>(castedThis->impl());
369 JSValue result = jsString(exec, imp->name());
374 JSValue jsHTMLSelectElementRequired(ExecState* exec, JSValue slotBase, const Identifier&)
376 JSHTMLSelectElement* castedThis = static_cast<JSHTMLSelectElement*>(asObject(slotBase));
378 HTMLSelectElement* imp = static_cast<HTMLSelectElement*>(castedThis->impl());
379 JSValue result = jsBoolean(imp->hasAttribute(WebCore::HTMLNames::requiredAttr));
384 JSValue jsHTMLSelectElementSize(ExecState* exec, JSValue slotBase, const Identifier&)
386 JSHTMLSelectElement* castedThis = static_cast<JSHTMLSelectElement*>(asObject(slotBase));
388 HTMLSelectElement* imp = static_cast<HTMLSelectElement*>(castedThis->impl());
389 JSValue result = jsNumber(imp->size());
394 JSValue jsHTMLSelectElementLabels(ExecState* exec, JSValue slotBase, const Identifier&)
396 JSHTMLSelectElement* castedThis = static_cast<JSHTMLSelectElement*>(asObject(slotBase));
398 HTMLSelectElement* imp = static_cast<HTMLSelectElement*>(castedThis->impl());
399 JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->labels()));
404 JSValue jsHTMLSelectElementConstructor(ExecState* exec, JSValue slotBase, const Identifier&)
406 JSHTMLSelectElement* domObject = static_cast<JSHTMLSelectElement*>(asObject(slotBase));
407 return JSHTMLSelectElement::getConstructor(exec, domObject->globalObject());
410 void JSHTMLSelectElement::put(JSCell* cell, ExecState* exec, const Identifier& propertyName, JSValue value, PutPropertySlot& slot)
412 JSHTMLSelectElement* thisObject = jsCast<JSHTMLSelectElement*>(cell);
413 ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info);
415 unsigned index = propertyName.toUInt32(ok);
417 thisObject->indexSetter(exec, index, value);
420 lookupPut<JSHTMLSelectElement, Base>(exec, propertyName, value, &JSHTMLSelectElementTable, thisObject, slot);
423 void JSHTMLSelectElement::putByIndex(JSCell* cell, ExecState* exec, unsigned propertyName, JSValue value)
425 JSHTMLSelectElement* thisObject = jsCast<JSHTMLSelectElement*>(cell);
426 ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info);
427 thisObject->indexSetter(exec, propertyName, value);
431 void setJSHTMLSelectElementSelectedIndex(ExecState* exec, JSObject* thisObject, JSValue value)
433 JSHTMLSelectElement* castedThis = static_cast<JSHTMLSelectElement*>(thisObject);
434 HTMLSelectElement* imp = static_cast<HTMLSelectElement*>(castedThis->impl());
435 imp->setSelectedIndex(value.toInt32(exec));
439 void setJSHTMLSelectElementValue(ExecState* exec, JSObject* thisObject, JSValue value)
441 JSHTMLSelectElement* castedThis = static_cast<JSHTMLSelectElement*>(thisObject);
442 HTMLSelectElement* imp = static_cast<HTMLSelectElement*>(castedThis->impl());
443 imp->setValue(valueToStringWithNullCheck(exec, value));
447 void setJSHTMLSelectElementLength(ExecState* exec, JSObject* thisObject, JSValue value)
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);
457 void setJSHTMLSelectElementDisabled(ExecState* exec, JSObject* thisObject, JSValue value)
459 JSHTMLSelectElement* castedThis = static_cast<JSHTMLSelectElement*>(thisObject);
460 HTMLSelectElement* imp = static_cast<HTMLSelectElement*>(castedThis->impl());
461 imp->setBooleanAttribute(WebCore::HTMLNames::disabledAttr, value.toBoolean(exec));
465 void setJSHTMLSelectElementAutofocus(ExecState* exec, JSObject* thisObject, JSValue value)
467 JSHTMLSelectElement* castedThis = static_cast<JSHTMLSelectElement*>(thisObject);
468 HTMLSelectElement* imp = static_cast<HTMLSelectElement*>(castedThis->impl());
469 imp->setBooleanAttribute(WebCore::HTMLNames::autofocusAttr, value.toBoolean(exec));
473 void setJSHTMLSelectElementMultiple(ExecState* exec, JSObject* thisObject, JSValue value)
475 JSHTMLSelectElement* castedThis = static_cast<JSHTMLSelectElement*>(thisObject);
476 HTMLSelectElement* imp = static_cast<HTMLSelectElement*>(castedThis->impl());
477 imp->setMultiple(value.toBoolean(exec));
481 void setJSHTMLSelectElementName(ExecState* exec, JSObject* thisObject, JSValue value)
483 JSHTMLSelectElement* castedThis = static_cast<JSHTMLSelectElement*>(thisObject);
484 HTMLSelectElement* imp = static_cast<HTMLSelectElement*>(castedThis->impl());
485 imp->setName(valueToStringWithNullCheck(exec, value));
489 void setJSHTMLSelectElementRequired(ExecState* exec, JSObject* thisObject, JSValue value)
491 JSHTMLSelectElement* castedThis = static_cast<JSHTMLSelectElement*>(thisObject);
492 HTMLSelectElement* imp = static_cast<HTMLSelectElement*>(castedThis->impl());
493 imp->setBooleanAttribute(WebCore::HTMLNames::requiredAttr, value.toBoolean(exec));
497 void setJSHTMLSelectElementSize(ExecState* exec, JSObject* thisObject, JSValue value)
499 JSHTMLSelectElement* castedThis = static_cast<JSHTMLSelectElement*>(thisObject);
500 HTMLSelectElement* imp = static_cast<HTMLSelectElement*>(castedThis->impl());
501 imp->setSize(value.toInt32(exec));
505 void JSHTMLSelectElement::getOwnPropertyNames(JSObject* object, ExecState* exec, PropertyNameArray& propertyNames, EnumerationMode mode)
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);
514 JSValue JSHTMLSelectElement::getConstructor(ExecState* exec, JSGlobalObject* globalObject)
516 return getDOMConstructor<JSHTMLSelectElementConstructor>(exec, static_cast<JSDOMGlobalObject*>(globalObject));
519 EncodedJSValue JSC_HOST_CALL jsHTMLSelectElementPrototypeFunctionCheckValidity(ExecState* exec)
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());
528 JSC::JSValue result = jsBoolean(imp->checkValidity());
529 return JSValue::encode(result);
532 EncodedJSValue JSC_HOST_CALL jsHTMLSelectElementPrototypeFunctionSetCustomValidity(ExecState* exec)
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());
549 EncodedJSValue JSC_HOST_CALL jsHTMLSelectElementPrototypeFunctionAdd(ExecState* exec)
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());
569 EncodedJSValue JSC_HOST_CALL jsHTMLSelectElementPrototypeFunctionRemove(ExecState* exec)
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));
579 EncodedJSValue JSC_HOST_CALL jsHTMLSelectElementPrototypeFunctionItem(ExecState* exec)
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));
589 setDOMException(exec, INDEX_SIZE_ERR);
590 return JSValue::encode(jsUndefined());
592 if (exec->hadException())
593 return JSValue::encode(jsUndefined());
595 JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->item(index)));
596 return JSValue::encode(result);
599 EncodedJSValue JSC_HOST_CALL jsHTMLSelectElementPrototypeFunctionNamedItem(ExecState* exec)
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());
611 JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->namedItem(name)));
612 return JSValue::encode(result);
616 JSValue JSHTMLSelectElement::indexGetter(ExecState* exec, JSValue slotBase, unsigned index)
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));