webengine/osswebengine/DerivedSources/WebCore/JSHTMLAnchorElement.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 "JSHTMLAnchorElement.h"
       
    24 
       
    25 #include <wtf/GetPtr.h>
       
    26 
       
    27 #include "HTMLAnchorElement.h"
       
    28 #include "PlatformString.h"
       
    29 
       
    30 using namespace KJS;
       
    31 
       
    32 namespace WebCore {
       
    33 
       
    34 /* Hash table */
       
    35 
       
    36 static const HashEntry JSHTMLAnchorElementTableEntries[] =
       
    37 {
       
    38     { 0, 0, 0, 0, 0 },
       
    39     { "protocol", JSHTMLAnchorElement::ProtocolAttrNum, DontDelete|ReadOnly, 0, 0 },
       
    40     { "hash", JSHTMLAnchorElement::HashAttrNum, DontDelete|ReadOnly, 0, 0 },
       
    41     { 0, 0, 0, 0, 0 },
       
    42     { "charset", JSHTMLAnchorElement::CharsetAttrNum, DontDelete, 0, &JSHTMLAnchorElementTableEntries[22] },
       
    43     { "hreflang", JSHTMLAnchorElement::HreflangAttrNum, DontDelete, 0, 0 },
       
    44     { "host", JSHTMLAnchorElement::HostAttrNum, DontDelete|ReadOnly, 0, 0 },
       
    45     { 0, 0, 0, 0, 0 },
       
    46     { "accessKey", JSHTMLAnchorElement::AccessKeyAttrNum, DontDelete, 0, 0 },
       
    47     { "constructor", JSHTMLAnchorElement::ConstructorAttrNum, DontDelete|DontEnum|ReadOnly, 0, 0 },
       
    48     { "rev", JSHTMLAnchorElement::RevAttrNum, DontDelete, 0, &JSHTMLAnchorElementTableEntries[24] },
       
    49     { "coords", JSHTMLAnchorElement::CoordsAttrNum, DontDelete, 0, 0 },
       
    50     { "port", JSHTMLAnchorElement::PortAttrNum, DontDelete|ReadOnly, 0, 0 },
       
    51     { "href", JSHTMLAnchorElement::HrefAttrNum, DontDelete, 0, &JSHTMLAnchorElementTableEntries[21] },
       
    52     { "search", JSHTMLAnchorElement::SearchAttrNum, DontDelete|ReadOnly, 0, 0 },
       
    53     { "tabIndex", JSHTMLAnchorElement::TabIndexAttrNum, DontDelete, 0, 0 },
       
    54     { "name", JSHTMLAnchorElement::NameAttrNum, DontDelete, 0, 0 },
       
    55     { "shape", JSHTMLAnchorElement::ShapeAttrNum, DontDelete, 0, 0 },
       
    56     { "hostname", JSHTMLAnchorElement::HostnameAttrNum, DontDelete|ReadOnly, 0, 0 },
       
    57     { "target", JSHTMLAnchorElement::TargetAttrNum, DontDelete, 0, 0 },
       
    58     { 0, 0, 0, 0, 0 },
       
    59     { "rel", JSHTMLAnchorElement::RelAttrNum, DontDelete, 0, &JSHTMLAnchorElementTableEntries[23] },
       
    60     { "type", JSHTMLAnchorElement::TypeAttrNum, DontDelete, 0, 0 },
       
    61     { "pathname", JSHTMLAnchorElement::PathnameAttrNum, DontDelete|ReadOnly, 0, 0 },
       
    62     { "text", JSHTMLAnchorElement::TextAttrNum, DontDelete|ReadOnly, 0, 0 }
       
    63 };
       
    64 
       
    65 static const HashTable JSHTMLAnchorElementTable = 
       
    66 {
       
    67     2, 25, JSHTMLAnchorElementTableEntries, 21
       
    68 };
       
    69 
       
    70 /* Hash table for constructor */
       
    71 
       
    72 static const HashEntry JSHTMLAnchorElementConstructorTableEntries[] =
       
    73 {
       
    74     { 0, 0, 0, 0, 0 }
       
    75 };
       
    76 
       
    77 static const HashTable JSHTMLAnchorElementConstructorTable = 
       
    78 {
       
    79     2, 1, JSHTMLAnchorElementConstructorTableEntries, 1
       
    80 };
       
    81 
       
    82 class JSHTMLAnchorElementConstructor : public DOMObject {
       
    83 public:
       
    84     JSHTMLAnchorElementConstructor(ExecState* exec)
       
    85     {
       
    86         setPrototype(exec->lexicalInterpreter()->builtinObjectPrototype());
       
    87         putDirect(exec->propertyNames().prototype, JSHTMLAnchorElementPrototype::self(exec), None);
       
    88     }
       
    89     virtual bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&);
       
    90     JSValue* getValueProperty(ExecState*, int token) const;
       
    91     virtual const ClassInfo* classInfo() const { return &info; }
       
    92     static const ClassInfo info;
       
    93 
       
    94     virtual bool implementsHasInstance() const { return true; }
       
    95 };
       
    96 
       
    97 const ClassInfo JSHTMLAnchorElementConstructor::info = { "HTMLAnchorElementConstructor", 0, &JSHTMLAnchorElementConstructorTable, 0 };
       
    98 
       
    99 bool JSHTMLAnchorElementConstructor::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
       
   100 {
       
   101     return getStaticValueSlot<JSHTMLAnchorElementConstructor, DOMObject>(exec, &JSHTMLAnchorElementConstructorTable, this, propertyName, slot);
       
   102 }
       
   103 
       
   104 JSValue* JSHTMLAnchorElementConstructor::getValueProperty(ExecState*, int token) const
       
   105 {
       
   106     // The token is the numeric value of its associated constant
       
   107     return jsNumber(token);
       
   108 }
       
   109 
       
   110 /* Hash table for prototype */
       
   111 
       
   112 static const HashEntry JSHTMLAnchorElementPrototypeTableEntries[] =
       
   113 {
       
   114     { "blur", JSHTMLAnchorElement::BlurFuncNum, DontDelete|Function, 0, &JSHTMLAnchorElementPrototypeTableEntries[3] },
       
   115     { "focus", JSHTMLAnchorElement::FocusFuncNum, DontDelete|Function, 0, 0 },
       
   116     { 0, 0, 0, 0, 0 },
       
   117     { "toString", JSHTMLAnchorElement::ToStringFuncNum, DontDelete|DontEnum|Function, 0, 0 }
       
   118 };
       
   119 
       
   120 static const HashTable JSHTMLAnchorElementPrototypeTable = 
       
   121 {
       
   122     2, 4, JSHTMLAnchorElementPrototypeTableEntries, 3
       
   123 };
       
   124 
       
   125 const ClassInfo JSHTMLAnchorElementPrototype::info = { "HTMLAnchorElementPrototype", 0, &JSHTMLAnchorElementPrototypeTable, 0 };
       
   126 
       
   127 JSObject* JSHTMLAnchorElementPrototype::self(ExecState* exec)
       
   128 {
       
   129     return KJS::cacheGlobalObject<JSHTMLAnchorElementPrototype>(exec, "[[JSHTMLAnchorElement.prototype]]");
       
   130 }
       
   131 
       
   132 bool JSHTMLAnchorElementPrototype::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
       
   133 {
       
   134     return getStaticFunctionSlot<JSHTMLAnchorElementPrototypeFunction, JSObject>(exec, &JSHTMLAnchorElementPrototypeTable, this, propertyName, slot);
       
   135 }
       
   136 
       
   137 const ClassInfo JSHTMLAnchorElement::info = { "HTMLAnchorElement", &JSHTMLElement::info, &JSHTMLAnchorElementTable, 0 };
       
   138 
       
   139 JSHTMLAnchorElement::JSHTMLAnchorElement(ExecState* exec, HTMLAnchorElement* impl)
       
   140     : JSHTMLElement(exec, impl)
       
   141 {
       
   142     setPrototype(JSHTMLAnchorElementPrototype::self(exec));
       
   143 }
       
   144 
       
   145 bool JSHTMLAnchorElement::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
       
   146 {
       
   147     return getStaticValueSlot<JSHTMLAnchorElement, JSHTMLElement>(exec, &JSHTMLAnchorElementTable, this, propertyName, slot);
       
   148 }
       
   149 
       
   150 JSValue* JSHTMLAnchorElement::getValueProperty(ExecState* exec, int token) const
       
   151 {
       
   152     switch (token) {
       
   153     case AccessKeyAttrNum: {
       
   154         HTMLAnchorElement* imp = static_cast<HTMLAnchorElement*>(impl());
       
   155 
       
   156         return jsString(imp->accessKey());
       
   157     }
       
   158     case CharsetAttrNum: {
       
   159         HTMLAnchorElement* imp = static_cast<HTMLAnchorElement*>(impl());
       
   160 
       
   161         return jsString(imp->charset());
       
   162     }
       
   163     case CoordsAttrNum: {
       
   164         HTMLAnchorElement* imp = static_cast<HTMLAnchorElement*>(impl());
       
   165 
       
   166         return jsString(imp->coords());
       
   167     }
       
   168     case HrefAttrNum: {
       
   169         HTMLAnchorElement* imp = static_cast<HTMLAnchorElement*>(impl());
       
   170 
       
   171         return jsString(imp->href());
       
   172     }
       
   173     case HreflangAttrNum: {
       
   174         HTMLAnchorElement* imp = static_cast<HTMLAnchorElement*>(impl());
       
   175 
       
   176         return jsString(imp->hreflang());
       
   177     }
       
   178     case NameAttrNum: {
       
   179         HTMLAnchorElement* imp = static_cast<HTMLAnchorElement*>(impl());
       
   180 
       
   181         return jsString(imp->name());
       
   182     }
       
   183     case RelAttrNum: {
       
   184         HTMLAnchorElement* imp = static_cast<HTMLAnchorElement*>(impl());
       
   185 
       
   186         return jsString(imp->rel());
       
   187     }
       
   188     case RevAttrNum: {
       
   189         HTMLAnchorElement* imp = static_cast<HTMLAnchorElement*>(impl());
       
   190 
       
   191         return jsString(imp->rev());
       
   192     }
       
   193     case ShapeAttrNum: {
       
   194         HTMLAnchorElement* imp = static_cast<HTMLAnchorElement*>(impl());
       
   195 
       
   196         return jsString(imp->shape());
       
   197     }
       
   198     case TabIndexAttrNum: {
       
   199         HTMLAnchorElement* imp = static_cast<HTMLAnchorElement*>(impl());
       
   200 
       
   201         return jsNumber(imp->tabIndex());
       
   202     }
       
   203     case TargetAttrNum: {
       
   204         HTMLAnchorElement* imp = static_cast<HTMLAnchorElement*>(impl());
       
   205 
       
   206         return jsString(imp->target());
       
   207     }
       
   208     case TypeAttrNum: {
       
   209         HTMLAnchorElement* imp = static_cast<HTMLAnchorElement*>(impl());
       
   210 
       
   211         return jsString(imp->type());
       
   212     }
       
   213     case HashAttrNum: {
       
   214         HTMLAnchorElement* imp = static_cast<HTMLAnchorElement*>(impl());
       
   215 
       
   216         return jsString(imp->hash());
       
   217     }
       
   218     case HostAttrNum: {
       
   219         HTMLAnchorElement* imp = static_cast<HTMLAnchorElement*>(impl());
       
   220 
       
   221         return jsString(imp->host());
       
   222     }
       
   223     case HostnameAttrNum: {
       
   224         HTMLAnchorElement* imp = static_cast<HTMLAnchorElement*>(impl());
       
   225 
       
   226         return jsString(imp->hostname());
       
   227     }
       
   228     case PathnameAttrNum: {
       
   229         HTMLAnchorElement* imp = static_cast<HTMLAnchorElement*>(impl());
       
   230 
       
   231         return jsString(imp->pathname());
       
   232     }
       
   233     case PortAttrNum: {
       
   234         HTMLAnchorElement* imp = static_cast<HTMLAnchorElement*>(impl());
       
   235 
       
   236         return jsString(imp->port());
       
   237     }
       
   238     case ProtocolAttrNum: {
       
   239         HTMLAnchorElement* imp = static_cast<HTMLAnchorElement*>(impl());
       
   240 
       
   241         return jsString(imp->protocol());
       
   242     }
       
   243     case SearchAttrNum: {
       
   244         HTMLAnchorElement* imp = static_cast<HTMLAnchorElement*>(impl());
       
   245 
       
   246         return jsString(imp->search());
       
   247     }
       
   248     case TextAttrNum: {
       
   249         HTMLAnchorElement* imp = static_cast<HTMLAnchorElement*>(impl());
       
   250 
       
   251         return jsString(imp->text());
       
   252     }
       
   253     case ConstructorAttrNum:
       
   254         return getConstructor(exec);
       
   255     }
       
   256     return 0;
       
   257 }
       
   258 
       
   259 void JSHTMLAnchorElement::put(ExecState* exec, const Identifier& propertyName, JSValue* value, int attr)
       
   260 {
       
   261     lookupPut<JSHTMLAnchorElement, JSHTMLElement>(exec, propertyName, value, attr, &JSHTMLAnchorElementTable, this);
       
   262 }
       
   263 
       
   264 void JSHTMLAnchorElement::putValueProperty(ExecState* exec, int token, JSValue* value, int /*attr*/)
       
   265 {
       
   266     switch (token) {
       
   267     case AccessKeyAttrNum: {
       
   268         HTMLAnchorElement* imp = static_cast<HTMLAnchorElement*>(impl());
       
   269 
       
   270         imp->setAccessKey(valueToStringWithNullCheck(exec, value));
       
   271         break;
       
   272     }
       
   273     case CharsetAttrNum: {
       
   274         HTMLAnchorElement* imp = static_cast<HTMLAnchorElement*>(impl());
       
   275 
       
   276         imp->setCharset(valueToStringWithNullCheck(exec, value));
       
   277         break;
       
   278     }
       
   279     case CoordsAttrNum: {
       
   280         HTMLAnchorElement* imp = static_cast<HTMLAnchorElement*>(impl());
       
   281 
       
   282         imp->setCoords(valueToStringWithNullCheck(exec, value));
       
   283         break;
       
   284     }
       
   285     case HrefAttrNum: {
       
   286         HTMLAnchorElement* imp = static_cast<HTMLAnchorElement*>(impl());
       
   287 
       
   288         imp->setHref(valueToStringWithNullCheck(exec, value));
       
   289         break;
       
   290     }
       
   291     case HreflangAttrNum: {
       
   292         HTMLAnchorElement* imp = static_cast<HTMLAnchorElement*>(impl());
       
   293 
       
   294         imp->setHreflang(valueToStringWithNullCheck(exec, value));
       
   295         break;
       
   296     }
       
   297     case NameAttrNum: {
       
   298         HTMLAnchorElement* imp = static_cast<HTMLAnchorElement*>(impl());
       
   299 
       
   300         imp->setName(valueToStringWithNullCheck(exec, value));
       
   301         break;
       
   302     }
       
   303     case RelAttrNum: {
       
   304         HTMLAnchorElement* imp = static_cast<HTMLAnchorElement*>(impl());
       
   305 
       
   306         imp->setRel(valueToStringWithNullCheck(exec, value));
       
   307         break;
       
   308     }
       
   309     case RevAttrNum: {
       
   310         HTMLAnchorElement* imp = static_cast<HTMLAnchorElement*>(impl());
       
   311 
       
   312         imp->setRev(valueToStringWithNullCheck(exec, value));
       
   313         break;
       
   314     }
       
   315     case ShapeAttrNum: {
       
   316         HTMLAnchorElement* imp = static_cast<HTMLAnchorElement*>(impl());
       
   317 
       
   318         imp->setShape(valueToStringWithNullCheck(exec, value));
       
   319         break;
       
   320     }
       
   321     case TabIndexAttrNum: {
       
   322         HTMLAnchorElement* imp = static_cast<HTMLAnchorElement*>(impl());
       
   323 
       
   324         imp->setTabIndex(value->toInt32(exec));
       
   325         break;
       
   326     }
       
   327     case TargetAttrNum: {
       
   328         HTMLAnchorElement* imp = static_cast<HTMLAnchorElement*>(impl());
       
   329 
       
   330         imp->setTarget(valueToStringWithNullCheck(exec, value));
       
   331         break;
       
   332     }
       
   333     case TypeAttrNum: {
       
   334         HTMLAnchorElement* imp = static_cast<HTMLAnchorElement*>(impl());
       
   335 
       
   336         imp->setType(valueToStringWithNullCheck(exec, value));
       
   337         break;
       
   338     }
       
   339     }
       
   340 }
       
   341 
       
   342 JSValue* JSHTMLAnchorElement::getConstructor(ExecState* exec)
       
   343 {
       
   344     return KJS::cacheGlobalObject<JSHTMLAnchorElementConstructor>(exec, "[[HTMLAnchorElement.constructor]]");
       
   345 }
       
   346 JSValue* JSHTMLAnchorElementPrototypeFunction::callAsFunction(ExecState* exec, JSObject* thisObj, const List& args)
       
   347 {
       
   348     if (!thisObj->inherits(&JSHTMLAnchorElement::info))
       
   349       return throwError(exec, TypeError);
       
   350 
       
   351     HTMLAnchorElement* imp = static_cast<HTMLAnchorElement*>(static_cast<JSHTMLAnchorElement*>(thisObj)->impl());
       
   352 
       
   353     switch (id) {
       
   354     case JSHTMLAnchorElement::BlurFuncNum: {
       
   355 
       
   356         imp->blur();
       
   357         return jsUndefined();
       
   358     }
       
   359     case JSHTMLAnchorElement::FocusFuncNum: {
       
   360 
       
   361         imp->focus();
       
   362         return jsUndefined();
       
   363     }
       
   364     case JSHTMLAnchorElement::ToStringFuncNum: {
       
   365 
       
   366 
       
   367         KJS::JSValue* result = jsString(imp->toString());
       
   368         return result;
       
   369     }
       
   370     }
       
   371     return 0;
       
   372 }
       
   373 
       
   374 }