webengine/osswebengine/DerivedSources/WebCore/JSMutationEvent.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 "JSMutationEvent.h"
       
    24 
       
    25 #include <wtf/GetPtr.h>
       
    26 
       
    27 #include "JSNode.h"
       
    28 #include "MutationEvent.h"
       
    29 #include "Node.h"
       
    30 #include "PlatformString.h"
       
    31 
       
    32 using namespace KJS;
       
    33 
       
    34 namespace WebCore {
       
    35 
       
    36 /* Hash table */
       
    37 
       
    38 static const HashEntry JSMutationEventTableEntries[] =
       
    39 {
       
    40     { 0, 0, 0, 0, 0 },
       
    41     { 0, 0, 0, 0, 0 },
       
    42     { "prevValue", JSMutationEvent::PrevValueAttrNum, DontDelete|ReadOnly, 0, &JSMutationEventTableEntries[6] },
       
    43     { "constructor", JSMutationEvent::ConstructorAttrNum, DontDelete|DontEnum|ReadOnly, 0, 0 },
       
    44     { "attrName", JSMutationEvent::AttrNameAttrNum, DontDelete|ReadOnly, 0, &JSMutationEventTableEntries[7] },
       
    45     { "relatedNode", JSMutationEvent::RelatedNodeAttrNum, DontDelete|ReadOnly, 0, 0 },
       
    46     { "newValue", JSMutationEvent::NewValueAttrNum, DontDelete|ReadOnly, 0, 0 },
       
    47     { "attrChange", JSMutationEvent::AttrChangeAttrNum, DontDelete|ReadOnly, 0, 0 }
       
    48 };
       
    49 
       
    50 static const HashTable JSMutationEventTable = 
       
    51 {
       
    52     2, 8, JSMutationEventTableEntries, 6
       
    53 };
       
    54 
       
    55 /* Hash table for constructor */
       
    56 
       
    57 static const HashEntry JSMutationEventConstructorTableEntries[] =
       
    58 {
       
    59     { "MODIFICATION", MutationEvent::MODIFICATION, DontDelete|ReadOnly, 0, &JSMutationEventConstructorTableEntries[3] },
       
    60     { "ADDITION", MutationEvent::ADDITION, DontDelete|ReadOnly, 0, 0 },
       
    61     { 0, 0, 0, 0, 0 },
       
    62     { "REMOVAL", MutationEvent::REMOVAL, DontDelete|ReadOnly, 0, 0 }
       
    63 };
       
    64 
       
    65 static const HashTable JSMutationEventConstructorTable = 
       
    66 {
       
    67     2, 4, JSMutationEventConstructorTableEntries, 3
       
    68 };
       
    69 
       
    70 class JSMutationEventConstructor : public DOMObject {
       
    71 public:
       
    72     JSMutationEventConstructor(ExecState* exec)
       
    73     {
       
    74         setPrototype(exec->lexicalInterpreter()->builtinObjectPrototype());
       
    75         putDirect(exec->propertyNames().prototype, JSMutationEventPrototype::self(exec), None);
       
    76     }
       
    77     virtual bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&);
       
    78     JSValue* getValueProperty(ExecState*, int token) const;
       
    79     virtual const ClassInfo* classInfo() const { return &info; }
       
    80     static const ClassInfo info;
       
    81 
       
    82     virtual bool implementsHasInstance() const { return true; }
       
    83 };
       
    84 
       
    85 const ClassInfo JSMutationEventConstructor::info = { "MutationEventConstructor", 0, &JSMutationEventConstructorTable, 0 };
       
    86 
       
    87 bool JSMutationEventConstructor::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
       
    88 {
       
    89     return getStaticValueSlot<JSMutationEventConstructor, DOMObject>(exec, &JSMutationEventConstructorTable, this, propertyName, slot);
       
    90 }
       
    91 
       
    92 JSValue* JSMutationEventConstructor::getValueProperty(ExecState*, int token) const
       
    93 {
       
    94     // The token is the numeric value of its associated constant
       
    95     return jsNumber(token);
       
    96 }
       
    97 
       
    98 /* Hash table for prototype */
       
    99 
       
   100 static const HashEntry JSMutationEventPrototypeTableEntries[] =
       
   101 {
       
   102     { 0, 0, 0, 0, 0 },
       
   103     { 0, 0, 0, 0, 0 },
       
   104     { "MODIFICATION", MutationEvent::MODIFICATION, DontDelete|ReadOnly, 0, &JSMutationEventPrototypeTableEntries[4] },
       
   105     { "ADDITION", MutationEvent::ADDITION, DontDelete|ReadOnly, 0, &JSMutationEventPrototypeTableEntries[5] },
       
   106     { "REMOVAL", MutationEvent::REMOVAL, DontDelete|ReadOnly, 0, 0 },
       
   107     { "initMutationEvent", JSMutationEvent::InitMutationEventFuncNum, DontDelete|Function, 8, 0 }
       
   108 };
       
   109 
       
   110 static const HashTable JSMutationEventPrototypeTable = 
       
   111 {
       
   112     2, 6, JSMutationEventPrototypeTableEntries, 4
       
   113 };
       
   114 
       
   115 const ClassInfo JSMutationEventPrototype::info = { "MutationEventPrototype", 0, &JSMutationEventPrototypeTable, 0 };
       
   116 
       
   117 JSObject* JSMutationEventPrototype::self(ExecState* exec)
       
   118 {
       
   119     return KJS::cacheGlobalObject<JSMutationEventPrototype>(exec, "[[JSMutationEvent.prototype]]");
       
   120 }
       
   121 
       
   122 bool JSMutationEventPrototype::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
       
   123 {
       
   124     return getStaticPropertySlot<JSMutationEventPrototypeFunction, JSMutationEventPrototype, JSObject>(exec, &JSMutationEventPrototypeTable, this, propertyName, slot);
       
   125 }
       
   126 
       
   127 JSValue* JSMutationEventPrototype::getValueProperty(ExecState*, int token) const
       
   128 {
       
   129     // The token is the numeric value of its associated constant
       
   130     return jsNumber(token);
       
   131 }
       
   132 
       
   133 const ClassInfo JSMutationEvent::info = { "MutationEvent", &JSEvent::info, &JSMutationEventTable, 0 };
       
   134 
       
   135 JSMutationEvent::JSMutationEvent(ExecState* exec, MutationEvent* impl)
       
   136     : JSEvent(exec, impl)
       
   137 {
       
   138     setPrototype(JSMutationEventPrototype::self(exec));
       
   139 }
       
   140 
       
   141 bool JSMutationEvent::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
       
   142 {
       
   143     return getStaticValueSlot<JSMutationEvent, JSEvent>(exec, &JSMutationEventTable, this, propertyName, slot);
       
   144 }
       
   145 
       
   146 JSValue* JSMutationEvent::getValueProperty(ExecState* exec, int token) const
       
   147 {
       
   148     switch (token) {
       
   149     case RelatedNodeAttrNum: {
       
   150         MutationEvent* imp = static_cast<MutationEvent*>(impl());
       
   151 
       
   152         return toJS(exec, WTF::getPtr(imp->relatedNode()));
       
   153     }
       
   154     case PrevValueAttrNum: {
       
   155         MutationEvent* imp = static_cast<MutationEvent*>(impl());
       
   156 
       
   157         return jsString(imp->prevValue());
       
   158     }
       
   159     case NewValueAttrNum: {
       
   160         MutationEvent* imp = static_cast<MutationEvent*>(impl());
       
   161 
       
   162         return jsString(imp->newValue());
       
   163     }
       
   164     case AttrNameAttrNum: {
       
   165         MutationEvent* imp = static_cast<MutationEvent*>(impl());
       
   166 
       
   167         return jsString(imp->attrName());
       
   168     }
       
   169     case AttrChangeAttrNum: {
       
   170         MutationEvent* imp = static_cast<MutationEvent*>(impl());
       
   171 
       
   172         return jsNumber(imp->attrChange());
       
   173     }
       
   174     case ConstructorAttrNum:
       
   175         return getConstructor(exec);
       
   176     }
       
   177     return 0;
       
   178 }
       
   179 
       
   180 JSValue* JSMutationEvent::getConstructor(ExecState* exec)
       
   181 {
       
   182     return KJS::cacheGlobalObject<JSMutationEventConstructor>(exec, "[[MutationEvent.constructor]]");
       
   183 }
       
   184 JSValue* JSMutationEventPrototypeFunction::callAsFunction(ExecState* exec, JSObject* thisObj, const List& args)
       
   185 {
       
   186     if (!thisObj->inherits(&JSMutationEvent::info))
       
   187       return throwError(exec, TypeError);
       
   188 
       
   189     MutationEvent* imp = static_cast<MutationEvent*>(static_cast<JSMutationEvent*>(thisObj)->impl());
       
   190 
       
   191     switch (id) {
       
   192     case JSMutationEvent::InitMutationEventFuncNum: {
       
   193         AtomicString type = args[0]->toString(exec);
       
   194         bool canBubble = args[1]->toBoolean(exec);
       
   195         bool cancelable = args[2]->toBoolean(exec);
       
   196         Node* relatedNode = toNode(args[3]);
       
   197         String prevValue = args[4]->toString(exec);
       
   198         String newValue = args[5]->toString(exec);
       
   199         String attrName = args[6]->toString(exec);
       
   200         unsigned short attrChange = args[7]->toInt32(exec);
       
   201 
       
   202         imp->initMutationEvent(type, canBubble, cancelable, relatedNode, prevValue, newValue, attrName, attrChange);
       
   203         return jsUndefined();
       
   204     }
       
   205     }
       
   206     return 0;
       
   207 }
       
   208 
       
   209 }