webengine/osswebengine/DerivedSources/WebCore/JSHTMLScriptElement.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 "JSHTMLScriptElement.h"
       
    24 
       
    25 #include <wtf/GetPtr.h>
       
    26 
       
    27 #include "HTMLScriptElement.h"
       
    28 #include "PlatformString.h"
       
    29 
       
    30 using namespace KJS;
       
    31 
       
    32 namespace WebCore {
       
    33 
       
    34 /* Hash table */
       
    35 
       
    36 static const HashEntry JSHTMLScriptElementTableEntries[] =
       
    37 {
       
    38     { "event", JSHTMLScriptElement::EventAttrNum, DontDelete, 0, 0 },
       
    39     { "htmlFor", JSHTMLScriptElement::HtmlForAttrNum, DontDelete, 0, &JSHTMLScriptElementTableEntries[9] },
       
    40     { "charset", JSHTMLScriptElement::CharsetAttrNum, DontDelete, 0, 0 },
       
    41     { "src", JSHTMLScriptElement::SrcAttrNum, DontDelete, 0, &JSHTMLScriptElementTableEntries[8] },
       
    42     { "defer", JSHTMLScriptElement::DeferAttrNum, DontDelete, 0, 0 },
       
    43     { 0, 0, 0, 0, 0 },
       
    44     { "text", JSHTMLScriptElement::TextAttrNum, DontDelete, 0, 0 },
       
    45     { 0, 0, 0, 0, 0 },
       
    46     { "type", JSHTMLScriptElement::TypeAttrNum, DontDelete, 0, 0 },
       
    47     { "constructor", JSHTMLScriptElement::ConstructorAttrNum, DontDelete|DontEnum|ReadOnly, 0, 0 }
       
    48 };
       
    49 
       
    50 static const HashTable JSHTMLScriptElementTable = 
       
    51 {
       
    52     2, 10, JSHTMLScriptElementTableEntries, 8
       
    53 };
       
    54 
       
    55 /* Hash table for constructor */
       
    56 
       
    57 static const HashEntry JSHTMLScriptElementConstructorTableEntries[] =
       
    58 {
       
    59     { 0, 0, 0, 0, 0 }
       
    60 };
       
    61 
       
    62 static const HashTable JSHTMLScriptElementConstructorTable = 
       
    63 {
       
    64     2, 1, JSHTMLScriptElementConstructorTableEntries, 1
       
    65 };
       
    66 
       
    67 class JSHTMLScriptElementConstructor : public DOMObject {
       
    68 public:
       
    69     JSHTMLScriptElementConstructor(ExecState* exec)
       
    70     {
       
    71         setPrototype(exec->lexicalInterpreter()->builtinObjectPrototype());
       
    72         putDirect(exec->propertyNames().prototype, JSHTMLScriptElementPrototype::self(exec), None);
       
    73     }
       
    74     virtual bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&);
       
    75     JSValue* getValueProperty(ExecState*, int token) const;
       
    76     virtual const ClassInfo* classInfo() const { return &info; }
       
    77     static const ClassInfo info;
       
    78 
       
    79     virtual bool implementsHasInstance() const { return true; }
       
    80 };
       
    81 
       
    82 const ClassInfo JSHTMLScriptElementConstructor::info = { "HTMLScriptElementConstructor", 0, &JSHTMLScriptElementConstructorTable, 0 };
       
    83 
       
    84 bool JSHTMLScriptElementConstructor::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
       
    85 {
       
    86     return getStaticValueSlot<JSHTMLScriptElementConstructor, DOMObject>(exec, &JSHTMLScriptElementConstructorTable, this, propertyName, slot);
       
    87 }
       
    88 
       
    89 JSValue* JSHTMLScriptElementConstructor::getValueProperty(ExecState*, int token) const
       
    90 {
       
    91     // The token is the numeric value of its associated constant
       
    92     return jsNumber(token);
       
    93 }
       
    94 
       
    95 /* Hash table for prototype */
       
    96 
       
    97 static const HashEntry JSHTMLScriptElementPrototypeTableEntries[] =
       
    98 {
       
    99     { 0, 0, 0, 0, 0 }
       
   100 };
       
   101 
       
   102 static const HashTable JSHTMLScriptElementPrototypeTable = 
       
   103 {
       
   104     2, 1, JSHTMLScriptElementPrototypeTableEntries, 1
       
   105 };
       
   106 
       
   107 const ClassInfo JSHTMLScriptElementPrototype::info = { "HTMLScriptElementPrototype", 0, &JSHTMLScriptElementPrototypeTable, 0 };
       
   108 
       
   109 JSObject* JSHTMLScriptElementPrototype::self(ExecState* exec)
       
   110 {
       
   111     return KJS::cacheGlobalObject<JSHTMLScriptElementPrototype>(exec, "[[JSHTMLScriptElement.prototype]]");
       
   112 }
       
   113 
       
   114 const ClassInfo JSHTMLScriptElement::info = { "HTMLScriptElement", &JSHTMLElement::info, &JSHTMLScriptElementTable, 0 };
       
   115 
       
   116 JSHTMLScriptElement::JSHTMLScriptElement(ExecState* exec, HTMLScriptElement* impl)
       
   117     : JSHTMLElement(exec, impl)
       
   118 {
       
   119     setPrototype(JSHTMLScriptElementPrototype::self(exec));
       
   120 }
       
   121 
       
   122 bool JSHTMLScriptElement::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
       
   123 {
       
   124     return getStaticValueSlot<JSHTMLScriptElement, JSHTMLElement>(exec, &JSHTMLScriptElementTable, this, propertyName, slot);
       
   125 }
       
   126 
       
   127 JSValue* JSHTMLScriptElement::getValueProperty(ExecState* exec, int token) const
       
   128 {
       
   129     switch (token) {
       
   130     case TextAttrNum: {
       
   131         HTMLScriptElement* imp = static_cast<HTMLScriptElement*>(impl());
       
   132 
       
   133         return jsString(imp->text());
       
   134     }
       
   135     case HtmlForAttrNum: {
       
   136         HTMLScriptElement* imp = static_cast<HTMLScriptElement*>(impl());
       
   137 
       
   138         return jsString(imp->htmlFor());
       
   139     }
       
   140     case EventAttrNum: {
       
   141         HTMLScriptElement* imp = static_cast<HTMLScriptElement*>(impl());
       
   142 
       
   143         return jsString(imp->event());
       
   144     }
       
   145     case CharsetAttrNum: {
       
   146         HTMLScriptElement* imp = static_cast<HTMLScriptElement*>(impl());
       
   147 
       
   148         return jsString(imp->charset());
       
   149     }
       
   150     case DeferAttrNum: {
       
   151         HTMLScriptElement* imp = static_cast<HTMLScriptElement*>(impl());
       
   152 
       
   153         return jsBoolean(imp->defer());
       
   154     }
       
   155     case SrcAttrNum: {
       
   156         HTMLScriptElement* imp = static_cast<HTMLScriptElement*>(impl());
       
   157 
       
   158         return jsString(imp->src());
       
   159     }
       
   160     case TypeAttrNum: {
       
   161         HTMLScriptElement* imp = static_cast<HTMLScriptElement*>(impl());
       
   162 
       
   163         return jsString(imp->type());
       
   164     }
       
   165     case ConstructorAttrNum:
       
   166         return getConstructor(exec);
       
   167     }
       
   168     return 0;
       
   169 }
       
   170 
       
   171 void JSHTMLScriptElement::put(ExecState* exec, const Identifier& propertyName, JSValue* value, int attr)
       
   172 {
       
   173     lookupPut<JSHTMLScriptElement, JSHTMLElement>(exec, propertyName, value, attr, &JSHTMLScriptElementTable, this);
       
   174 }
       
   175 
       
   176 void JSHTMLScriptElement::putValueProperty(ExecState* exec, int token, JSValue* value, int /*attr*/)
       
   177 {
       
   178     switch (token) {
       
   179     case TextAttrNum: {
       
   180         HTMLScriptElement* imp = static_cast<HTMLScriptElement*>(impl());
       
   181 
       
   182         imp->setText(valueToStringWithNullCheck(exec, value));
       
   183         break;
       
   184     }
       
   185     case HtmlForAttrNum: {
       
   186         HTMLScriptElement* imp = static_cast<HTMLScriptElement*>(impl());
       
   187 
       
   188         imp->setHtmlFor(valueToStringWithNullCheck(exec, value));
       
   189         break;
       
   190     }
       
   191     case EventAttrNum: {
       
   192         HTMLScriptElement* imp = static_cast<HTMLScriptElement*>(impl());
       
   193 
       
   194         imp->setEvent(valueToStringWithNullCheck(exec, value));
       
   195         break;
       
   196     }
       
   197     case CharsetAttrNum: {
       
   198         HTMLScriptElement* imp = static_cast<HTMLScriptElement*>(impl());
       
   199 
       
   200         imp->setCharset(valueToStringWithNullCheck(exec, value));
       
   201         break;
       
   202     }
       
   203     case DeferAttrNum: {
       
   204         HTMLScriptElement* imp = static_cast<HTMLScriptElement*>(impl());
       
   205 
       
   206         imp->setDefer(value->toBoolean(exec));
       
   207         break;
       
   208     }
       
   209     case SrcAttrNum: {
       
   210         HTMLScriptElement* imp = static_cast<HTMLScriptElement*>(impl());
       
   211 
       
   212         imp->setSrc(valueToStringWithNullCheck(exec, value));
       
   213         break;
       
   214     }
       
   215     case TypeAttrNum: {
       
   216         HTMLScriptElement* imp = static_cast<HTMLScriptElement*>(impl());
       
   217 
       
   218         imp->setType(valueToStringWithNullCheck(exec, value));
       
   219         break;
       
   220     }
       
   221     }
       
   222 }
       
   223 
       
   224 JSValue* JSHTMLScriptElement::getConstructor(ExecState* exec)
       
   225 {
       
   226     return KJS::cacheGlobalObject<JSHTMLScriptElementConstructor>(exec, "[[HTMLScriptElement.constructor]]");
       
   227 }
       
   228 
       
   229 }