webengine/osswebengine/DerivedSources/WebCore/JSHTMLTextAreaElement.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 "JSHTMLTextAreaElement.h"
       
    24 
       
    25 #include <wtf/GetPtr.h>
       
    26 
       
    27 #include "ExceptionCode.h"
       
    28 #include "HTMLFormElement.h"
       
    29 #include "HTMLTextAreaElement.h"
       
    30 #include "JSHTMLFormElement.h"
       
    31 #include "PlatformString.h"
       
    32 
       
    33 using namespace KJS;
       
    34 
       
    35 namespace WebCore {
       
    36 
       
    37 /* Hash table */
       
    38 
       
    39 static const HashEntry JSHTMLTextAreaElementTableEntries[] =
       
    40 {
       
    41     { 0, 0, 0, 0, 0 },
       
    42     { "tabIndex", JSHTMLTextAreaElement::TabIndexAttrNum, DontDelete, 0, 0 },
       
    43     { 0, 0, 0, 0, 0 },
       
    44     { "defaultValue", JSHTMLTextAreaElement::DefaultValueAttrNum, DontDelete, 0, &JSHTMLTextAreaElementTableEntries[16] },
       
    45     { 0, 0, 0, 0, 0 },
       
    46     { "rows", JSHTMLTextAreaElement::RowsAttrNum, DontDelete, 0, 0 },
       
    47     { 0, 0, 0, 0, 0 },
       
    48     { 0, 0, 0, 0, 0 },
       
    49     { "accessKey", JSHTMLTextAreaElement::AccessKeyAttrNum, DontDelete, 0, 0 },
       
    50     { "form", JSHTMLTextAreaElement::FormAttrNum, DontDelete|ReadOnly, 0, &JSHTMLTextAreaElementTableEntries[14] },
       
    51     { 0, 0, 0, 0, 0 },
       
    52     { "disabled", JSHTMLTextAreaElement::DisabledAttrNum, DontDelete, 0, &JSHTMLTextAreaElementTableEntries[15] },
       
    53     { "readOnly", JSHTMLTextAreaElement::ReadOnlyAttrNum, DontDelete, 0, &JSHTMLTextAreaElementTableEntries[18] },
       
    54     { "cols", JSHTMLTextAreaElement::ColsAttrNum, DontDelete, 0, 0 },
       
    55     { "name", JSHTMLTextAreaElement::NameAttrNum, DontDelete, 0, &JSHTMLTextAreaElementTableEntries[17] },
       
    56     { "type", JSHTMLTextAreaElement::TypeAttrNum, DontDelete|ReadOnly, 0, 0 },
       
    57     { "value", JSHTMLTextAreaElement::ValueAttrNum, DontDelete, 0, 0 },
       
    58     { "selectionStart", JSHTMLTextAreaElement::SelectionStartAttrNum, DontDelete, 0, &JSHTMLTextAreaElementTableEntries[19] },
       
    59     { "selectionEnd", JSHTMLTextAreaElement::SelectionEndAttrNum, DontDelete, 0, 0 },
       
    60     { "constructor", JSHTMLTextAreaElement::ConstructorAttrNum, DontDelete|DontEnum|ReadOnly, 0, 0 }
       
    61 };
       
    62 
       
    63 static const HashTable JSHTMLTextAreaElementTable = 
       
    64 {
       
    65     2, 20, JSHTMLTextAreaElementTableEntries, 14
       
    66 };
       
    67 
       
    68 /* Hash table for constructor */
       
    69 
       
    70 static const HashEntry JSHTMLTextAreaElementConstructorTableEntries[] =
       
    71 {
       
    72     { 0, 0, 0, 0, 0 }
       
    73 };
       
    74 
       
    75 static const HashTable JSHTMLTextAreaElementConstructorTable = 
       
    76 {
       
    77     2, 1, JSHTMLTextAreaElementConstructorTableEntries, 1
       
    78 };
       
    79 
       
    80 class JSHTMLTextAreaElementConstructor : public DOMObject {
       
    81 public:
       
    82     JSHTMLTextAreaElementConstructor(ExecState* exec)
       
    83     {
       
    84         setPrototype(exec->lexicalInterpreter()->builtinObjectPrototype());
       
    85         putDirect(exec->propertyNames().prototype, JSHTMLTextAreaElementPrototype::self(exec), None);
       
    86     }
       
    87     virtual bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&);
       
    88     JSValue* getValueProperty(ExecState*, int token) const;
       
    89     virtual const ClassInfo* classInfo() const { return &info; }
       
    90     static const ClassInfo info;
       
    91 
       
    92     virtual bool implementsHasInstance() const { return true; }
       
    93 };
       
    94 
       
    95 const ClassInfo JSHTMLTextAreaElementConstructor::info = { "HTMLTextAreaElementConstructor", 0, &JSHTMLTextAreaElementConstructorTable, 0 };
       
    96 
       
    97 bool JSHTMLTextAreaElementConstructor::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
       
    98 {
       
    99     return getStaticValueSlot<JSHTMLTextAreaElementConstructor, DOMObject>(exec, &JSHTMLTextAreaElementConstructorTable, this, propertyName, slot);
       
   100 }
       
   101 
       
   102 JSValue* JSHTMLTextAreaElementConstructor::getValueProperty(ExecState*, int token) const
       
   103 {
       
   104     // The token is the numeric value of its associated constant
       
   105     return jsNumber(token);
       
   106 }
       
   107 
       
   108 /* Hash table for prototype */
       
   109 
       
   110 static const HashEntry JSHTMLTextAreaElementPrototypeTableEntries[] =
       
   111 {
       
   112     { 0, 0, 0, 0, 0 },
       
   113     { 0, 0, 0, 0, 0 },
       
   114     { "focus", JSHTMLTextAreaElement::FocusFuncNum, DontDelete|Function, 0, 0 },
       
   115     { "blur", JSHTMLTextAreaElement::BlurFuncNum, DontDelete|Function, 0, &JSHTMLTextAreaElementPrototypeTableEntries[4] },
       
   116     { "select", JSHTMLTextAreaElement::SelectFuncNum, DontDelete|Function, 0, &JSHTMLTextAreaElementPrototypeTableEntries[5] },
       
   117     { "setSelectionRange", JSHTMLTextAreaElement::SetSelectionRangeFuncNum, DontDelete|Function, 2, 0 }
       
   118 };
       
   119 
       
   120 static const HashTable JSHTMLTextAreaElementPrototypeTable = 
       
   121 {
       
   122     2, 6, JSHTMLTextAreaElementPrototypeTableEntries, 4
       
   123 };
       
   124 
       
   125 const ClassInfo JSHTMLTextAreaElementPrototype::info = { "HTMLTextAreaElementPrototype", 0, &JSHTMLTextAreaElementPrototypeTable, 0 };
       
   126 
       
   127 JSObject* JSHTMLTextAreaElementPrototype::self(ExecState* exec)
       
   128 {
       
   129     return KJS::cacheGlobalObject<JSHTMLTextAreaElementPrototype>(exec, "[[JSHTMLTextAreaElement.prototype]]");
       
   130 }
       
   131 
       
   132 bool JSHTMLTextAreaElementPrototype::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
       
   133 {
       
   134     return getStaticFunctionSlot<JSHTMLTextAreaElementPrototypeFunction, JSObject>(exec, &JSHTMLTextAreaElementPrototypeTable, this, propertyName, slot);
       
   135 }
       
   136 
       
   137 const ClassInfo JSHTMLTextAreaElement::info = { "HTMLTextAreaElement", &JSHTMLElement::info, &JSHTMLTextAreaElementTable, 0 };
       
   138 
       
   139 JSHTMLTextAreaElement::JSHTMLTextAreaElement(ExecState* exec, HTMLTextAreaElement* impl)
       
   140     : JSHTMLElement(exec, impl)
       
   141 {
       
   142     setPrototype(JSHTMLTextAreaElementPrototype::self(exec));
       
   143 }
       
   144 
       
   145 bool JSHTMLTextAreaElement::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
       
   146 {
       
   147     return getStaticValueSlot<JSHTMLTextAreaElement, JSHTMLElement>(exec, &JSHTMLTextAreaElementTable, this, propertyName, slot);
       
   148 }
       
   149 
       
   150 JSValue* JSHTMLTextAreaElement::getValueProperty(ExecState* exec, int token) const
       
   151 {
       
   152     switch (token) {
       
   153     case DefaultValueAttrNum: {
       
   154         HTMLTextAreaElement* imp = static_cast<HTMLTextAreaElement*>(impl());
       
   155 
       
   156         return jsString(imp->defaultValue());
       
   157     }
       
   158     case FormAttrNum: {
       
   159         HTMLTextAreaElement* imp = static_cast<HTMLTextAreaElement*>(impl());
       
   160 
       
   161         return toJS(exec, WTF::getPtr(imp->form()));
       
   162     }
       
   163     case AccessKeyAttrNum: {
       
   164         HTMLTextAreaElement* imp = static_cast<HTMLTextAreaElement*>(impl());
       
   165 
       
   166         return jsString(imp->accessKey());
       
   167     }
       
   168     case ColsAttrNum: {
       
   169         HTMLTextAreaElement* imp = static_cast<HTMLTextAreaElement*>(impl());
       
   170 
       
   171         return jsNumber(imp->cols());
       
   172     }
       
   173     case DisabledAttrNum: {
       
   174         HTMLTextAreaElement* imp = static_cast<HTMLTextAreaElement*>(impl());
       
   175 
       
   176         return jsBoolean(imp->disabled());
       
   177     }
       
   178     case NameAttrNum: {
       
   179         HTMLTextAreaElement* imp = static_cast<HTMLTextAreaElement*>(impl());
       
   180 
       
   181         return jsString(imp->name());
       
   182     }
       
   183     case ReadOnlyAttrNum: {
       
   184         HTMLTextAreaElement* imp = static_cast<HTMLTextAreaElement*>(impl());
       
   185 
       
   186         return jsBoolean(imp->readOnly());
       
   187     }
       
   188     case RowsAttrNum: {
       
   189         HTMLTextAreaElement* imp = static_cast<HTMLTextAreaElement*>(impl());
       
   190 
       
   191         return jsNumber(imp->rows());
       
   192     }
       
   193     case TabIndexAttrNum: {
       
   194         HTMLTextAreaElement* imp = static_cast<HTMLTextAreaElement*>(impl());
       
   195 
       
   196         return jsNumber(imp->tabIndex());
       
   197     }
       
   198     case TypeAttrNum: {
       
   199         HTMLTextAreaElement* imp = static_cast<HTMLTextAreaElement*>(impl());
       
   200 
       
   201         return jsString(imp->type());
       
   202     }
       
   203     case ValueAttrNum: {
       
   204         HTMLTextAreaElement* imp = static_cast<HTMLTextAreaElement*>(impl());
       
   205 
       
   206         return jsString(imp->value());
       
   207     }
       
   208     case SelectionStartAttrNum: {
       
   209         HTMLTextAreaElement* imp = static_cast<HTMLTextAreaElement*>(impl());
       
   210 
       
   211         return jsNumber(imp->selectionStart());
       
   212     }
       
   213     case SelectionEndAttrNum: {
       
   214         HTMLTextAreaElement* imp = static_cast<HTMLTextAreaElement*>(impl());
       
   215 
       
   216         return jsNumber(imp->selectionEnd());
       
   217     }
       
   218     case ConstructorAttrNum:
       
   219         return getConstructor(exec);
       
   220     }
       
   221     return 0;
       
   222 }
       
   223 
       
   224 void JSHTMLTextAreaElement::put(ExecState* exec, const Identifier& propertyName, JSValue* value, int attr)
       
   225 {
       
   226     lookupPut<JSHTMLTextAreaElement, JSHTMLElement>(exec, propertyName, value, attr, &JSHTMLTextAreaElementTable, this);
       
   227 }
       
   228 
       
   229 void JSHTMLTextAreaElement::putValueProperty(ExecState* exec, int token, JSValue* value, int /*attr*/)
       
   230 {
       
   231     switch (token) {
       
   232     case DefaultValueAttrNum: {
       
   233         HTMLTextAreaElement* imp = static_cast<HTMLTextAreaElement*>(impl());
       
   234 
       
   235         imp->setDefaultValue(valueToStringWithNullCheck(exec, value));
       
   236         break;
       
   237     }
       
   238     case AccessKeyAttrNum: {
       
   239         HTMLTextAreaElement* imp = static_cast<HTMLTextAreaElement*>(impl());
       
   240 
       
   241         imp->setAccessKey(valueToStringWithNullCheck(exec, value));
       
   242         break;
       
   243     }
       
   244     case ColsAttrNum: {
       
   245         HTMLTextAreaElement* imp = static_cast<HTMLTextAreaElement*>(impl());
       
   246 
       
   247         imp->setCols(value->toInt32(exec));
       
   248         break;
       
   249     }
       
   250     case DisabledAttrNum: {
       
   251         HTMLTextAreaElement* imp = static_cast<HTMLTextAreaElement*>(impl());
       
   252 
       
   253         imp->setDisabled(value->toBoolean(exec));
       
   254         break;
       
   255     }
       
   256     case NameAttrNum: {
       
   257         HTMLTextAreaElement* imp = static_cast<HTMLTextAreaElement*>(impl());
       
   258 
       
   259         imp->setName(valueToStringWithNullCheck(exec, value));
       
   260         break;
       
   261     }
       
   262     case ReadOnlyAttrNum: {
       
   263         HTMLTextAreaElement* imp = static_cast<HTMLTextAreaElement*>(impl());
       
   264 
       
   265         imp->setReadOnly(value->toBoolean(exec));
       
   266         break;
       
   267     }
       
   268     case RowsAttrNum: {
       
   269         HTMLTextAreaElement* imp = static_cast<HTMLTextAreaElement*>(impl());
       
   270 
       
   271         imp->setRows(value->toInt32(exec));
       
   272         break;
       
   273     }
       
   274     case TabIndexAttrNum: {
       
   275         HTMLTextAreaElement* imp = static_cast<HTMLTextAreaElement*>(impl());
       
   276 
       
   277         imp->setTabIndex(value->toInt32(exec));
       
   278         break;
       
   279     }
       
   280     case ValueAttrNum: {
       
   281         HTMLTextAreaElement* imp = static_cast<HTMLTextAreaElement*>(impl());
       
   282 
       
   283         imp->setValue(valueToStringWithNullCheck(exec, value));
       
   284         break;
       
   285     }
       
   286     case SelectionStartAttrNum: {
       
   287         HTMLTextAreaElement* imp = static_cast<HTMLTextAreaElement*>(impl());
       
   288 
       
   289         imp->setSelectionStart(value->toInt32(exec));
       
   290         break;
       
   291     }
       
   292     case SelectionEndAttrNum: {
       
   293         HTMLTextAreaElement* imp = static_cast<HTMLTextAreaElement*>(impl());
       
   294 
       
   295         imp->setSelectionEnd(value->toInt32(exec));
       
   296         break;
       
   297     }
       
   298     }
       
   299 }
       
   300 
       
   301 JSValue* JSHTMLTextAreaElement::getConstructor(ExecState* exec)
       
   302 {
       
   303     return KJS::cacheGlobalObject<JSHTMLTextAreaElementConstructor>(exec, "[[HTMLTextAreaElement.constructor]]");
       
   304 }
       
   305 JSValue* JSHTMLTextAreaElementPrototypeFunction::callAsFunction(ExecState* exec, JSObject* thisObj, const List& args)
       
   306 {
       
   307     if (!thisObj->inherits(&JSHTMLTextAreaElement::info))
       
   308       return throwError(exec, TypeError);
       
   309 
       
   310     HTMLTextAreaElement* imp = static_cast<HTMLTextAreaElement*>(static_cast<JSHTMLTextAreaElement*>(thisObj)->impl());
       
   311 
       
   312     switch (id) {
       
   313     case JSHTMLTextAreaElement::BlurFuncNum: {
       
   314 
       
   315         imp->blur();
       
   316         return jsUndefined();
       
   317     }
       
   318     case JSHTMLTextAreaElement::FocusFuncNum: {
       
   319 
       
   320         imp->focus();
       
   321         return jsUndefined();
       
   322     }
       
   323     case JSHTMLTextAreaElement::SelectFuncNum: {
       
   324 
       
   325         imp->select();
       
   326         return jsUndefined();
       
   327     }
       
   328     case JSHTMLTextAreaElement::SetSelectionRangeFuncNum: {
       
   329         bool startOk;
       
   330         int start = args[0]->toInt32(exec, startOk);
       
   331         if (!startOk) {
       
   332             setDOMException(exec, TYPE_MISMATCH_ERR);
       
   333             return jsUndefined();
       
   334         }
       
   335         bool endOk;
       
   336         int end = args[1]->toInt32(exec, endOk);
       
   337         if (!endOk) {
       
   338             setDOMException(exec, TYPE_MISMATCH_ERR);
       
   339             return jsUndefined();
       
   340         }
       
   341 
       
   342         imp->setSelectionRange(start, end);
       
   343         return jsUndefined();
       
   344     }
       
   345     }
       
   346     return 0;
       
   347 }
       
   348 
       
   349 }