webengine/osswebengine/DerivedSources/WebCore/JSHTMLButtonElement.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 "JSHTMLButtonElement.h"
       
    24 
       
    25 #include <wtf/GetPtr.h>
       
    26 
       
    27 #include "HTMLButtonElement.h"
       
    28 #include "HTMLFormElement.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 JSHTMLButtonElementTableEntries[] =
       
    39 {
       
    40     { 0, 0, 0, 0, 0 },
       
    41     { "disabled", JSHTMLButtonElement::DisabledAttrNum, DontDelete, 0, &JSHTMLButtonElementTableEntries[8] },
       
    42     { 0, 0, 0, 0, 0 },
       
    43     { "type", JSHTMLButtonElement::TypeAttrNum, DontDelete|ReadOnly, 0, &JSHTMLButtonElementTableEntries[10] },
       
    44     { 0, 0, 0, 0, 0 },
       
    45     { "form", JSHTMLButtonElement::FormAttrNum, DontDelete|ReadOnly, 0, &JSHTMLButtonElementTableEntries[9] },
       
    46     { "accessKey", JSHTMLButtonElement::AccessKeyAttrNum, DontDelete, 0, 0 },
       
    47     { 0, 0, 0, 0, 0 },
       
    48     { "name", JSHTMLButtonElement::NameAttrNum, DontDelete, 0, &JSHTMLButtonElementTableEntries[11] },
       
    49     { "tabIndex", JSHTMLButtonElement::TabIndexAttrNum, DontDelete, 0, 0 },
       
    50     { "value", JSHTMLButtonElement::ValueAttrNum, DontDelete, 0, 0 },
       
    51     { "constructor", JSHTMLButtonElement::ConstructorAttrNum, DontDelete|DontEnum|ReadOnly, 0, 0 }
       
    52 };
       
    53 
       
    54 static const HashTable JSHTMLButtonElementTable = 
       
    55 {
       
    56     2, 12, JSHTMLButtonElementTableEntries, 8
       
    57 };
       
    58 
       
    59 /* Hash table for constructor */
       
    60 
       
    61 static const HashEntry JSHTMLButtonElementConstructorTableEntries[] =
       
    62 {
       
    63     { 0, 0, 0, 0, 0 }
       
    64 };
       
    65 
       
    66 static const HashTable JSHTMLButtonElementConstructorTable = 
       
    67 {
       
    68     2, 1, JSHTMLButtonElementConstructorTableEntries, 1
       
    69 };
       
    70 
       
    71 class JSHTMLButtonElementConstructor : public DOMObject {
       
    72 public:
       
    73     JSHTMLButtonElementConstructor(ExecState* exec)
       
    74     {
       
    75         setPrototype(exec->lexicalInterpreter()->builtinObjectPrototype());
       
    76         putDirect(exec->propertyNames().prototype, JSHTMLButtonElementPrototype::self(exec), None);
       
    77     }
       
    78     virtual bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&);
       
    79     JSValue* getValueProperty(ExecState*, int token) const;
       
    80     virtual const ClassInfo* classInfo() const { return &info; }
       
    81     static const ClassInfo info;
       
    82 
       
    83     virtual bool implementsHasInstance() const { return true; }
       
    84 };
       
    85 
       
    86 const ClassInfo JSHTMLButtonElementConstructor::info = { "HTMLButtonElementConstructor", 0, &JSHTMLButtonElementConstructorTable, 0 };
       
    87 
       
    88 bool JSHTMLButtonElementConstructor::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
       
    89 {
       
    90     return getStaticValueSlot<JSHTMLButtonElementConstructor, DOMObject>(exec, &JSHTMLButtonElementConstructorTable, this, propertyName, slot);
       
    91 }
       
    92 
       
    93 JSValue* JSHTMLButtonElementConstructor::getValueProperty(ExecState*, int token) const
       
    94 {
       
    95     // The token is the numeric value of its associated constant
       
    96     return jsNumber(token);
       
    97 }
       
    98 
       
    99 /* Hash table for prototype */
       
   100 
       
   101 static const HashEntry JSHTMLButtonElementPrototypeTableEntries[] =
       
   102 {
       
   103     { "click", JSHTMLButtonElement::ClickFuncNum, DontDelete|Function, 0, 0 }
       
   104 };
       
   105 
       
   106 static const HashTable JSHTMLButtonElementPrototypeTable = 
       
   107 {
       
   108     2, 1, JSHTMLButtonElementPrototypeTableEntries, 1
       
   109 };
       
   110 
       
   111 const ClassInfo JSHTMLButtonElementPrototype::info = { "HTMLButtonElementPrototype", 0, &JSHTMLButtonElementPrototypeTable, 0 };
       
   112 
       
   113 JSObject* JSHTMLButtonElementPrototype::self(ExecState* exec)
       
   114 {
       
   115     return KJS::cacheGlobalObject<JSHTMLButtonElementPrototype>(exec, "[[JSHTMLButtonElement.prototype]]");
       
   116 }
       
   117 
       
   118 bool JSHTMLButtonElementPrototype::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
       
   119 {
       
   120     return getStaticFunctionSlot<JSHTMLButtonElementPrototypeFunction, JSObject>(exec, &JSHTMLButtonElementPrototypeTable, this, propertyName, slot);
       
   121 }
       
   122 
       
   123 const ClassInfo JSHTMLButtonElement::info = { "HTMLButtonElement", &JSHTMLElement::info, &JSHTMLButtonElementTable, 0 };
       
   124 
       
   125 JSHTMLButtonElement::JSHTMLButtonElement(ExecState* exec, HTMLButtonElement* impl)
       
   126     : JSHTMLElement(exec, impl)
       
   127 {
       
   128     setPrototype(JSHTMLButtonElementPrototype::self(exec));
       
   129 }
       
   130 
       
   131 bool JSHTMLButtonElement::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
       
   132 {
       
   133     return getStaticValueSlot<JSHTMLButtonElement, JSHTMLElement>(exec, &JSHTMLButtonElementTable, this, propertyName, slot);
       
   134 }
       
   135 
       
   136 JSValue* JSHTMLButtonElement::getValueProperty(ExecState* exec, int token) const
       
   137 {
       
   138     switch (token) {
       
   139     case FormAttrNum: {
       
   140         HTMLButtonElement* imp = static_cast<HTMLButtonElement*>(impl());
       
   141 
       
   142         return toJS(exec, WTF::getPtr(imp->form()));
       
   143     }
       
   144     case AccessKeyAttrNum: {
       
   145         HTMLButtonElement* imp = static_cast<HTMLButtonElement*>(impl());
       
   146 
       
   147         return jsString(imp->accessKey());
       
   148     }
       
   149     case DisabledAttrNum: {
       
   150         HTMLButtonElement* imp = static_cast<HTMLButtonElement*>(impl());
       
   151 
       
   152         return jsBoolean(imp->disabled());
       
   153     }
       
   154     case NameAttrNum: {
       
   155         HTMLButtonElement* imp = static_cast<HTMLButtonElement*>(impl());
       
   156 
       
   157         return jsString(imp->name());
       
   158     }
       
   159     case TabIndexAttrNum: {
       
   160         HTMLButtonElement* imp = static_cast<HTMLButtonElement*>(impl());
       
   161 
       
   162         return jsNumber(imp->tabIndex());
       
   163     }
       
   164     case TypeAttrNum: {
       
   165         HTMLButtonElement* imp = static_cast<HTMLButtonElement*>(impl());
       
   166 
       
   167         return jsString(imp->type());
       
   168     }
       
   169     case ValueAttrNum: {
       
   170         HTMLButtonElement* imp = static_cast<HTMLButtonElement*>(impl());
       
   171 
       
   172         return jsString(imp->value());
       
   173     }
       
   174     case ConstructorAttrNum:
       
   175         return getConstructor(exec);
       
   176     }
       
   177     return 0;
       
   178 }
       
   179 
       
   180 void JSHTMLButtonElement::put(ExecState* exec, const Identifier& propertyName, JSValue* value, int attr)
       
   181 {
       
   182     lookupPut<JSHTMLButtonElement, JSHTMLElement>(exec, propertyName, value, attr, &JSHTMLButtonElementTable, this);
       
   183 }
       
   184 
       
   185 void JSHTMLButtonElement::putValueProperty(ExecState* exec, int token, JSValue* value, int /*attr*/)
       
   186 {
       
   187     switch (token) {
       
   188     case AccessKeyAttrNum: {
       
   189         HTMLButtonElement* imp = static_cast<HTMLButtonElement*>(impl());
       
   190 
       
   191         imp->setAccessKey(valueToStringWithNullCheck(exec, value));
       
   192         break;
       
   193     }
       
   194     case DisabledAttrNum: {
       
   195         HTMLButtonElement* imp = static_cast<HTMLButtonElement*>(impl());
       
   196 
       
   197         imp->setDisabled(value->toBoolean(exec));
       
   198         break;
       
   199     }
       
   200     case NameAttrNum: {
       
   201         HTMLButtonElement* imp = static_cast<HTMLButtonElement*>(impl());
       
   202 
       
   203         imp->setName(valueToStringWithNullCheck(exec, value));
       
   204         break;
       
   205     }
       
   206     case TabIndexAttrNum: {
       
   207         HTMLButtonElement* imp = static_cast<HTMLButtonElement*>(impl());
       
   208 
       
   209         imp->setTabIndex(value->toInt32(exec));
       
   210         break;
       
   211     }
       
   212     case ValueAttrNum: {
       
   213         HTMLButtonElement* imp = static_cast<HTMLButtonElement*>(impl());
       
   214 
       
   215         imp->setValue(valueToStringWithNullCheck(exec, value));
       
   216         break;
       
   217     }
       
   218     }
       
   219 }
       
   220 
       
   221 JSValue* JSHTMLButtonElement::getConstructor(ExecState* exec)
       
   222 {
       
   223     return KJS::cacheGlobalObject<JSHTMLButtonElementConstructor>(exec, "[[HTMLButtonElement.constructor]]");
       
   224 }
       
   225 JSValue* JSHTMLButtonElementPrototypeFunction::callAsFunction(ExecState* exec, JSObject* thisObj, const List& args)
       
   226 {
       
   227     if (!thisObj->inherits(&JSHTMLButtonElement::info))
       
   228       return throwError(exec, TypeError);
       
   229 
       
   230     HTMLButtonElement* imp = static_cast<HTMLButtonElement*>(static_cast<JSHTMLButtonElement*>(thisObj)->impl());
       
   231 
       
   232     switch (id) {
       
   233     case JSHTMLButtonElement::ClickFuncNum: {
       
   234 
       
   235         imp->click();
       
   236         return jsUndefined();
       
   237     }
       
   238     }
       
   239     return 0;
       
   240 }
       
   241 
       
   242 }