WebCore/generated/JSHTMLOptionElement.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 "JSHTMLOptionElement.h"
       
    23 
       
    24 #include "HTMLFormElement.h"
       
    25 #include "HTMLNames.h"
       
    26 #include "HTMLOptionElement.h"
       
    27 #include "JSHTMLFormElement.h"
       
    28 #include "KURL.h"
       
    29 #include <runtime/JSNumberCell.h>
       
    30 #include <runtime/JSString.h>
       
    31 #include <wtf/GetPtr.h>
       
    32 
       
    33 using namespace JSC;
       
    34 
       
    35 namespace WebCore {
       
    36 
       
    37 ASSERT_CLASS_FITS_IN_CELL(JSHTMLOptionElement);
       
    38 
       
    39 /* Hash table */
       
    40 #if ENABLE(JIT)
       
    41 #define THUNK_GENERATOR(generator) , generator
       
    42 #else
       
    43 #define THUNK_GENERATOR(generator)
       
    44 #endif
       
    45 
       
    46 static const HashTableValue JSHTMLOptionElementTableValues[10] =
       
    47 {
       
    48     { "form", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLOptionElementForm), (intptr_t)0 THUNK_GENERATOR(0) },
       
    49     { "defaultSelected", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLOptionElementDefaultSelected), (intptr_t)setJSHTMLOptionElementDefaultSelected THUNK_GENERATOR(0) },
       
    50     { "text", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLOptionElementText), (intptr_t)setJSHTMLOptionElementText THUNK_GENERATOR(0) },
       
    51     { "index", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLOptionElementIndex), (intptr_t)0 THUNK_GENERATOR(0) },
       
    52     { "disabled", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLOptionElementDisabled), (intptr_t)setJSHTMLOptionElementDisabled THUNK_GENERATOR(0) },
       
    53     { "label", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLOptionElementLabel), (intptr_t)setJSHTMLOptionElementLabel THUNK_GENERATOR(0) },
       
    54     { "selected", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLOptionElementSelected), (intptr_t)setJSHTMLOptionElementSelected THUNK_GENERATOR(0) },
       
    55     { "value", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLOptionElementValue), (intptr_t)setJSHTMLOptionElementValue THUNK_GENERATOR(0) },
       
    56     { "constructor", DontEnum | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLOptionElementConstructor), (intptr_t)0 THUNK_GENERATOR(0) },
       
    57     { 0, 0, 0, 0 THUNK_GENERATOR(0) }
       
    58 };
       
    59 
       
    60 #undef THUNK_GENERATOR
       
    61 static JSC_CONST_HASHTABLE HashTable JSHTMLOptionElementTable = { 34, 31, JSHTMLOptionElementTableValues, 0 };
       
    62 /* Hash table for constructor */
       
    63 #if ENABLE(JIT)
       
    64 #define THUNK_GENERATOR(generator) , generator
       
    65 #else
       
    66 #define THUNK_GENERATOR(generator)
       
    67 #endif
       
    68 
       
    69 static const HashTableValue JSHTMLOptionElementConstructorTableValues[1] =
       
    70 {
       
    71     { 0, 0, 0, 0 THUNK_GENERATOR(0) }
       
    72 };
       
    73 
       
    74 #undef THUNK_GENERATOR
       
    75 static JSC_CONST_HASHTABLE HashTable JSHTMLOptionElementConstructorTable = { 1, 0, JSHTMLOptionElementConstructorTableValues, 0 };
       
    76 class JSHTMLOptionElementConstructor : public DOMConstructorObject {
       
    77 public:
       
    78     JSHTMLOptionElementConstructor(JSC::ExecState*, JSDOMGlobalObject*);
       
    79 
       
    80     virtual bool getOwnPropertySlot(JSC::ExecState*, const JSC::Identifier&, JSC::PropertySlot&);
       
    81     virtual bool getOwnPropertyDescriptor(JSC::ExecState*, const JSC::Identifier&, JSC::PropertyDescriptor&);
       
    82     virtual const JSC::ClassInfo* classInfo() const { return &s_info; }
       
    83     static const JSC::ClassInfo s_info;
       
    84     static PassRefPtr<JSC::Structure> createStructure(JSC::JSValue prototype)
       
    85     {
       
    86         return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), AnonymousSlotCount);
       
    87     }
       
    88 protected:
       
    89     static const unsigned StructureFlags = JSC::OverridesGetOwnPropertySlot | JSC::ImplementsHasInstance | DOMConstructorObject::StructureFlags;
       
    90 };
       
    91 
       
    92 const ClassInfo JSHTMLOptionElementConstructor::s_info = { "HTMLOptionElementConstructor", 0, &JSHTMLOptionElementConstructorTable, 0 };
       
    93 
       
    94 JSHTMLOptionElementConstructor::JSHTMLOptionElementConstructor(ExecState* exec, JSDOMGlobalObject* globalObject)
       
    95     : DOMConstructorObject(JSHTMLOptionElementConstructor::createStructure(globalObject->objectPrototype()), globalObject)
       
    96 {
       
    97     putDirect(exec->propertyNames().prototype, JSHTMLOptionElementPrototype::self(exec, globalObject), DontDelete | ReadOnly);
       
    98 }
       
    99 
       
   100 bool JSHTMLOptionElementConstructor::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
       
   101 {
       
   102     return getStaticValueSlot<JSHTMLOptionElementConstructor, DOMObject>(exec, &JSHTMLOptionElementConstructorTable, this, propertyName, slot);
       
   103 }
       
   104 
       
   105 bool JSHTMLOptionElementConstructor::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
       
   106 {
       
   107     return getStaticValueDescriptor<JSHTMLOptionElementConstructor, DOMObject>(exec, &JSHTMLOptionElementConstructorTable, this, propertyName, descriptor);
       
   108 }
       
   109 
       
   110 /* Hash table for prototype */
       
   111 #if ENABLE(JIT)
       
   112 #define THUNK_GENERATOR(generator) , generator
       
   113 #else
       
   114 #define THUNK_GENERATOR(generator)
       
   115 #endif
       
   116 
       
   117 static const HashTableValue JSHTMLOptionElementPrototypeTableValues[1] =
       
   118 {
       
   119     { 0, 0, 0, 0 THUNK_GENERATOR(0) }
       
   120 };
       
   121 
       
   122 #undef THUNK_GENERATOR
       
   123 static JSC_CONST_HASHTABLE HashTable JSHTMLOptionElementPrototypeTable = { 1, 0, JSHTMLOptionElementPrototypeTableValues, 0 };
       
   124 const ClassInfo JSHTMLOptionElementPrototype::s_info = { "HTMLOptionElementPrototype", 0, &JSHTMLOptionElementPrototypeTable, 0 };
       
   125 
       
   126 JSObject* JSHTMLOptionElementPrototype::self(ExecState* exec, JSGlobalObject* globalObject)
       
   127 {
       
   128     return getDOMPrototype<JSHTMLOptionElement>(exec, globalObject);
       
   129 }
       
   130 
       
   131 const ClassInfo JSHTMLOptionElement::s_info = { "HTMLOptionElement", &JSHTMLElement::s_info, &JSHTMLOptionElementTable, 0 };
       
   132 
       
   133 JSHTMLOptionElement::JSHTMLOptionElement(NonNullPassRefPtr<Structure> structure, JSDOMGlobalObject* globalObject, PassRefPtr<HTMLOptionElement> impl)
       
   134     : JSHTMLElement(structure, globalObject, impl)
       
   135 {
       
   136 }
       
   137 
       
   138 JSObject* JSHTMLOptionElement::createPrototype(ExecState* exec, JSGlobalObject* globalObject)
       
   139 {
       
   140     return new (exec) JSHTMLOptionElementPrototype(globalObject, JSHTMLOptionElementPrototype::createStructure(JSHTMLElementPrototype::self(exec, globalObject)));
       
   141 }
       
   142 
       
   143 bool JSHTMLOptionElement::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
       
   144 {
       
   145     return getStaticValueSlot<JSHTMLOptionElement, Base>(exec, &JSHTMLOptionElementTable, this, propertyName, slot);
       
   146 }
       
   147 
       
   148 bool JSHTMLOptionElement::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
       
   149 {
       
   150     return getStaticValueDescriptor<JSHTMLOptionElement, Base>(exec, &JSHTMLOptionElementTable, this, propertyName, descriptor);
       
   151 }
       
   152 
       
   153 JSValue jsHTMLOptionElementForm(ExecState* exec, JSValue slotBase, const Identifier&)
       
   154 {
       
   155     JSHTMLOptionElement* castedThis = static_cast<JSHTMLOptionElement*>(asObject(slotBase));
       
   156     UNUSED_PARAM(exec);
       
   157     HTMLOptionElement* imp = static_cast<HTMLOptionElement*>(castedThis->impl());
       
   158     JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->form()));
       
   159     return result;
       
   160 }
       
   161 
       
   162 JSValue jsHTMLOptionElementDefaultSelected(ExecState* exec, JSValue slotBase, const Identifier&)
       
   163 {
       
   164     JSHTMLOptionElement* castedThis = static_cast<JSHTMLOptionElement*>(asObject(slotBase));
       
   165     UNUSED_PARAM(exec);
       
   166     HTMLOptionElement* imp = static_cast<HTMLOptionElement*>(castedThis->impl());
       
   167     JSValue result = jsBoolean(imp->hasAttribute(WebCore::HTMLNames::selectedAttr));
       
   168     return result;
       
   169 }
       
   170 
       
   171 JSValue jsHTMLOptionElementText(ExecState* exec, JSValue slotBase, const Identifier&)
       
   172 {
       
   173     JSHTMLOptionElement* castedThis = static_cast<JSHTMLOptionElement*>(asObject(slotBase));
       
   174     UNUSED_PARAM(exec);
       
   175     HTMLOptionElement* imp = static_cast<HTMLOptionElement*>(castedThis->impl());
       
   176     JSValue result = jsString(exec, imp->text());
       
   177     return result;
       
   178 }
       
   179 
       
   180 JSValue jsHTMLOptionElementIndex(ExecState* exec, JSValue slotBase, const Identifier&)
       
   181 {
       
   182     JSHTMLOptionElement* castedThis = static_cast<JSHTMLOptionElement*>(asObject(slotBase));
       
   183     UNUSED_PARAM(exec);
       
   184     HTMLOptionElement* imp = static_cast<HTMLOptionElement*>(castedThis->impl());
       
   185     JSValue result = jsNumber(exec, imp->index());
       
   186     return result;
       
   187 }
       
   188 
       
   189 JSValue jsHTMLOptionElementDisabled(ExecState* exec, JSValue slotBase, const Identifier&)
       
   190 {
       
   191     JSHTMLOptionElement* castedThis = static_cast<JSHTMLOptionElement*>(asObject(slotBase));
       
   192     UNUSED_PARAM(exec);
       
   193     HTMLOptionElement* imp = static_cast<HTMLOptionElement*>(castedThis->impl());
       
   194     JSValue result = jsBoolean(imp->hasAttribute(WebCore::HTMLNames::disabledAttr));
       
   195     return result;
       
   196 }
       
   197 
       
   198 JSValue jsHTMLOptionElementLabel(ExecState* exec, JSValue slotBase, const Identifier&)
       
   199 {
       
   200     JSHTMLOptionElement* castedThis = static_cast<JSHTMLOptionElement*>(asObject(slotBase));
       
   201     UNUSED_PARAM(exec);
       
   202     HTMLOptionElement* imp = static_cast<HTMLOptionElement*>(castedThis->impl());
       
   203     JSValue result = jsString(exec, imp->getAttribute(WebCore::HTMLNames::labelAttr));
       
   204     return result;
       
   205 }
       
   206 
       
   207 JSValue jsHTMLOptionElementSelected(ExecState* exec, JSValue slotBase, const Identifier&)
       
   208 {
       
   209     JSHTMLOptionElement* castedThis = static_cast<JSHTMLOptionElement*>(asObject(slotBase));
       
   210     UNUSED_PARAM(exec);
       
   211     HTMLOptionElement* imp = static_cast<HTMLOptionElement*>(castedThis->impl());
       
   212     JSValue result = jsBoolean(imp->selected());
       
   213     return result;
       
   214 }
       
   215 
       
   216 JSValue jsHTMLOptionElementValue(ExecState* exec, JSValue slotBase, const Identifier&)
       
   217 {
       
   218     JSHTMLOptionElement* castedThis = static_cast<JSHTMLOptionElement*>(asObject(slotBase));
       
   219     UNUSED_PARAM(exec);
       
   220     HTMLOptionElement* imp = static_cast<HTMLOptionElement*>(castedThis->impl());
       
   221     JSValue result = jsString(exec, imp->value());
       
   222     return result;
       
   223 }
       
   224 
       
   225 JSValue jsHTMLOptionElementConstructor(ExecState* exec, JSValue slotBase, const Identifier&)
       
   226 {
       
   227     JSHTMLOptionElement* domObject = static_cast<JSHTMLOptionElement*>(asObject(slotBase));
       
   228     return JSHTMLOptionElement::getConstructor(exec, domObject->globalObject());
       
   229 }
       
   230 void JSHTMLOptionElement::put(ExecState* exec, const Identifier& propertyName, JSValue value, PutPropertySlot& slot)
       
   231 {
       
   232     lookupPut<JSHTMLOptionElement, Base>(exec, propertyName, value, &JSHTMLOptionElementTable, this, slot);
       
   233 }
       
   234 
       
   235 void setJSHTMLOptionElementDefaultSelected(ExecState* exec, JSObject* thisObject, JSValue value)
       
   236 {
       
   237     JSHTMLOptionElement* castedThis = static_cast<JSHTMLOptionElement*>(thisObject);
       
   238     HTMLOptionElement* imp = static_cast<HTMLOptionElement*>(castedThis->impl());
       
   239     imp->setBooleanAttribute(WebCore::HTMLNames::selectedAttr, value.toBoolean(exec));
       
   240 }
       
   241 
       
   242 void setJSHTMLOptionElementText(ExecState* exec, JSObject* thisObject, JSValue value)
       
   243 {
       
   244     JSHTMLOptionElement* castedThis = static_cast<JSHTMLOptionElement*>(thisObject);
       
   245     HTMLOptionElement* imp = static_cast<HTMLOptionElement*>(castedThis->impl());
       
   246     ExceptionCode ec = 0;
       
   247     imp->setText(valueToStringWithNullCheck(exec, value), ec);
       
   248     setDOMException(exec, ec);
       
   249 }
       
   250 
       
   251 void setJSHTMLOptionElementDisabled(ExecState* exec, JSObject* thisObject, JSValue value)
       
   252 {
       
   253     JSHTMLOptionElement* castedThis = static_cast<JSHTMLOptionElement*>(thisObject);
       
   254     HTMLOptionElement* imp = static_cast<HTMLOptionElement*>(castedThis->impl());
       
   255     imp->setBooleanAttribute(WebCore::HTMLNames::disabledAttr, value.toBoolean(exec));
       
   256 }
       
   257 
       
   258 void setJSHTMLOptionElementLabel(ExecState* exec, JSObject* thisObject, JSValue value)
       
   259 {
       
   260     JSHTMLOptionElement* castedThis = static_cast<JSHTMLOptionElement*>(thisObject);
       
   261     HTMLOptionElement* imp = static_cast<HTMLOptionElement*>(castedThis->impl());
       
   262     imp->setAttribute(WebCore::HTMLNames::labelAttr, valueToStringWithNullCheck(exec, value));
       
   263 }
       
   264 
       
   265 void setJSHTMLOptionElementSelected(ExecState* exec, JSObject* thisObject, JSValue value)
       
   266 {
       
   267     JSHTMLOptionElement* castedThis = static_cast<JSHTMLOptionElement*>(thisObject);
       
   268     HTMLOptionElement* imp = static_cast<HTMLOptionElement*>(castedThis->impl());
       
   269     imp->setSelected(value.toBoolean(exec));
       
   270 }
       
   271 
       
   272 void setJSHTMLOptionElementValue(ExecState* exec, JSObject* thisObject, JSValue value)
       
   273 {
       
   274     JSHTMLOptionElement* castedThis = static_cast<JSHTMLOptionElement*>(thisObject);
       
   275     HTMLOptionElement* imp = static_cast<HTMLOptionElement*>(castedThis->impl());
       
   276     imp->setValue(valueToStringWithNullCheck(exec, value));
       
   277 }
       
   278 
       
   279 JSValue JSHTMLOptionElement::getConstructor(ExecState* exec, JSGlobalObject* globalObject)
       
   280 {
       
   281     return getDOMConstructor<JSHTMLOptionElementConstructor>(exec, static_cast<JSDOMGlobalObject*>(globalObject));
       
   282 }
       
   283 
       
   284 HTMLOptionElement* toHTMLOptionElement(JSC::JSValue value)
       
   285 {
       
   286     return value.inherits(&JSHTMLOptionElement::s_info) ? static_cast<JSHTMLOptionElement*>(asObject(value))->impl() : 0;
       
   287 }
       
   288 
       
   289 }