webengine/osswebengine/DerivedSources/WebCore/JSHTMLOptionElement.cpp
changeset 0 dd21522fd290
equal deleted inserted replaced
-1:000000000000 0:dd21522fd290
       
     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 
       
    23 #include "JSHTMLOptionElement.h"
       
    24 
       
    25 #include <wtf/GetPtr.h>
       
    26 
       
    27 #include "HTMLFormElement.h"
       
    28 #include "HTMLOptionElement.h"
       
    29 #include "JSHTMLFormElement.h"
       
    30 #include "PlatformString.h"
       
    31 
       
    32 using namespace KJS;
       
    33 
       
    34 namespace WebCore {
       
    35 
       
    36 /* Hash table */
       
    37 
       
    38 static const HashEntry JSHTMLOptionElementTableEntries[] =
       
    39 {
       
    40     { 0, 0, 0, 0, 0 },
       
    41     { "disabled", JSHTMLOptionElement::DisabledAttrNum, DontDelete, 0, &JSHTMLOptionElementTableEntries[9] },
       
    42     { "index", JSHTMLOptionElement::IndexAttrNum, DontDelete, 0, 0 },
       
    43     { "value", JSHTMLOptionElement::ValueAttrNum, DontDelete, 0, 0 },
       
    44     { 0, 0, 0, 0, 0 },
       
    45     { "form", JSHTMLOptionElement::FormAttrNum, DontDelete|ReadOnly, 0, &JSHTMLOptionElementTableEntries[8] },
       
    46     { "text", JSHTMLOptionElement::TextAttrNum, DontDelete, 0, 0 },
       
    47     { 0, 0, 0, 0, 0 },
       
    48     { "defaultSelected", JSHTMLOptionElement::DefaultSelectedAttrNum, DontDelete, 0, 0 },
       
    49     { "label", JSHTMLOptionElement::LabelAttrNum, DontDelete, 0, &JSHTMLOptionElementTableEntries[10] },
       
    50     { "selected", JSHTMLOptionElement::SelectedAttrNum, DontDelete, 0, 0 }
       
    51 };
       
    52 
       
    53 static const HashTable JSHTMLOptionElementTable = 
       
    54 {
       
    55     2, 11, JSHTMLOptionElementTableEntries, 8
       
    56 };
       
    57 
       
    58 /* Hash table for prototype */
       
    59 
       
    60 static const HashEntry JSHTMLOptionElementPrototypeTableEntries[] =
       
    61 {
       
    62     { 0, 0, 0, 0, 0 }
       
    63 };
       
    64 
       
    65 static const HashTable JSHTMLOptionElementPrototypeTable = 
       
    66 {
       
    67     2, 1, JSHTMLOptionElementPrototypeTableEntries, 1
       
    68 };
       
    69 
       
    70 const ClassInfo JSHTMLOptionElementPrototype::info = { "HTMLOptionElementPrototype", 0, &JSHTMLOptionElementPrototypeTable, 0 };
       
    71 
       
    72 JSObject* JSHTMLOptionElementPrototype::self(ExecState* exec)
       
    73 {
       
    74     return KJS::cacheGlobalObject<JSHTMLOptionElementPrototype>(exec, "[[JSHTMLOptionElement.prototype]]");
       
    75 }
       
    76 
       
    77 const ClassInfo JSHTMLOptionElement::info = { "HTMLOptionElement", &JSHTMLElement::info, &JSHTMLOptionElementTable, 0 };
       
    78 
       
    79 JSHTMLOptionElement::JSHTMLOptionElement(ExecState* exec, HTMLOptionElement* impl)
       
    80     : JSHTMLElement(exec, impl)
       
    81 {
       
    82     setPrototype(JSHTMLOptionElementPrototype::self(exec));
       
    83 }
       
    84 
       
    85 bool JSHTMLOptionElement::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
       
    86 {
       
    87     return getStaticValueSlot<JSHTMLOptionElement, JSHTMLElement>(exec, &JSHTMLOptionElementTable, this, propertyName, slot);
       
    88 }
       
    89 
       
    90 JSValue* JSHTMLOptionElement::getValueProperty(ExecState* exec, int token) const
       
    91 {
       
    92     switch (token) {
       
    93     case FormAttrNum: {
       
    94         HTMLOptionElement* imp = static_cast<HTMLOptionElement*>(impl());
       
    95 
       
    96         return toJS(exec, WTF::getPtr(imp->form()));
       
    97     }
       
    98     case DefaultSelectedAttrNum: {
       
    99         HTMLOptionElement* imp = static_cast<HTMLOptionElement*>(impl());
       
   100 
       
   101         return jsBoolean(imp->defaultSelected());
       
   102     }
       
   103     case TextAttrNum: {
       
   104         HTMLOptionElement* imp = static_cast<HTMLOptionElement*>(impl());
       
   105 
       
   106         return jsString(imp->text());
       
   107     }
       
   108     case IndexAttrNum: {
       
   109         HTMLOptionElement* imp = static_cast<HTMLOptionElement*>(impl());
       
   110 
       
   111         return jsNumber(imp->index());
       
   112     }
       
   113     case DisabledAttrNum: {
       
   114         HTMLOptionElement* imp = static_cast<HTMLOptionElement*>(impl());
       
   115 
       
   116         return jsBoolean(imp->disabled());
       
   117     }
       
   118     case LabelAttrNum: {
       
   119         HTMLOptionElement* imp = static_cast<HTMLOptionElement*>(impl());
       
   120 
       
   121         return jsString(imp->label());
       
   122     }
       
   123     case SelectedAttrNum: {
       
   124         HTMLOptionElement* imp = static_cast<HTMLOptionElement*>(impl());
       
   125 
       
   126         return jsBoolean(imp->selected());
       
   127     }
       
   128     case ValueAttrNum: {
       
   129         HTMLOptionElement* imp = static_cast<HTMLOptionElement*>(impl());
       
   130 
       
   131         return jsString(imp->value());
       
   132     }
       
   133     }
       
   134     return 0;
       
   135 }
       
   136 
       
   137 void JSHTMLOptionElement::put(ExecState* exec, const Identifier& propertyName, JSValue* value, int attr)
       
   138 {
       
   139     lookupPut<JSHTMLOptionElement, JSHTMLElement>(exec, propertyName, value, attr, &JSHTMLOptionElementTable, this);
       
   140 }
       
   141 
       
   142 void JSHTMLOptionElement::putValueProperty(ExecState* exec, int token, JSValue* value, int /*attr*/)
       
   143 {
       
   144     switch (token) {
       
   145     case DefaultSelectedAttrNum: {
       
   146         HTMLOptionElement* imp = static_cast<HTMLOptionElement*>(impl());
       
   147 
       
   148         imp->setDefaultSelected(value->toBoolean(exec));
       
   149         break;
       
   150     }
       
   151     case TextAttrNum: {
       
   152         HTMLOptionElement* imp = static_cast<HTMLOptionElement*>(impl());
       
   153 
       
   154         ExceptionCode ec = 0;
       
   155         imp->setText(valueToStringWithNullCheck(exec, value), ec);
       
   156         setDOMException(exec, ec);
       
   157         break;
       
   158     }
       
   159     case IndexAttrNum: {
       
   160         HTMLOptionElement* imp = static_cast<HTMLOptionElement*>(impl());
       
   161 
       
   162         ExceptionCode ec = 0;
       
   163         imp->setIndex(value->toInt32(exec), ec);
       
   164         setDOMException(exec, ec);
       
   165         break;
       
   166     }
       
   167     case DisabledAttrNum: {
       
   168         HTMLOptionElement* imp = static_cast<HTMLOptionElement*>(impl());
       
   169 
       
   170         imp->setDisabled(value->toBoolean(exec));
       
   171         break;
       
   172     }
       
   173     case LabelAttrNum: {
       
   174         HTMLOptionElement* imp = static_cast<HTMLOptionElement*>(impl());
       
   175 
       
   176         imp->setLabel(valueToStringWithNullCheck(exec, value));
       
   177         break;
       
   178     }
       
   179     case SelectedAttrNum: {
       
   180         HTMLOptionElement* imp = static_cast<HTMLOptionElement*>(impl());
       
   181 
       
   182         imp->setSelected(value->toBoolean(exec));
       
   183         break;
       
   184     }
       
   185     case ValueAttrNum: {
       
   186         HTMLOptionElement* imp = static_cast<HTMLOptionElement*>(impl());
       
   187 
       
   188         imp->setValue(valueToStringWithNullCheck(exec, value));
       
   189         break;
       
   190     }
       
   191     }
       
   192 }
       
   193 
       
   194 HTMLOptionElement* toHTMLOptionElement(KJS::JSValue* val)
       
   195 {
       
   196     return val->isObject(&JSHTMLOptionElement::info) ? static_cast<JSHTMLOptionElement*>(val)->impl() : 0;
       
   197 }
       
   198 
       
   199 HTMLOptionElement* JSHTMLOptionElement::impl() const
       
   200 {
       
   201     return static_cast<HTMLOptionElement*>(JSHTMLElement::impl());
       
   202 }
       
   203 
       
   204 }