WebCore/generated/JSHTMLSelectElement.cpp
changeset 0 4f2f89ce4247
equal deleted inserted replaced
-1:000000000000 0:4f2f89ce4247
       
     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 "JSHTMLElement.h"
       
    30 #include "JSHTMLFormElement.h"
       
    31 #include "JSHTMLOptionsCollection.h"
       
    32 #include "JSNode.h"
       
    33 #include "JSNodeList.h"
       
    34 #include "JSValidityState.h"
       
    35 #include "KURL.h"
       
    36 #include "NameNodeList.h"
       
    37 #include "Node.h"
       
    38 #include "NodeList.h"
       
    39 #include "ValidityState.h"
       
    40 #include <runtime/Error.h>
       
    41 #include <runtime/JSNumberCell.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 
       
    59 static const HashTableValue JSHTMLSelectElementTableValues[17] =
       
    60 {
       
    61     { "type", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLSelectElementType), (intptr_t)0 THUNK_GENERATOR(0) },
       
    62     { "selectedIndex", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLSelectElementSelectedIndex), (intptr_t)setJSHTMLSelectElementSelectedIndex THUNK_GENERATOR(0) },
       
    63     { "value", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLSelectElementValue), (intptr_t)setJSHTMLSelectElementValue THUNK_GENERATOR(0) },
       
    64     { "length", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLSelectElementLength), (intptr_t)setJSHTMLSelectElementLength THUNK_GENERATOR(0) },
       
    65     { "form", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLSelectElementForm), (intptr_t)0 THUNK_GENERATOR(0) },
       
    66     { "validity", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLSelectElementValidity), (intptr_t)0 THUNK_GENERATOR(0) },
       
    67     { "willValidate", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLSelectElementWillValidate), (intptr_t)0 THUNK_GENERATOR(0) },
       
    68     { "validationMessage", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLSelectElementValidationMessage), (intptr_t)0 THUNK_GENERATOR(0) },
       
    69     { "options", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLSelectElementOptions), (intptr_t)0 THUNK_GENERATOR(0) },
       
    70     { "disabled", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLSelectElementDisabled), (intptr_t)setJSHTMLSelectElementDisabled THUNK_GENERATOR(0) },
       
    71     { "autofocus", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLSelectElementAutofocus), (intptr_t)setJSHTMLSelectElementAutofocus THUNK_GENERATOR(0) },
       
    72     { "multiple", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLSelectElementMultiple), (intptr_t)setJSHTMLSelectElementMultiple THUNK_GENERATOR(0) },
       
    73     { "name", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLSelectElementName), (intptr_t)setJSHTMLSelectElementName THUNK_GENERATOR(0) },
       
    74     { "size", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLSelectElementSize), (intptr_t)setJSHTMLSelectElementSize THUNK_GENERATOR(0) },
       
    75     { "labels", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLSelectElementLabels), (intptr_t)0 THUNK_GENERATOR(0) },
       
    76     { "constructor", DontEnum | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLSelectElementConstructor), (intptr_t)0 THUNK_GENERATOR(0) },
       
    77     { 0, 0, 0, 0 THUNK_GENERATOR(0) }
       
    78 };
       
    79 
       
    80 #undef THUNK_GENERATOR
       
    81 static JSC_CONST_HASHTABLE HashTable JSHTMLSelectElementTable = { 35, 31, JSHTMLSelectElementTableValues, 0 };
       
    82 /* Hash table for constructor */
       
    83 #if ENABLE(JIT)
       
    84 #define THUNK_GENERATOR(generator) , generator
       
    85 #else
       
    86 #define THUNK_GENERATOR(generator)
       
    87 #endif
       
    88 
       
    89 static const HashTableValue JSHTMLSelectElementConstructorTableValues[1] =
       
    90 {
       
    91     { 0, 0, 0, 0 THUNK_GENERATOR(0) }
       
    92 };
       
    93 
       
    94 #undef THUNK_GENERATOR
       
    95 static JSC_CONST_HASHTABLE HashTable JSHTMLSelectElementConstructorTable = { 1, 0, JSHTMLSelectElementConstructorTableValues, 0 };
       
    96 class JSHTMLSelectElementConstructor : public DOMConstructorObject {
       
    97 public:
       
    98     JSHTMLSelectElementConstructor(JSC::ExecState*, JSDOMGlobalObject*);
       
    99 
       
   100     virtual bool getOwnPropertySlot(JSC::ExecState*, const JSC::Identifier&, JSC::PropertySlot&);
       
   101     virtual bool getOwnPropertyDescriptor(JSC::ExecState*, const JSC::Identifier&, JSC::PropertyDescriptor&);
       
   102     virtual const JSC::ClassInfo* classInfo() const { return &s_info; }
       
   103     static const JSC::ClassInfo s_info;
       
   104     static PassRefPtr<JSC::Structure> createStructure(JSC::JSValue prototype)
       
   105     {
       
   106         return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), AnonymousSlotCount);
       
   107     }
       
   108 protected:
       
   109     static const unsigned StructureFlags = JSC::OverridesGetOwnPropertySlot | JSC::ImplementsHasInstance | DOMConstructorObject::StructureFlags;
       
   110 };
       
   111 
       
   112 const ClassInfo JSHTMLSelectElementConstructor::s_info = { "HTMLSelectElementConstructor", 0, &JSHTMLSelectElementConstructorTable, 0 };
       
   113 
       
   114 JSHTMLSelectElementConstructor::JSHTMLSelectElementConstructor(ExecState* exec, JSDOMGlobalObject* globalObject)
       
   115     : DOMConstructorObject(JSHTMLSelectElementConstructor::createStructure(globalObject->objectPrototype()), globalObject)
       
   116 {
       
   117     putDirect(exec->propertyNames().prototype, JSHTMLSelectElementPrototype::self(exec, globalObject), DontDelete | ReadOnly);
       
   118 }
       
   119 
       
   120 bool JSHTMLSelectElementConstructor::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
       
   121 {
       
   122     return getStaticValueSlot<JSHTMLSelectElementConstructor, DOMObject>(exec, &JSHTMLSelectElementConstructorTable, this, propertyName, slot);
       
   123 }
       
   124 
       
   125 bool JSHTMLSelectElementConstructor::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
       
   126 {
       
   127     return getStaticValueDescriptor<JSHTMLSelectElementConstructor, DOMObject>(exec, &JSHTMLSelectElementConstructorTable, this, propertyName, descriptor);
       
   128 }
       
   129 
       
   130 /* Hash table for prototype */
       
   131 #if ENABLE(JIT)
       
   132 #define THUNK_GENERATOR(generator) , generator
       
   133 #else
       
   134 #define THUNK_GENERATOR(generator)
       
   135 #endif
       
   136 
       
   137 static const HashTableValue JSHTMLSelectElementPrototypeTableValues[7] =
       
   138 {
       
   139     { "checkValidity", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsHTMLSelectElementPrototypeFunctionCheckValidity), (intptr_t)0 THUNK_GENERATOR(0) },
       
   140     { "setCustomValidity", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsHTMLSelectElementPrototypeFunctionSetCustomValidity), (intptr_t)1 THUNK_GENERATOR(0) },
       
   141     { "add", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsHTMLSelectElementPrototypeFunctionAdd), (intptr_t)2 THUNK_GENERATOR(0) },
       
   142     { "remove", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsHTMLSelectElementPrototypeFunctionRemove), (intptr_t)0 THUNK_GENERATOR(0) },
       
   143     { "item", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsHTMLSelectElementPrototypeFunctionItem), (intptr_t)1 THUNK_GENERATOR(0) },
       
   144     { "namedItem", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsHTMLSelectElementPrototypeFunctionNamedItem), (intptr_t)1 THUNK_GENERATOR(0) },
       
   145     { 0, 0, 0, 0 THUNK_GENERATOR(0) }
       
   146 };
       
   147 
       
   148 #undef THUNK_GENERATOR
       
   149 static JSC_CONST_HASHTABLE HashTable JSHTMLSelectElementPrototypeTable = { 16, 15, JSHTMLSelectElementPrototypeTableValues, 0 };
       
   150 const ClassInfo JSHTMLSelectElementPrototype::s_info = { "HTMLSelectElementPrototype", 0, &JSHTMLSelectElementPrototypeTable, 0 };
       
   151 
       
   152 JSObject* JSHTMLSelectElementPrototype::self(ExecState* exec, JSGlobalObject* globalObject)
       
   153 {
       
   154     return getDOMPrototype<JSHTMLSelectElement>(exec, globalObject);
       
   155 }
       
   156 
       
   157 bool JSHTMLSelectElementPrototype::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
       
   158 {
       
   159     return getStaticFunctionSlot<JSObject>(exec, &JSHTMLSelectElementPrototypeTable, this, propertyName, slot);
       
   160 }
       
   161 
       
   162 bool JSHTMLSelectElementPrototype::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
       
   163 {
       
   164     return getStaticFunctionDescriptor<JSObject>(exec, &JSHTMLSelectElementPrototypeTable, this, propertyName, descriptor);
       
   165 }
       
   166 
       
   167 const ClassInfo JSHTMLSelectElement::s_info = { "HTMLSelectElement", &JSHTMLElement::s_info, &JSHTMLSelectElementTable, 0 };
       
   168 
       
   169 JSHTMLSelectElement::JSHTMLSelectElement(NonNullPassRefPtr<Structure> structure, JSDOMGlobalObject* globalObject, PassRefPtr<HTMLSelectElement> impl)
       
   170     : JSHTMLElement(structure, globalObject, impl)
       
   171 {
       
   172 }
       
   173 
       
   174 JSObject* JSHTMLSelectElement::createPrototype(ExecState* exec, JSGlobalObject* globalObject)
       
   175 {
       
   176     return new (exec) JSHTMLSelectElementPrototype(globalObject, JSHTMLSelectElementPrototype::createStructure(JSHTMLElementPrototype::self(exec, globalObject)));
       
   177 }
       
   178 
       
   179 bool JSHTMLSelectElement::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
       
   180 {
       
   181     const HashEntry* entry = JSHTMLSelectElementTable.entry(exec, propertyName);
       
   182     if (entry) {
       
   183         slot.setCustom(this, entry->propertyGetter());
       
   184         return true;
       
   185     }
       
   186     bool ok;
       
   187     unsigned index = propertyName.toUInt32(&ok, false);
       
   188     if (ok && index < static_cast<HTMLSelectElement*>(impl())->length()) {
       
   189         slot.setCustomIndex(this, index, indexGetter);
       
   190         return true;
       
   191     }
       
   192     return getStaticValueSlot<JSHTMLSelectElement, Base>(exec, &JSHTMLSelectElementTable, this, propertyName, slot);
       
   193 }
       
   194 
       
   195 bool JSHTMLSelectElement::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
       
   196 {
       
   197     const HashEntry* entry = JSHTMLSelectElementTable.entry(exec, propertyName);
       
   198     if (entry) {
       
   199         PropertySlot slot;
       
   200         slot.setCustom(this, entry->propertyGetter());
       
   201         descriptor.setDescriptor(slot.getValue(exec, propertyName), entry->attributes());
       
   202         return true;
       
   203     }
       
   204     bool ok;
       
   205     unsigned index = propertyName.toUInt32(&ok, false);
       
   206     if (ok && index < static_cast<HTMLSelectElement*>(impl())->length()) {
       
   207         PropertySlot slot;
       
   208         slot.setCustomIndex(this, index, indexGetter);
       
   209         descriptor.setDescriptor(slot.getValue(exec, propertyName), DontDelete);
       
   210         return true;
       
   211     }
       
   212     return getStaticValueDescriptor<JSHTMLSelectElement, Base>(exec, &JSHTMLSelectElementTable, this, propertyName, descriptor);
       
   213 }
       
   214 
       
   215 bool JSHTMLSelectElement::getOwnPropertySlot(ExecState* exec, unsigned propertyName, PropertySlot& slot)
       
   216 {
       
   217     if (propertyName < static_cast<HTMLSelectElement*>(impl())->length()) {
       
   218         slot.setCustomIndex(this, propertyName, indexGetter);
       
   219         return true;
       
   220     }
       
   221     return getOwnPropertySlot(exec, Identifier::from(exec, propertyName), slot);
       
   222 }
       
   223 
       
   224 JSValue jsHTMLSelectElementType(ExecState* exec, JSValue slotBase, const Identifier&)
       
   225 {
       
   226     JSHTMLSelectElement* castedThis = static_cast<JSHTMLSelectElement*>(asObject(slotBase));
       
   227     UNUSED_PARAM(exec);
       
   228     HTMLSelectElement* imp = static_cast<HTMLSelectElement*>(castedThis->impl());
       
   229     JSValue result = jsString(exec, imp->type());
       
   230     return result;
       
   231 }
       
   232 
       
   233 JSValue jsHTMLSelectElementSelectedIndex(ExecState* exec, JSValue slotBase, const Identifier&)
       
   234 {
       
   235     JSHTMLSelectElement* castedThis = static_cast<JSHTMLSelectElement*>(asObject(slotBase));
       
   236     UNUSED_PARAM(exec);
       
   237     HTMLSelectElement* imp = static_cast<HTMLSelectElement*>(castedThis->impl());
       
   238     JSValue result = jsNumber(exec, imp->selectedIndex());
       
   239     return result;
       
   240 }
       
   241 
       
   242 JSValue jsHTMLSelectElementValue(ExecState* exec, JSValue slotBase, const Identifier&)
       
   243 {
       
   244     JSHTMLSelectElement* castedThis = static_cast<JSHTMLSelectElement*>(asObject(slotBase));
       
   245     UNUSED_PARAM(exec);
       
   246     HTMLSelectElement* imp = static_cast<HTMLSelectElement*>(castedThis->impl());
       
   247     JSValue result = jsString(exec, imp->value());
       
   248     return result;
       
   249 }
       
   250 
       
   251 JSValue jsHTMLSelectElementLength(ExecState* exec, JSValue slotBase, const Identifier&)
       
   252 {
       
   253     JSHTMLSelectElement* castedThis = static_cast<JSHTMLSelectElement*>(asObject(slotBase));
       
   254     UNUSED_PARAM(exec);
       
   255     HTMLSelectElement* imp = static_cast<HTMLSelectElement*>(castedThis->impl());
       
   256     JSValue result = jsNumber(exec, imp->length());
       
   257     return result;
       
   258 }
       
   259 
       
   260 JSValue jsHTMLSelectElementForm(ExecState* exec, JSValue slotBase, const Identifier&)
       
   261 {
       
   262     JSHTMLSelectElement* castedThis = static_cast<JSHTMLSelectElement*>(asObject(slotBase));
       
   263     UNUSED_PARAM(exec);
       
   264     HTMLSelectElement* imp = static_cast<HTMLSelectElement*>(castedThis->impl());
       
   265     JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->form()));
       
   266     return result;
       
   267 }
       
   268 
       
   269 JSValue jsHTMLSelectElementValidity(ExecState* exec, JSValue slotBase, const Identifier&)
       
   270 {
       
   271     JSHTMLSelectElement* castedThis = static_cast<JSHTMLSelectElement*>(asObject(slotBase));
       
   272     UNUSED_PARAM(exec);
       
   273     HTMLSelectElement* imp = static_cast<HTMLSelectElement*>(castedThis->impl());
       
   274     JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->validity()));
       
   275     return result;
       
   276 }
       
   277 
       
   278 JSValue jsHTMLSelectElementWillValidate(ExecState* exec, JSValue slotBase, const Identifier&)
       
   279 {
       
   280     JSHTMLSelectElement* castedThis = static_cast<JSHTMLSelectElement*>(asObject(slotBase));
       
   281     UNUSED_PARAM(exec);
       
   282     HTMLSelectElement* imp = static_cast<HTMLSelectElement*>(castedThis->impl());
       
   283     JSValue result = jsBoolean(imp->willValidate());
       
   284     return result;
       
   285 }
       
   286 
       
   287 JSValue jsHTMLSelectElementValidationMessage(ExecState* exec, JSValue slotBase, const Identifier&)
       
   288 {
       
   289     JSHTMLSelectElement* castedThis = static_cast<JSHTMLSelectElement*>(asObject(slotBase));
       
   290     UNUSED_PARAM(exec);
       
   291     HTMLSelectElement* imp = static_cast<HTMLSelectElement*>(castedThis->impl());
       
   292     JSValue result = jsString(exec, imp->validationMessage());
       
   293     return result;
       
   294 }
       
   295 
       
   296 JSValue jsHTMLSelectElementOptions(ExecState* exec, JSValue slotBase, const Identifier&)
       
   297 {
       
   298     JSHTMLSelectElement* castedThis = static_cast<JSHTMLSelectElement*>(asObject(slotBase));
       
   299     UNUSED_PARAM(exec);
       
   300     HTMLSelectElement* imp = static_cast<HTMLSelectElement*>(castedThis->impl());
       
   301     JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->options()));
       
   302     return result;
       
   303 }
       
   304 
       
   305 JSValue jsHTMLSelectElementDisabled(ExecState* exec, JSValue slotBase, const Identifier&)
       
   306 {
       
   307     JSHTMLSelectElement* castedThis = static_cast<JSHTMLSelectElement*>(asObject(slotBase));
       
   308     UNUSED_PARAM(exec);
       
   309     HTMLSelectElement* imp = static_cast<HTMLSelectElement*>(castedThis->impl());
       
   310     JSValue result = jsBoolean(imp->hasAttribute(WebCore::HTMLNames::disabledAttr));
       
   311     return result;
       
   312 }
       
   313 
       
   314 JSValue jsHTMLSelectElementAutofocus(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 = jsBoolean(imp->hasAttribute(WebCore::HTMLNames::autofocusAttr));
       
   320     return result;
       
   321 }
       
   322 
       
   323 JSValue jsHTMLSelectElementMultiple(ExecState* exec, JSValue slotBase, const Identifier&)
       
   324 {
       
   325     JSHTMLSelectElement* castedThis = static_cast<JSHTMLSelectElement*>(asObject(slotBase));
       
   326     UNUSED_PARAM(exec);
       
   327     HTMLSelectElement* imp = static_cast<HTMLSelectElement*>(castedThis->impl());
       
   328     JSValue result = jsBoolean(imp->multiple());
       
   329     return result;
       
   330 }
       
   331 
       
   332 JSValue jsHTMLSelectElementName(ExecState* exec, JSValue slotBase, const Identifier&)
       
   333 {
       
   334     JSHTMLSelectElement* castedThis = static_cast<JSHTMLSelectElement*>(asObject(slotBase));
       
   335     UNUSED_PARAM(exec);
       
   336     HTMLSelectElement* imp = static_cast<HTMLSelectElement*>(castedThis->impl());
       
   337     JSValue result = jsString(exec, imp->name());
       
   338     return result;
       
   339 }
       
   340 
       
   341 JSValue jsHTMLSelectElementSize(ExecState* exec, JSValue slotBase, const Identifier&)
       
   342 {
       
   343     JSHTMLSelectElement* castedThis = static_cast<JSHTMLSelectElement*>(asObject(slotBase));
       
   344     UNUSED_PARAM(exec);
       
   345     HTMLSelectElement* imp = static_cast<HTMLSelectElement*>(castedThis->impl());
       
   346     JSValue result = jsNumber(exec, imp->size());
       
   347     return result;
       
   348 }
       
   349 
       
   350 JSValue jsHTMLSelectElementLabels(ExecState* exec, JSValue slotBase, const Identifier&)
       
   351 {
       
   352     JSHTMLSelectElement* castedThis = static_cast<JSHTMLSelectElement*>(asObject(slotBase));
       
   353     UNUSED_PARAM(exec);
       
   354     HTMLSelectElement* imp = static_cast<HTMLSelectElement*>(castedThis->impl());
       
   355     JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->labels()));
       
   356     return result;
       
   357 }
       
   358 
       
   359 JSValue jsHTMLSelectElementConstructor(ExecState* exec, JSValue slotBase, const Identifier&)
       
   360 {
       
   361     JSHTMLSelectElement* domObject = static_cast<JSHTMLSelectElement*>(asObject(slotBase));
       
   362     return JSHTMLSelectElement::getConstructor(exec, domObject->globalObject());
       
   363 }
       
   364 void JSHTMLSelectElement::put(ExecState* exec, const Identifier& propertyName, JSValue value, PutPropertySlot& slot)
       
   365 {
       
   366     bool ok;
       
   367     unsigned index = propertyName.toUInt32(&ok, false);
       
   368     if (ok) {
       
   369         indexSetter(exec, index, value);
       
   370         return;
       
   371     }
       
   372     lookupPut<JSHTMLSelectElement, Base>(exec, propertyName, value, &JSHTMLSelectElementTable, this, slot);
       
   373 }
       
   374 
       
   375 void JSHTMLSelectElement::put(ExecState* exec, unsigned propertyName, JSValue value)
       
   376 {
       
   377     indexSetter(exec, propertyName, value);
       
   378     return;
       
   379 }
       
   380 
       
   381 void setJSHTMLSelectElementSelectedIndex(ExecState* exec, JSObject* thisObject, JSValue value)
       
   382 {
       
   383     JSHTMLSelectElement* castedThis = static_cast<JSHTMLSelectElement*>(thisObject);
       
   384     HTMLSelectElement* imp = static_cast<HTMLSelectElement*>(castedThis->impl());
       
   385     imp->setSelectedIndex(value.toInt32(exec));
       
   386 }
       
   387 
       
   388 void setJSHTMLSelectElementValue(ExecState* exec, JSObject* thisObject, JSValue value)
       
   389 {
       
   390     JSHTMLSelectElement* castedThis = static_cast<JSHTMLSelectElement*>(thisObject);
       
   391     HTMLSelectElement* imp = static_cast<HTMLSelectElement*>(castedThis->impl());
       
   392     imp->setValue(valueToStringWithNullCheck(exec, value));
       
   393 }
       
   394 
       
   395 void setJSHTMLSelectElementLength(ExecState* exec, JSObject* thisObject, JSValue value)
       
   396 {
       
   397     JSHTMLSelectElement* castedThis = static_cast<JSHTMLSelectElement*>(thisObject);
       
   398     HTMLSelectElement* imp = static_cast<HTMLSelectElement*>(castedThis->impl());
       
   399     ExceptionCode ec = 0;
       
   400     imp->setLength(value.toInt32(exec), ec);
       
   401     setDOMException(exec, ec);
       
   402 }
       
   403 
       
   404 void setJSHTMLSelectElementDisabled(ExecState* exec, JSObject* thisObject, JSValue value)
       
   405 {
       
   406     JSHTMLSelectElement* castedThis = static_cast<JSHTMLSelectElement*>(thisObject);
       
   407     HTMLSelectElement* imp = static_cast<HTMLSelectElement*>(castedThis->impl());
       
   408     imp->setBooleanAttribute(WebCore::HTMLNames::disabledAttr, value.toBoolean(exec));
       
   409 }
       
   410 
       
   411 void setJSHTMLSelectElementAutofocus(ExecState* exec, JSObject* thisObject, JSValue value)
       
   412 {
       
   413     JSHTMLSelectElement* castedThis = static_cast<JSHTMLSelectElement*>(thisObject);
       
   414     HTMLSelectElement* imp = static_cast<HTMLSelectElement*>(castedThis->impl());
       
   415     imp->setBooleanAttribute(WebCore::HTMLNames::autofocusAttr, value.toBoolean(exec));
       
   416 }
       
   417 
       
   418 void setJSHTMLSelectElementMultiple(ExecState* exec, JSObject* thisObject, JSValue value)
       
   419 {
       
   420     JSHTMLSelectElement* castedThis = static_cast<JSHTMLSelectElement*>(thisObject);
       
   421     HTMLSelectElement* imp = static_cast<HTMLSelectElement*>(castedThis->impl());
       
   422     imp->setMultiple(value.toBoolean(exec));
       
   423 }
       
   424 
       
   425 void setJSHTMLSelectElementName(ExecState* exec, JSObject* thisObject, JSValue value)
       
   426 {
       
   427     JSHTMLSelectElement* castedThis = static_cast<JSHTMLSelectElement*>(thisObject);
       
   428     HTMLSelectElement* imp = static_cast<HTMLSelectElement*>(castedThis->impl());
       
   429     imp->setName(valueToStringWithNullCheck(exec, value));
       
   430 }
       
   431 
       
   432 void setJSHTMLSelectElementSize(ExecState* exec, JSObject* thisObject, JSValue value)
       
   433 {
       
   434     JSHTMLSelectElement* castedThis = static_cast<JSHTMLSelectElement*>(thisObject);
       
   435     HTMLSelectElement* imp = static_cast<HTMLSelectElement*>(castedThis->impl());
       
   436     imp->setSize(value.toInt32(exec));
       
   437 }
       
   438 
       
   439 void JSHTMLSelectElement::getOwnPropertyNames(ExecState* exec, PropertyNameArray& propertyNames, EnumerationMode mode)
       
   440 {
       
   441     for (unsigned i = 0; i < static_cast<HTMLSelectElement*>(impl())->length(); ++i)
       
   442         propertyNames.add(Identifier::from(exec, i));
       
   443      Base::getOwnPropertyNames(exec, propertyNames, mode);
       
   444 }
       
   445 
       
   446 JSValue JSHTMLSelectElement::getConstructor(ExecState* exec, JSGlobalObject* globalObject)
       
   447 {
       
   448     return getDOMConstructor<JSHTMLSelectElementConstructor>(exec, static_cast<JSDOMGlobalObject*>(globalObject));
       
   449 }
       
   450 
       
   451 EncodedJSValue JSC_HOST_CALL jsHTMLSelectElementPrototypeFunctionCheckValidity(ExecState* exec)
       
   452 {
       
   453     JSValue thisValue = exec->hostThisValue();
       
   454     if (!thisValue.inherits(&JSHTMLSelectElement::s_info))
       
   455         return throwVMTypeError(exec);
       
   456     JSHTMLSelectElement* castedThis = static_cast<JSHTMLSelectElement*>(asObject(thisValue));
       
   457     HTMLSelectElement* imp = static_cast<HTMLSelectElement*>(castedThis->impl());
       
   458 
       
   459 
       
   460     JSC::JSValue result = jsBoolean(imp->checkValidity());
       
   461     return JSValue::encode(result);
       
   462 }
       
   463 
       
   464 EncodedJSValue JSC_HOST_CALL jsHTMLSelectElementPrototypeFunctionSetCustomValidity(ExecState* exec)
       
   465 {
       
   466     JSValue thisValue = exec->hostThisValue();
       
   467     if (!thisValue.inherits(&JSHTMLSelectElement::s_info))
       
   468         return throwVMTypeError(exec);
       
   469     JSHTMLSelectElement* castedThis = static_cast<JSHTMLSelectElement*>(asObject(thisValue));
       
   470     HTMLSelectElement* imp = static_cast<HTMLSelectElement*>(castedThis->impl());
       
   471     const String& error = valueToStringWithUndefinedOrNullCheck(exec, exec->argument(0));
       
   472 
       
   473     imp->setCustomValidity(error);
       
   474     return JSValue::encode(jsUndefined());
       
   475 }
       
   476 
       
   477 EncodedJSValue JSC_HOST_CALL jsHTMLSelectElementPrototypeFunctionAdd(ExecState* exec)
       
   478 {
       
   479     JSValue thisValue = exec->hostThisValue();
       
   480     if (!thisValue.inherits(&JSHTMLSelectElement::s_info))
       
   481         return throwVMTypeError(exec);
       
   482     JSHTMLSelectElement* castedThis = static_cast<JSHTMLSelectElement*>(asObject(thisValue));
       
   483     HTMLSelectElement* imp = static_cast<HTMLSelectElement*>(castedThis->impl());
       
   484     ExceptionCode ec = 0;
       
   485     HTMLElement* element = toHTMLElement(exec->argument(0));
       
   486     HTMLElement* before = toHTMLElement(exec->argument(1));
       
   487 
       
   488     imp->add(element, before, ec);
       
   489     setDOMException(exec, ec);
       
   490     return JSValue::encode(jsUndefined());
       
   491 }
       
   492 
       
   493 EncodedJSValue JSC_HOST_CALL jsHTMLSelectElementPrototypeFunctionRemove(ExecState* exec)
       
   494 {
       
   495     JSValue thisValue = exec->hostThisValue();
       
   496     if (!thisValue.inherits(&JSHTMLSelectElement::s_info))
       
   497         return throwVMTypeError(exec);
       
   498     JSHTMLSelectElement* castedThis = static_cast<JSHTMLSelectElement*>(asObject(thisValue));
       
   499     return JSValue::encode(castedThis->remove(exec));
       
   500 }
       
   501 
       
   502 EncodedJSValue JSC_HOST_CALL jsHTMLSelectElementPrototypeFunctionItem(ExecState* exec)
       
   503 {
       
   504     JSValue thisValue = exec->hostThisValue();
       
   505     if (!thisValue.inherits(&JSHTMLSelectElement::s_info))
       
   506         return throwVMTypeError(exec);
       
   507     JSHTMLSelectElement* castedThis = static_cast<JSHTMLSelectElement*>(asObject(thisValue));
       
   508     HTMLSelectElement* imp = static_cast<HTMLSelectElement*>(castedThis->impl());
       
   509     int index = exec->argument(0).toInt32(exec);
       
   510     if (index < 0) {
       
   511         setDOMException(exec, INDEX_SIZE_ERR);
       
   512         return JSValue::encode(jsUndefined());
       
   513     }
       
   514 
       
   515 
       
   516     JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->item(index)));
       
   517     return JSValue::encode(result);
       
   518 }
       
   519 
       
   520 EncodedJSValue JSC_HOST_CALL jsHTMLSelectElementPrototypeFunctionNamedItem(ExecState* exec)
       
   521 {
       
   522     JSValue thisValue = exec->hostThisValue();
       
   523     if (!thisValue.inherits(&JSHTMLSelectElement::s_info))
       
   524         return throwVMTypeError(exec);
       
   525     JSHTMLSelectElement* castedThis = static_cast<JSHTMLSelectElement*>(asObject(thisValue));
       
   526     HTMLSelectElement* imp = static_cast<HTMLSelectElement*>(castedThis->impl());
       
   527     const String& name = ustringToString(exec->argument(0).toString(exec));
       
   528 
       
   529 
       
   530     JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->namedItem(name)));
       
   531     return JSValue::encode(result);
       
   532 }
       
   533 
       
   534 
       
   535 JSValue JSHTMLSelectElement::indexGetter(ExecState* exec, JSValue slotBase, unsigned index)
       
   536 {
       
   537     JSHTMLSelectElement* thisObj = static_cast<JSHTMLSelectElement*>(asObject(slotBase));
       
   538     return toJS(exec, thisObj->globalObject(), static_cast<HTMLSelectElement*>(thisObj->impl())->item(index));
       
   539 }
       
   540 
       
   541 }