WebCore/generated/JSEvent.cpp
changeset 0 4f2f89ce4247
equal deleted inserted replaced
-1:000000000000 0:4f2f89ce4247
       
     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 #include "JSEvent.h"
       
    23 
       
    24 #include "Event.h"
       
    25 #include "EventTarget.h"
       
    26 #include "JSEventTarget.h"
       
    27 #include "KURL.h"
       
    28 #include <runtime/Error.h>
       
    29 #include <runtime/JSNumberCell.h>
       
    30 #include <runtime/JSString.h>
       
    31 #include <wtf/GetPtr.h>
       
    32 
       
    33 using namespace JSC;
       
    34 
       
    35 namespace WebCore {
       
    36 
       
    37 ASSERT_CLASS_FITS_IN_CELL(JSEvent);
       
    38 
       
    39 /* Hash table */
       
    40 #if ENABLE(JIT)
       
    41 #define THUNK_GENERATOR(generator) , generator
       
    42 #else
       
    43 #define THUNK_GENERATOR(generator)
       
    44 #endif
       
    45 
       
    46 static const HashTableValue JSEventTableValues[14] =
       
    47 {
       
    48     { "type", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsEventType), (intptr_t)0 THUNK_GENERATOR(0) },
       
    49     { "target", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsEventTarget), (intptr_t)0 THUNK_GENERATOR(0) },
       
    50     { "currentTarget", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsEventCurrentTarget), (intptr_t)0 THUNK_GENERATOR(0) },
       
    51     { "eventPhase", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsEventEventPhase), (intptr_t)0 THUNK_GENERATOR(0) },
       
    52     { "bubbles", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsEventBubbles), (intptr_t)0 THUNK_GENERATOR(0) },
       
    53     { "cancelable", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsEventCancelable), (intptr_t)0 THUNK_GENERATOR(0) },
       
    54     { "timeStamp", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsEventTimeStamp), (intptr_t)0 THUNK_GENERATOR(0) },
       
    55     { "defaultPrevented", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsEventDefaultPrevented), (intptr_t)0 THUNK_GENERATOR(0) },
       
    56     { "srcElement", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsEventSrcElement), (intptr_t)0 THUNK_GENERATOR(0) },
       
    57     { "returnValue", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsEventReturnValue), (intptr_t)setJSEventReturnValue THUNK_GENERATOR(0) },
       
    58     { "cancelBubble", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsEventCancelBubble), (intptr_t)setJSEventCancelBubble THUNK_GENERATOR(0) },
       
    59     { "clipboardData", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsEventClipboardData), (intptr_t)0 THUNK_GENERATOR(0) },
       
    60     { "constructor", DontEnum | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsEventConstructor), (intptr_t)0 THUNK_GENERATOR(0) },
       
    61     { 0, 0, 0, 0 THUNK_GENERATOR(0) }
       
    62 };
       
    63 
       
    64 #undef THUNK_GENERATOR
       
    65 static JSC_CONST_HASHTABLE HashTable JSEventTable = { 35, 31, JSEventTableValues, 0 };
       
    66 /* Hash table for constructor */
       
    67 #if ENABLE(JIT)
       
    68 #define THUNK_GENERATOR(generator) , generator
       
    69 #else
       
    70 #define THUNK_GENERATOR(generator)
       
    71 #endif
       
    72 
       
    73 static const HashTableValue JSEventConstructorTableValues[20] =
       
    74 {
       
    75     { "CAPTURING_PHASE", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsEventCAPTURING_PHASE), (intptr_t)0 THUNK_GENERATOR(0) },
       
    76     { "AT_TARGET", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsEventAT_TARGET), (intptr_t)0 THUNK_GENERATOR(0) },
       
    77     { "BUBBLING_PHASE", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsEventBUBBLING_PHASE), (intptr_t)0 THUNK_GENERATOR(0) },
       
    78     { "MOUSEDOWN", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsEventMOUSEDOWN), (intptr_t)0 THUNK_GENERATOR(0) },
       
    79     { "MOUSEUP", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsEventMOUSEUP), (intptr_t)0 THUNK_GENERATOR(0) },
       
    80     { "MOUSEOVER", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsEventMOUSEOVER), (intptr_t)0 THUNK_GENERATOR(0) },
       
    81     { "MOUSEOUT", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsEventMOUSEOUT), (intptr_t)0 THUNK_GENERATOR(0) },
       
    82     { "MOUSEMOVE", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsEventMOUSEMOVE), (intptr_t)0 THUNK_GENERATOR(0) },
       
    83     { "MOUSEDRAG", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsEventMOUSEDRAG), (intptr_t)0 THUNK_GENERATOR(0) },
       
    84     { "CLICK", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsEventCLICK), (intptr_t)0 THUNK_GENERATOR(0) },
       
    85     { "DBLCLICK", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsEventDBLCLICK), (intptr_t)0 THUNK_GENERATOR(0) },
       
    86     { "KEYDOWN", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsEventKEYDOWN), (intptr_t)0 THUNK_GENERATOR(0) },
       
    87     { "KEYUP", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsEventKEYUP), (intptr_t)0 THUNK_GENERATOR(0) },
       
    88     { "KEYPRESS", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsEventKEYPRESS), (intptr_t)0 THUNK_GENERATOR(0) },
       
    89     { "DRAGDROP", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsEventDRAGDROP), (intptr_t)0 THUNK_GENERATOR(0) },
       
    90     { "FOCUS", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsEventFOCUS), (intptr_t)0 THUNK_GENERATOR(0) },
       
    91     { "BLUR", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsEventBLUR), (intptr_t)0 THUNK_GENERATOR(0) },
       
    92     { "SELECT", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsEventSELECT), (intptr_t)0 THUNK_GENERATOR(0) },
       
    93     { "CHANGE", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsEventCHANGE), (intptr_t)0 THUNK_GENERATOR(0) },
       
    94     { 0, 0, 0, 0 THUNK_GENERATOR(0) }
       
    95 };
       
    96 
       
    97 #undef THUNK_GENERATOR
       
    98 static JSC_CONST_HASHTABLE HashTable JSEventConstructorTable = { 68, 63, JSEventConstructorTableValues, 0 };
       
    99 
       
   100 COMPILE_ASSERT(1 == Event::CAPTURING_PHASE, EventEnumCAPTURING_PHASEIsWrongUseDontCheckEnums);
       
   101 COMPILE_ASSERT(2 == Event::AT_TARGET, EventEnumAT_TARGETIsWrongUseDontCheckEnums);
       
   102 COMPILE_ASSERT(3 == Event::BUBBLING_PHASE, EventEnumBUBBLING_PHASEIsWrongUseDontCheckEnums);
       
   103 COMPILE_ASSERT(1 == Event::MOUSEDOWN, EventEnumMOUSEDOWNIsWrongUseDontCheckEnums);
       
   104 COMPILE_ASSERT(2 == Event::MOUSEUP, EventEnumMOUSEUPIsWrongUseDontCheckEnums);
       
   105 COMPILE_ASSERT(4 == Event::MOUSEOVER, EventEnumMOUSEOVERIsWrongUseDontCheckEnums);
       
   106 COMPILE_ASSERT(8 == Event::MOUSEOUT, EventEnumMOUSEOUTIsWrongUseDontCheckEnums);
       
   107 COMPILE_ASSERT(16 == Event::MOUSEMOVE, EventEnumMOUSEMOVEIsWrongUseDontCheckEnums);
       
   108 COMPILE_ASSERT(32 == Event::MOUSEDRAG, EventEnumMOUSEDRAGIsWrongUseDontCheckEnums);
       
   109 COMPILE_ASSERT(64 == Event::CLICK, EventEnumCLICKIsWrongUseDontCheckEnums);
       
   110 COMPILE_ASSERT(128 == Event::DBLCLICK, EventEnumDBLCLICKIsWrongUseDontCheckEnums);
       
   111 COMPILE_ASSERT(256 == Event::KEYDOWN, EventEnumKEYDOWNIsWrongUseDontCheckEnums);
       
   112 COMPILE_ASSERT(512 == Event::KEYUP, EventEnumKEYUPIsWrongUseDontCheckEnums);
       
   113 COMPILE_ASSERT(1024 == Event::KEYPRESS, EventEnumKEYPRESSIsWrongUseDontCheckEnums);
       
   114 COMPILE_ASSERT(2048 == Event::DRAGDROP, EventEnumDRAGDROPIsWrongUseDontCheckEnums);
       
   115 COMPILE_ASSERT(4096 == Event::FOCUS, EventEnumFOCUSIsWrongUseDontCheckEnums);
       
   116 COMPILE_ASSERT(8192 == Event::BLUR, EventEnumBLURIsWrongUseDontCheckEnums);
       
   117 COMPILE_ASSERT(16384 == Event::SELECT, EventEnumSELECTIsWrongUseDontCheckEnums);
       
   118 COMPILE_ASSERT(32768 == Event::CHANGE, EventEnumCHANGEIsWrongUseDontCheckEnums);
       
   119 
       
   120 class JSEventConstructor : public DOMConstructorObject {
       
   121 public:
       
   122     JSEventConstructor(JSC::ExecState*, JSDOMGlobalObject*);
       
   123 
       
   124     virtual bool getOwnPropertySlot(JSC::ExecState*, const JSC::Identifier&, JSC::PropertySlot&);
       
   125     virtual bool getOwnPropertyDescriptor(JSC::ExecState*, const JSC::Identifier&, JSC::PropertyDescriptor&);
       
   126     virtual const JSC::ClassInfo* classInfo() const { return &s_info; }
       
   127     static const JSC::ClassInfo s_info;
       
   128     static PassRefPtr<JSC::Structure> createStructure(JSC::JSValue prototype)
       
   129     {
       
   130         return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), AnonymousSlotCount);
       
   131     }
       
   132 protected:
       
   133     static const unsigned StructureFlags = JSC::OverridesGetOwnPropertySlot | JSC::ImplementsHasInstance | DOMConstructorObject::StructureFlags;
       
   134 };
       
   135 
       
   136 const ClassInfo JSEventConstructor::s_info = { "EventConstructor", 0, &JSEventConstructorTable, 0 };
       
   137 
       
   138 JSEventConstructor::JSEventConstructor(ExecState* exec, JSDOMGlobalObject* globalObject)
       
   139     : DOMConstructorObject(JSEventConstructor::createStructure(globalObject->objectPrototype()), globalObject)
       
   140 {
       
   141     putDirect(exec->propertyNames().prototype, JSEventPrototype::self(exec, globalObject), DontDelete | ReadOnly);
       
   142 }
       
   143 
       
   144 bool JSEventConstructor::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
       
   145 {
       
   146     return getStaticValueSlot<JSEventConstructor, DOMObject>(exec, &JSEventConstructorTable, this, propertyName, slot);
       
   147 }
       
   148 
       
   149 bool JSEventConstructor::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
       
   150 {
       
   151     return getStaticValueDescriptor<JSEventConstructor, DOMObject>(exec, &JSEventConstructorTable, this, propertyName, descriptor);
       
   152 }
       
   153 
       
   154 /* Hash table for prototype */
       
   155 #if ENABLE(JIT)
       
   156 #define THUNK_GENERATOR(generator) , generator
       
   157 #else
       
   158 #define THUNK_GENERATOR(generator)
       
   159 #endif
       
   160 
       
   161 static const HashTableValue JSEventPrototypeTableValues[24] =
       
   162 {
       
   163     { "CAPTURING_PHASE", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsEventCAPTURING_PHASE), (intptr_t)0 THUNK_GENERATOR(0) },
       
   164     { "AT_TARGET", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsEventAT_TARGET), (intptr_t)0 THUNK_GENERATOR(0) },
       
   165     { "BUBBLING_PHASE", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsEventBUBBLING_PHASE), (intptr_t)0 THUNK_GENERATOR(0) },
       
   166     { "MOUSEDOWN", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsEventMOUSEDOWN), (intptr_t)0 THUNK_GENERATOR(0) },
       
   167     { "MOUSEUP", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsEventMOUSEUP), (intptr_t)0 THUNK_GENERATOR(0) },
       
   168     { "MOUSEOVER", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsEventMOUSEOVER), (intptr_t)0 THUNK_GENERATOR(0) },
       
   169     { "MOUSEOUT", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsEventMOUSEOUT), (intptr_t)0 THUNK_GENERATOR(0) },
       
   170     { "MOUSEMOVE", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsEventMOUSEMOVE), (intptr_t)0 THUNK_GENERATOR(0) },
       
   171     { "MOUSEDRAG", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsEventMOUSEDRAG), (intptr_t)0 THUNK_GENERATOR(0) },
       
   172     { "CLICK", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsEventCLICK), (intptr_t)0 THUNK_GENERATOR(0) },
       
   173     { "DBLCLICK", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsEventDBLCLICK), (intptr_t)0 THUNK_GENERATOR(0) },
       
   174     { "KEYDOWN", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsEventKEYDOWN), (intptr_t)0 THUNK_GENERATOR(0) },
       
   175     { "KEYUP", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsEventKEYUP), (intptr_t)0 THUNK_GENERATOR(0) },
       
   176     { "KEYPRESS", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsEventKEYPRESS), (intptr_t)0 THUNK_GENERATOR(0) },
       
   177     { "DRAGDROP", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsEventDRAGDROP), (intptr_t)0 THUNK_GENERATOR(0) },
       
   178     { "FOCUS", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsEventFOCUS), (intptr_t)0 THUNK_GENERATOR(0) },
       
   179     { "BLUR", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsEventBLUR), (intptr_t)0 THUNK_GENERATOR(0) },
       
   180     { "SELECT", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsEventSELECT), (intptr_t)0 THUNK_GENERATOR(0) },
       
   181     { "CHANGE", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsEventCHANGE), (intptr_t)0 THUNK_GENERATOR(0) },
       
   182     { "stopPropagation", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsEventPrototypeFunctionStopPropagation), (intptr_t)0 THUNK_GENERATOR(0) },
       
   183     { "preventDefault", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsEventPrototypeFunctionPreventDefault), (intptr_t)0 THUNK_GENERATOR(0) },
       
   184     { "initEvent", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsEventPrototypeFunctionInitEvent), (intptr_t)3 THUNK_GENERATOR(0) },
       
   185     { "stopImmediatePropagation", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsEventPrototypeFunctionStopImmediatePropagation), (intptr_t)0 THUNK_GENERATOR(0) },
       
   186     { 0, 0, 0, 0 THUNK_GENERATOR(0) }
       
   187 };
       
   188 
       
   189 #undef THUNK_GENERATOR
       
   190 static JSC_CONST_HASHTABLE HashTable JSEventPrototypeTable = { 69, 63, JSEventPrototypeTableValues, 0 };
       
   191 static const HashTable* getJSEventPrototypeTable(ExecState* exec)
       
   192 {
       
   193     return getHashTableForGlobalData(exec->globalData(), &JSEventPrototypeTable);
       
   194 }
       
   195 const ClassInfo JSEventPrototype::s_info = { "EventPrototype", 0, 0, getJSEventPrototypeTable };
       
   196 
       
   197 JSObject* JSEventPrototype::self(ExecState* exec, JSGlobalObject* globalObject)
       
   198 {
       
   199     return getDOMPrototype<JSEvent>(exec, globalObject);
       
   200 }
       
   201 
       
   202 bool JSEventPrototype::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
       
   203 {
       
   204     return getStaticPropertySlot<JSEventPrototype, JSObject>(exec, getJSEventPrototypeTable(exec), this, propertyName, slot);
       
   205 }
       
   206 
       
   207 bool JSEventPrototype::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
       
   208 {
       
   209     return getStaticPropertyDescriptor<JSEventPrototype, JSObject>(exec, getJSEventPrototypeTable(exec), this, propertyName, descriptor);
       
   210 }
       
   211 
       
   212 static const HashTable* getJSEventTable(ExecState* exec)
       
   213 {
       
   214     return getHashTableForGlobalData(exec->globalData(), &JSEventTable);
       
   215 }
       
   216 const ClassInfo JSEvent::s_info = { "Event", 0, 0, getJSEventTable };
       
   217 
       
   218 JSEvent::JSEvent(NonNullPassRefPtr<Structure> structure, JSDOMGlobalObject* globalObject, PassRefPtr<Event> impl)
       
   219     : DOMObjectWithGlobalPointer(structure, globalObject)
       
   220     , m_impl(impl)
       
   221 {
       
   222 }
       
   223 
       
   224 JSEvent::~JSEvent()
       
   225 {
       
   226     forgetDOMObject(this, impl());
       
   227 }
       
   228 
       
   229 JSObject* JSEvent::createPrototype(ExecState* exec, JSGlobalObject* globalObject)
       
   230 {
       
   231     return new (exec) JSEventPrototype(globalObject, JSEventPrototype::createStructure(globalObject->objectPrototype()));
       
   232 }
       
   233 
       
   234 bool JSEvent::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
       
   235 {
       
   236     return getStaticValueSlot<JSEvent, Base>(exec, getJSEventTable(exec), this, propertyName, slot);
       
   237 }
       
   238 
       
   239 bool JSEvent::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
       
   240 {
       
   241     return getStaticValueDescriptor<JSEvent, Base>(exec, getJSEventTable(exec), this, propertyName, descriptor);
       
   242 }
       
   243 
       
   244 JSValue jsEventType(ExecState* exec, JSValue slotBase, const Identifier&)
       
   245 {
       
   246     JSEvent* castedThis = static_cast<JSEvent*>(asObject(slotBase));
       
   247     UNUSED_PARAM(exec);
       
   248     Event* imp = static_cast<Event*>(castedThis->impl());
       
   249     JSValue result = jsString(exec, imp->type());
       
   250     return result;
       
   251 }
       
   252 
       
   253 JSValue jsEventTarget(ExecState* exec, JSValue slotBase, const Identifier&)
       
   254 {
       
   255     JSEvent* castedThis = static_cast<JSEvent*>(asObject(slotBase));
       
   256     UNUSED_PARAM(exec);
       
   257     Event* imp = static_cast<Event*>(castedThis->impl());
       
   258     JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->target()));
       
   259     return result;
       
   260 }
       
   261 
       
   262 JSValue jsEventCurrentTarget(ExecState* exec, JSValue slotBase, const Identifier&)
       
   263 {
       
   264     JSEvent* castedThis = static_cast<JSEvent*>(asObject(slotBase));
       
   265     UNUSED_PARAM(exec);
       
   266     Event* imp = static_cast<Event*>(castedThis->impl());
       
   267     JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->currentTarget()));
       
   268     return result;
       
   269 }
       
   270 
       
   271 JSValue jsEventEventPhase(ExecState* exec, JSValue slotBase, const Identifier&)
       
   272 {
       
   273     JSEvent* castedThis = static_cast<JSEvent*>(asObject(slotBase));
       
   274     UNUSED_PARAM(exec);
       
   275     Event* imp = static_cast<Event*>(castedThis->impl());
       
   276     JSValue result = jsNumber(exec, imp->eventPhase());
       
   277     return result;
       
   278 }
       
   279 
       
   280 JSValue jsEventBubbles(ExecState* exec, JSValue slotBase, const Identifier&)
       
   281 {
       
   282     JSEvent* castedThis = static_cast<JSEvent*>(asObject(slotBase));
       
   283     UNUSED_PARAM(exec);
       
   284     Event* imp = static_cast<Event*>(castedThis->impl());
       
   285     JSValue result = jsBoolean(imp->bubbles());
       
   286     return result;
       
   287 }
       
   288 
       
   289 JSValue jsEventCancelable(ExecState* exec, JSValue slotBase, const Identifier&)
       
   290 {
       
   291     JSEvent* castedThis = static_cast<JSEvent*>(asObject(slotBase));
       
   292     UNUSED_PARAM(exec);
       
   293     Event* imp = static_cast<Event*>(castedThis->impl());
       
   294     JSValue result = jsBoolean(imp->cancelable());
       
   295     return result;
       
   296 }
       
   297 
       
   298 JSValue jsEventTimeStamp(ExecState* exec, JSValue slotBase, const Identifier&)
       
   299 {
       
   300     JSEvent* castedThis = static_cast<JSEvent*>(asObject(slotBase));
       
   301     UNUSED_PARAM(exec);
       
   302     Event* imp = static_cast<Event*>(castedThis->impl());
       
   303     JSValue result = jsNumber(exec, imp->timeStamp());
       
   304     return result;
       
   305 }
       
   306 
       
   307 JSValue jsEventDefaultPrevented(ExecState* exec, JSValue slotBase, const Identifier&)
       
   308 {
       
   309     JSEvent* castedThis = static_cast<JSEvent*>(asObject(slotBase));
       
   310     UNUSED_PARAM(exec);
       
   311     Event* imp = static_cast<Event*>(castedThis->impl());
       
   312     JSValue result = jsBoolean(imp->defaultPrevented());
       
   313     return result;
       
   314 }
       
   315 
       
   316 JSValue jsEventSrcElement(ExecState* exec, JSValue slotBase, const Identifier&)
       
   317 {
       
   318     JSEvent* castedThis = static_cast<JSEvent*>(asObject(slotBase));
       
   319     UNUSED_PARAM(exec);
       
   320     Event* imp = static_cast<Event*>(castedThis->impl());
       
   321     JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->srcElement()));
       
   322     return result;
       
   323 }
       
   324 
       
   325 JSValue jsEventReturnValue(ExecState* exec, JSValue slotBase, const Identifier&)
       
   326 {
       
   327     JSEvent* castedThis = static_cast<JSEvent*>(asObject(slotBase));
       
   328     UNUSED_PARAM(exec);
       
   329     Event* imp = static_cast<Event*>(castedThis->impl());
       
   330     JSValue result = jsBoolean(imp->returnValue());
       
   331     return result;
       
   332 }
       
   333 
       
   334 JSValue jsEventCancelBubble(ExecState* exec, JSValue slotBase, const Identifier&)
       
   335 {
       
   336     JSEvent* castedThis = static_cast<JSEvent*>(asObject(slotBase));
       
   337     UNUSED_PARAM(exec);
       
   338     Event* imp = static_cast<Event*>(castedThis->impl());
       
   339     JSValue result = jsBoolean(imp->cancelBubble());
       
   340     return result;
       
   341 }
       
   342 
       
   343 JSValue jsEventClipboardData(ExecState* exec, JSValue slotBase, const Identifier&)
       
   344 {
       
   345     JSEvent* castedThis = static_cast<JSEvent*>(asObject(slotBase));
       
   346     return castedThis->clipboardData(exec);
       
   347 }
       
   348 
       
   349 JSValue jsEventConstructor(ExecState* exec, JSValue slotBase, const Identifier&)
       
   350 {
       
   351     JSEvent* domObject = static_cast<JSEvent*>(asObject(slotBase));
       
   352     return JSEvent::getConstructor(exec, domObject->globalObject());
       
   353 }
       
   354 void JSEvent::put(ExecState* exec, const Identifier& propertyName, JSValue value, PutPropertySlot& slot)
       
   355 {
       
   356     lookupPut<JSEvent, Base>(exec, propertyName, value, getJSEventTable(exec), this, slot);
       
   357 }
       
   358 
       
   359 void setJSEventReturnValue(ExecState* exec, JSObject* thisObject, JSValue value)
       
   360 {
       
   361     JSEvent* castedThis = static_cast<JSEvent*>(thisObject);
       
   362     Event* imp = static_cast<Event*>(castedThis->impl());
       
   363     imp->setReturnValue(value.toBoolean(exec));
       
   364 }
       
   365 
       
   366 void setJSEventCancelBubble(ExecState* exec, JSObject* thisObject, JSValue value)
       
   367 {
       
   368     JSEvent* castedThis = static_cast<JSEvent*>(thisObject);
       
   369     Event* imp = static_cast<Event*>(castedThis->impl());
       
   370     imp->setCancelBubble(value.toBoolean(exec));
       
   371 }
       
   372 
       
   373 JSValue JSEvent::getConstructor(ExecState* exec, JSGlobalObject* globalObject)
       
   374 {
       
   375     return getDOMConstructor<JSEventConstructor>(exec, static_cast<JSDOMGlobalObject*>(globalObject));
       
   376 }
       
   377 
       
   378 EncodedJSValue JSC_HOST_CALL jsEventPrototypeFunctionStopPropagation(ExecState* exec)
       
   379 {
       
   380     JSValue thisValue = exec->hostThisValue();
       
   381     if (!thisValue.inherits(&JSEvent::s_info))
       
   382         return throwVMTypeError(exec);
       
   383     JSEvent* castedThis = static_cast<JSEvent*>(asObject(thisValue));
       
   384     Event* imp = static_cast<Event*>(castedThis->impl());
       
   385 
       
   386     imp->stopPropagation();
       
   387     return JSValue::encode(jsUndefined());
       
   388 }
       
   389 
       
   390 EncodedJSValue JSC_HOST_CALL jsEventPrototypeFunctionPreventDefault(ExecState* exec)
       
   391 {
       
   392     JSValue thisValue = exec->hostThisValue();
       
   393     if (!thisValue.inherits(&JSEvent::s_info))
       
   394         return throwVMTypeError(exec);
       
   395     JSEvent* castedThis = static_cast<JSEvent*>(asObject(thisValue));
       
   396     Event* imp = static_cast<Event*>(castedThis->impl());
       
   397 
       
   398     imp->preventDefault();
       
   399     return JSValue::encode(jsUndefined());
       
   400 }
       
   401 
       
   402 EncodedJSValue JSC_HOST_CALL jsEventPrototypeFunctionInitEvent(ExecState* exec)
       
   403 {
       
   404     JSValue thisValue = exec->hostThisValue();
       
   405     if (!thisValue.inherits(&JSEvent::s_info))
       
   406         return throwVMTypeError(exec);
       
   407     JSEvent* castedThis = static_cast<JSEvent*>(asObject(thisValue));
       
   408     Event* imp = static_cast<Event*>(castedThis->impl());
       
   409     const String& eventTypeArg = ustringToString(exec->argument(0).toString(exec));
       
   410     bool canBubbleArg = exec->argument(1).toBoolean(exec);
       
   411     bool cancelableArg = exec->argument(2).toBoolean(exec);
       
   412 
       
   413     imp->initEvent(eventTypeArg, canBubbleArg, cancelableArg);
       
   414     return JSValue::encode(jsUndefined());
       
   415 }
       
   416 
       
   417 EncodedJSValue JSC_HOST_CALL jsEventPrototypeFunctionStopImmediatePropagation(ExecState* exec)
       
   418 {
       
   419     JSValue thisValue = exec->hostThisValue();
       
   420     if (!thisValue.inherits(&JSEvent::s_info))
       
   421         return throwVMTypeError(exec);
       
   422     JSEvent* castedThis = static_cast<JSEvent*>(asObject(thisValue));
       
   423     Event* imp = static_cast<Event*>(castedThis->impl());
       
   424 
       
   425     imp->stopImmediatePropagation();
       
   426     return JSValue::encode(jsUndefined());
       
   427 }
       
   428 
       
   429 // Constant getters
       
   430 
       
   431 JSValue jsEventCAPTURING_PHASE(ExecState* exec, JSValue, const Identifier&)
       
   432 {
       
   433     return jsNumber(exec, static_cast<int>(1));
       
   434 }
       
   435 
       
   436 JSValue jsEventAT_TARGET(ExecState* exec, JSValue, const Identifier&)
       
   437 {
       
   438     return jsNumber(exec, static_cast<int>(2));
       
   439 }
       
   440 
       
   441 JSValue jsEventBUBBLING_PHASE(ExecState* exec, JSValue, const Identifier&)
       
   442 {
       
   443     return jsNumber(exec, static_cast<int>(3));
       
   444 }
       
   445 
       
   446 JSValue jsEventMOUSEDOWN(ExecState* exec, JSValue, const Identifier&)
       
   447 {
       
   448     return jsNumber(exec, static_cast<int>(1));
       
   449 }
       
   450 
       
   451 JSValue jsEventMOUSEUP(ExecState* exec, JSValue, const Identifier&)
       
   452 {
       
   453     return jsNumber(exec, static_cast<int>(2));
       
   454 }
       
   455 
       
   456 JSValue jsEventMOUSEOVER(ExecState* exec, JSValue, const Identifier&)
       
   457 {
       
   458     return jsNumber(exec, static_cast<int>(4));
       
   459 }
       
   460 
       
   461 JSValue jsEventMOUSEOUT(ExecState* exec, JSValue, const Identifier&)
       
   462 {
       
   463     return jsNumber(exec, static_cast<int>(8));
       
   464 }
       
   465 
       
   466 JSValue jsEventMOUSEMOVE(ExecState* exec, JSValue, const Identifier&)
       
   467 {
       
   468     return jsNumber(exec, static_cast<int>(16));
       
   469 }
       
   470 
       
   471 JSValue jsEventMOUSEDRAG(ExecState* exec, JSValue, const Identifier&)
       
   472 {
       
   473     return jsNumber(exec, static_cast<int>(32));
       
   474 }
       
   475 
       
   476 JSValue jsEventCLICK(ExecState* exec, JSValue, const Identifier&)
       
   477 {
       
   478     return jsNumber(exec, static_cast<int>(64));
       
   479 }
       
   480 
       
   481 JSValue jsEventDBLCLICK(ExecState* exec, JSValue, const Identifier&)
       
   482 {
       
   483     return jsNumber(exec, static_cast<int>(128));
       
   484 }
       
   485 
       
   486 JSValue jsEventKEYDOWN(ExecState* exec, JSValue, const Identifier&)
       
   487 {
       
   488     return jsNumber(exec, static_cast<int>(256));
       
   489 }
       
   490 
       
   491 JSValue jsEventKEYUP(ExecState* exec, JSValue, const Identifier&)
       
   492 {
       
   493     return jsNumber(exec, static_cast<int>(512));
       
   494 }
       
   495 
       
   496 JSValue jsEventKEYPRESS(ExecState* exec, JSValue, const Identifier&)
       
   497 {
       
   498     return jsNumber(exec, static_cast<int>(1024));
       
   499 }
       
   500 
       
   501 JSValue jsEventDRAGDROP(ExecState* exec, JSValue, const Identifier&)
       
   502 {
       
   503     return jsNumber(exec, static_cast<int>(2048));
       
   504 }
       
   505 
       
   506 JSValue jsEventFOCUS(ExecState* exec, JSValue, const Identifier&)
       
   507 {
       
   508     return jsNumber(exec, static_cast<int>(4096));
       
   509 }
       
   510 
       
   511 JSValue jsEventBLUR(ExecState* exec, JSValue, const Identifier&)
       
   512 {
       
   513     return jsNumber(exec, static_cast<int>(8192));
       
   514 }
       
   515 
       
   516 JSValue jsEventSELECT(ExecState* exec, JSValue, const Identifier&)
       
   517 {
       
   518     return jsNumber(exec, static_cast<int>(16384));
       
   519 }
       
   520 
       
   521 JSValue jsEventCHANGE(ExecState* exec, JSValue, const Identifier&)
       
   522 {
       
   523     return jsNumber(exec, static_cast<int>(32768));
       
   524 }
       
   525 
       
   526 Event* toEvent(JSC::JSValue value)
       
   527 {
       
   528     return value.inherits(&JSEvent::s_info) ? static_cast<JSEvent*>(asObject(value))->impl() : 0;
       
   529 }
       
   530 
       
   531 }