webengine/osswebengine/DerivedSources/WebCore/JSHTMLImageElement.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 "JSHTMLImageElement.h"
       
    24 
       
    25 #include <wtf/GetPtr.h>
       
    26 
       
    27 #include "HTMLImageElement.h"
       
    28 #include "PlatformString.h"
       
    29 
       
    30 using namespace KJS;
       
    31 
       
    32 namespace WebCore {
       
    33 
       
    34 /* Hash table */
       
    35 
       
    36 static const HashEntry JSHTMLImageElementTableEntries[] =
       
    37 {
       
    38     { 0, 0, 0, 0, 0 },
       
    39     { "hspace", JSHTMLImageElement::HspaceAttrNum, DontDelete, 0, &JSHTMLImageElementTableEntries[26] },
       
    40     { 0, 0, 0, 0, 0 },
       
    41     { "align", JSHTMLImageElement::AlignAttrNum, DontDelete, 0, &JSHTMLImageElementTableEntries[19] },
       
    42     { "src", JSHTMLImageElement::SrcAttrNum, DontDelete, 0, 0 },
       
    43     { "useMap", JSHTMLImageElement::UseMapAttrNum, DontDelete, 0, 0 },
       
    44     { 0, 0, 0, 0, 0 },
       
    45     { "complete", JSHTMLImageElement::CompleteAttrNum, DontDelete|ReadOnly, 0, 0 },
       
    46     { "lowsrc", JSHTMLImageElement::LowsrcAttrNum, DontDelete, 0, &JSHTMLImageElementTableEntries[25] },
       
    47     { 0, 0, 0, 0, 0 },
       
    48     { "alt", JSHTMLImageElement::AltAttrNum, DontDelete, 0, &JSHTMLImageElementTableEntries[21] },
       
    49     { 0, 0, 0, 0, 0 },
       
    50     { 0, 0, 0, 0, 0 },
       
    51     { "name", JSHTMLImageElement::NameAttrNum, DontDelete, 0, &JSHTMLImageElementTableEntries[20] },
       
    52     { 0, 0, 0, 0, 0 },
       
    53     { "y", JSHTMLImageElement::YAttrNum, DontDelete|ReadOnly, 0, 0 },
       
    54     { "isMap", JSHTMLImageElement::IsMapAttrNum, DontDelete, 0, &JSHTMLImageElementTableEntries[22] },
       
    55     { "vspace", JSHTMLImageElement::VspaceAttrNum, DontDelete, 0, 0 },
       
    56     { 0, 0, 0, 0, 0 },
       
    57     { "border", JSHTMLImageElement::BorderAttrNum, DontDelete, 0, &JSHTMLImageElementTableEntries[24] },
       
    58     { "height", JSHTMLImageElement::HeightAttrNum, DontDelete, 0, 0 },
       
    59     { "longDesc", JSHTMLImageElement::LongDescAttrNum, DontDelete, 0, 0 },
       
    60     { "width", JSHTMLImageElement::WidthAttrNum, DontDelete, 0, &JSHTMLImageElementTableEntries[23] },
       
    61     { "naturalHeight", JSHTMLImageElement::NaturalHeightAttrNum, DontDelete|ReadOnly, 0, 0 },
       
    62     { "naturalWidth", JSHTMLImageElement::NaturalWidthAttrNum, DontDelete|ReadOnly, 0, 0 },
       
    63     { "x", JSHTMLImageElement::XAttrNum, DontDelete|ReadOnly, 0, 0 },
       
    64     { "constructor", JSHTMLImageElement::ConstructorAttrNum, DontDelete|DontEnum|ReadOnly, 0, 0 }
       
    65 };
       
    66 
       
    67 static const HashTable JSHTMLImageElementTable = 
       
    68 {
       
    69     2, 27, JSHTMLImageElementTableEntries, 19
       
    70 };
       
    71 
       
    72 /* Hash table for constructor */
       
    73 
       
    74 static const HashEntry JSHTMLImageElementConstructorTableEntries[] =
       
    75 {
       
    76     { 0, 0, 0, 0, 0 }
       
    77 };
       
    78 
       
    79 static const HashTable JSHTMLImageElementConstructorTable = 
       
    80 {
       
    81     2, 1, JSHTMLImageElementConstructorTableEntries, 1
       
    82 };
       
    83 
       
    84 class JSHTMLImageElementConstructor : public DOMObject {
       
    85 public:
       
    86     JSHTMLImageElementConstructor(ExecState* exec)
       
    87     {
       
    88         setPrototype(exec->lexicalInterpreter()->builtinObjectPrototype());
       
    89         putDirect(exec->propertyNames().prototype, JSHTMLImageElementPrototype::self(exec), None);
       
    90     }
       
    91     virtual bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&);
       
    92     JSValue* getValueProperty(ExecState*, int token) const;
       
    93     virtual const ClassInfo* classInfo() const { return &info; }
       
    94     static const ClassInfo info;
       
    95 
       
    96     virtual bool implementsHasInstance() const { return true; }
       
    97 };
       
    98 
       
    99 const ClassInfo JSHTMLImageElementConstructor::info = { "HTMLImageElementConstructor", 0, &JSHTMLImageElementConstructorTable, 0 };
       
   100 
       
   101 bool JSHTMLImageElementConstructor::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
       
   102 {
       
   103     return getStaticValueSlot<JSHTMLImageElementConstructor, DOMObject>(exec, &JSHTMLImageElementConstructorTable, this, propertyName, slot);
       
   104 }
       
   105 
       
   106 JSValue* JSHTMLImageElementConstructor::getValueProperty(ExecState*, int token) const
       
   107 {
       
   108     // The token is the numeric value of its associated constant
       
   109     return jsNumber(token);
       
   110 }
       
   111 
       
   112 /* Hash table for prototype */
       
   113 
       
   114 static const HashEntry JSHTMLImageElementPrototypeTableEntries[] =
       
   115 {
       
   116     { 0, 0, 0, 0, 0 }
       
   117 };
       
   118 
       
   119 static const HashTable JSHTMLImageElementPrototypeTable = 
       
   120 {
       
   121     2, 1, JSHTMLImageElementPrototypeTableEntries, 1
       
   122 };
       
   123 
       
   124 const ClassInfo JSHTMLImageElementPrototype::info = { "HTMLImageElementPrototype", 0, &JSHTMLImageElementPrototypeTable, 0 };
       
   125 
       
   126 JSObject* JSHTMLImageElementPrototype::self(ExecState* exec)
       
   127 {
       
   128     return KJS::cacheGlobalObject<JSHTMLImageElementPrototype>(exec, "[[JSHTMLImageElement.prototype]]");
       
   129 }
       
   130 
       
   131 const ClassInfo JSHTMLImageElement::info = { "HTMLImageElement", &JSHTMLElement::info, &JSHTMLImageElementTable, 0 };
       
   132 
       
   133 JSHTMLImageElement::JSHTMLImageElement(ExecState* exec, HTMLImageElement* impl)
       
   134     : JSHTMLElement(exec, impl)
       
   135 {
       
   136     setPrototype(JSHTMLImageElementPrototype::self(exec));
       
   137 }
       
   138 
       
   139 bool JSHTMLImageElement::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
       
   140 {
       
   141     return getStaticValueSlot<JSHTMLImageElement, JSHTMLElement>(exec, &JSHTMLImageElementTable, this, propertyName, slot);
       
   142 }
       
   143 
       
   144 JSValue* JSHTMLImageElement::getValueProperty(ExecState* exec, int token) const
       
   145 {
       
   146     switch (token) {
       
   147     case NameAttrNum: {
       
   148         HTMLImageElement* imp = static_cast<HTMLImageElement*>(impl());
       
   149 
       
   150         return jsString(imp->name());
       
   151     }
       
   152     case AlignAttrNum: {
       
   153         HTMLImageElement* imp = static_cast<HTMLImageElement*>(impl());
       
   154 
       
   155         return jsString(imp->align());
       
   156     }
       
   157     case AltAttrNum: {
       
   158         HTMLImageElement* imp = static_cast<HTMLImageElement*>(impl());
       
   159 
       
   160         return jsString(imp->alt());
       
   161     }
       
   162     case BorderAttrNum: {
       
   163         HTMLImageElement* imp = static_cast<HTMLImageElement*>(impl());
       
   164 
       
   165         return jsString(imp->border());
       
   166     }
       
   167     case HeightAttrNum: {
       
   168         HTMLImageElement* imp = static_cast<HTMLImageElement*>(impl());
       
   169 
       
   170         return jsNumber(imp->height());
       
   171     }
       
   172     case HspaceAttrNum: {
       
   173         HTMLImageElement* imp = static_cast<HTMLImageElement*>(impl());
       
   174 
       
   175         return jsNumber(imp->hspace());
       
   176     }
       
   177     case IsMapAttrNum: {
       
   178         HTMLImageElement* imp = static_cast<HTMLImageElement*>(impl());
       
   179 
       
   180         return jsBoolean(imp->isMap());
       
   181     }
       
   182     case LongDescAttrNum: {
       
   183         HTMLImageElement* imp = static_cast<HTMLImageElement*>(impl());
       
   184 
       
   185         return jsString(imp->longDesc());
       
   186     }
       
   187     case SrcAttrNum: {
       
   188         HTMLImageElement* imp = static_cast<HTMLImageElement*>(impl());
       
   189 
       
   190         return jsString(imp->src());
       
   191     }
       
   192     case UseMapAttrNum: {
       
   193         HTMLImageElement* imp = static_cast<HTMLImageElement*>(impl());
       
   194 
       
   195         return jsString(imp->useMap());
       
   196     }
       
   197     case VspaceAttrNum: {
       
   198         HTMLImageElement* imp = static_cast<HTMLImageElement*>(impl());
       
   199 
       
   200         return jsNumber(imp->vspace());
       
   201     }
       
   202     case WidthAttrNum: {
       
   203         HTMLImageElement* imp = static_cast<HTMLImageElement*>(impl());
       
   204 
       
   205         return jsNumber(imp->width());
       
   206     }
       
   207     case CompleteAttrNum: {
       
   208         HTMLImageElement* imp = static_cast<HTMLImageElement*>(impl());
       
   209 
       
   210         return jsBoolean(imp->complete());
       
   211     }
       
   212     case LowsrcAttrNum: {
       
   213         HTMLImageElement* imp = static_cast<HTMLImageElement*>(impl());
       
   214 
       
   215         return jsString(imp->lowsrc());
       
   216     }
       
   217     case NaturalHeightAttrNum: {
       
   218         HTMLImageElement* imp = static_cast<HTMLImageElement*>(impl());
       
   219 
       
   220         return jsNumber(imp->naturalHeight());
       
   221     }
       
   222     case NaturalWidthAttrNum: {
       
   223         HTMLImageElement* imp = static_cast<HTMLImageElement*>(impl());
       
   224 
       
   225         return jsNumber(imp->naturalWidth());
       
   226     }
       
   227     case XAttrNum: {
       
   228         HTMLImageElement* imp = static_cast<HTMLImageElement*>(impl());
       
   229 
       
   230         return jsNumber(imp->x());
       
   231     }
       
   232     case YAttrNum: {
       
   233         HTMLImageElement* imp = static_cast<HTMLImageElement*>(impl());
       
   234 
       
   235         return jsNumber(imp->y());
       
   236     }
       
   237     case ConstructorAttrNum:
       
   238         return getConstructor(exec);
       
   239     }
       
   240     return 0;
       
   241 }
       
   242 
       
   243 void JSHTMLImageElement::put(ExecState* exec, const Identifier& propertyName, JSValue* value, int attr)
       
   244 {
       
   245     lookupPut<JSHTMLImageElement, JSHTMLElement>(exec, propertyName, value, attr, &JSHTMLImageElementTable, this);
       
   246 }
       
   247 
       
   248 void JSHTMLImageElement::putValueProperty(ExecState* exec, int token, JSValue* value, int /*attr*/)
       
   249 {
       
   250     switch (token) {
       
   251     case NameAttrNum: {
       
   252         HTMLImageElement* imp = static_cast<HTMLImageElement*>(impl());
       
   253 
       
   254         imp->setName(valueToStringWithNullCheck(exec, value));
       
   255         break;
       
   256     }
       
   257     case AlignAttrNum: {
       
   258         HTMLImageElement* imp = static_cast<HTMLImageElement*>(impl());
       
   259 
       
   260         imp->setAlign(valueToStringWithNullCheck(exec, value));
       
   261         break;
       
   262     }
       
   263     case AltAttrNum: {
       
   264         HTMLImageElement* imp = static_cast<HTMLImageElement*>(impl());
       
   265 
       
   266         imp->setAlt(valueToStringWithNullCheck(exec, value));
       
   267         break;
       
   268     }
       
   269     case BorderAttrNum: {
       
   270         HTMLImageElement* imp = static_cast<HTMLImageElement*>(impl());
       
   271 
       
   272         imp->setBorder(valueToStringWithNullCheck(exec, value));
       
   273         break;
       
   274     }
       
   275     case HeightAttrNum: {
       
   276         HTMLImageElement* imp = static_cast<HTMLImageElement*>(impl());
       
   277 
       
   278         imp->setHeight(value->toInt32(exec));
       
   279         break;
       
   280     }
       
   281     case HspaceAttrNum: {
       
   282         HTMLImageElement* imp = static_cast<HTMLImageElement*>(impl());
       
   283 
       
   284         imp->setHspace(value->toInt32(exec));
       
   285         break;
       
   286     }
       
   287     case IsMapAttrNum: {
       
   288         HTMLImageElement* imp = static_cast<HTMLImageElement*>(impl());
       
   289 
       
   290         imp->setIsMap(value->toBoolean(exec));
       
   291         break;
       
   292     }
       
   293     case LongDescAttrNum: {
       
   294         HTMLImageElement* imp = static_cast<HTMLImageElement*>(impl());
       
   295 
       
   296         imp->setLongDesc(valueToStringWithNullCheck(exec, value));
       
   297         break;
       
   298     }
       
   299     case SrcAttrNum: {
       
   300         HTMLImageElement* imp = static_cast<HTMLImageElement*>(impl());
       
   301 
       
   302         imp->setSrc(valueToStringWithNullCheck(exec, value));
       
   303         break;
       
   304     }
       
   305     case UseMapAttrNum: {
       
   306         HTMLImageElement* imp = static_cast<HTMLImageElement*>(impl());
       
   307 
       
   308         imp->setUseMap(valueToStringWithNullCheck(exec, value));
       
   309         break;
       
   310     }
       
   311     case VspaceAttrNum: {
       
   312         HTMLImageElement* imp = static_cast<HTMLImageElement*>(impl());
       
   313 
       
   314         imp->setVspace(value->toInt32(exec));
       
   315         break;
       
   316     }
       
   317     case WidthAttrNum: {
       
   318         HTMLImageElement* imp = static_cast<HTMLImageElement*>(impl());
       
   319 
       
   320         imp->setWidth(value->toInt32(exec));
       
   321         break;
       
   322     }
       
   323     case LowsrcAttrNum: {
       
   324         HTMLImageElement* imp = static_cast<HTMLImageElement*>(impl());
       
   325 
       
   326         imp->setLowsrc(valueToStringWithNullCheck(exec, value));
       
   327         break;
       
   328     }
       
   329     }
       
   330 }
       
   331 
       
   332 JSValue* JSHTMLImageElement::getConstructor(ExecState* exec)
       
   333 {
       
   334     return KJS::cacheGlobalObject<JSHTMLImageElementConstructor>(exec, "[[HTMLImageElement.constructor]]");
       
   335 }
       
   336 
       
   337 }