WebCore/generated/JSKeyboardEvent.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 "JSKeyboardEvent.h"
       
    23 
       
    24 #include "JSDOMWindow.h"
       
    25 #include "KURL.h"
       
    26 #include "KeyboardEvent.h"
       
    27 #include <runtime/Error.h>
       
    28 #include <runtime/JSNumberCell.h>
       
    29 #include <runtime/JSString.h>
       
    30 #include <wtf/GetPtr.h>
       
    31 
       
    32 using namespace JSC;
       
    33 
       
    34 namespace WebCore {
       
    35 
       
    36 ASSERT_CLASS_FITS_IN_CELL(JSKeyboardEvent);
       
    37 
       
    38 /* Hash table */
       
    39 #if ENABLE(JIT)
       
    40 #define THUNK_GENERATOR(generator) , generator
       
    41 #else
       
    42 #define THUNK_GENERATOR(generator)
       
    43 #endif
       
    44 
       
    45 static const HashTableValue JSKeyboardEventTableValues[9] =
       
    46 {
       
    47     { "keyIdentifier", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsKeyboardEventKeyIdentifier), (intptr_t)0 THUNK_GENERATOR(0) },
       
    48     { "keyLocation", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsKeyboardEventKeyLocation), (intptr_t)0 THUNK_GENERATOR(0) },
       
    49     { "ctrlKey", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsKeyboardEventCtrlKey), (intptr_t)0 THUNK_GENERATOR(0) },
       
    50     { "shiftKey", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsKeyboardEventShiftKey), (intptr_t)0 THUNK_GENERATOR(0) },
       
    51     { "altKey", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsKeyboardEventAltKey), (intptr_t)0 THUNK_GENERATOR(0) },
       
    52     { "metaKey", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsKeyboardEventMetaKey), (intptr_t)0 THUNK_GENERATOR(0) },
       
    53     { "altGraphKey", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsKeyboardEventAltGraphKey), (intptr_t)0 THUNK_GENERATOR(0) },
       
    54     { "constructor", DontEnum | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsKeyboardEventConstructor), (intptr_t)0 THUNK_GENERATOR(0) },
       
    55     { 0, 0, 0, 0 THUNK_GENERATOR(0) }
       
    56 };
       
    57 
       
    58 #undef THUNK_GENERATOR
       
    59 static JSC_CONST_HASHTABLE HashTable JSKeyboardEventTable = { 18, 15, JSKeyboardEventTableValues, 0 };
       
    60 /* Hash table for constructor */
       
    61 #if ENABLE(JIT)
       
    62 #define THUNK_GENERATOR(generator) , generator
       
    63 #else
       
    64 #define THUNK_GENERATOR(generator)
       
    65 #endif
       
    66 
       
    67 static const HashTableValue JSKeyboardEventConstructorTableValues[1] =
       
    68 {
       
    69     { 0, 0, 0, 0 THUNK_GENERATOR(0) }
       
    70 };
       
    71 
       
    72 #undef THUNK_GENERATOR
       
    73 static JSC_CONST_HASHTABLE HashTable JSKeyboardEventConstructorTable = { 1, 0, JSKeyboardEventConstructorTableValues, 0 };
       
    74 class JSKeyboardEventConstructor : public DOMConstructorObject {
       
    75 public:
       
    76     JSKeyboardEventConstructor(JSC::ExecState*, JSDOMGlobalObject*);
       
    77 
       
    78     virtual bool getOwnPropertySlot(JSC::ExecState*, const JSC::Identifier&, JSC::PropertySlot&);
       
    79     virtual bool getOwnPropertyDescriptor(JSC::ExecState*, const JSC::Identifier&, JSC::PropertyDescriptor&);
       
    80     virtual const JSC::ClassInfo* classInfo() const { return &s_info; }
       
    81     static const JSC::ClassInfo s_info;
       
    82     static PassRefPtr<JSC::Structure> createStructure(JSC::JSValue prototype)
       
    83     {
       
    84         return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), AnonymousSlotCount);
       
    85     }
       
    86 protected:
       
    87     static const unsigned StructureFlags = JSC::OverridesGetOwnPropertySlot | JSC::ImplementsHasInstance | DOMConstructorObject::StructureFlags;
       
    88 };
       
    89 
       
    90 const ClassInfo JSKeyboardEventConstructor::s_info = { "KeyboardEventConstructor", 0, &JSKeyboardEventConstructorTable, 0 };
       
    91 
       
    92 JSKeyboardEventConstructor::JSKeyboardEventConstructor(ExecState* exec, JSDOMGlobalObject* globalObject)
       
    93     : DOMConstructorObject(JSKeyboardEventConstructor::createStructure(globalObject->objectPrototype()), globalObject)
       
    94 {
       
    95     putDirect(exec->propertyNames().prototype, JSKeyboardEventPrototype::self(exec, globalObject), DontDelete | ReadOnly);
       
    96 }
       
    97 
       
    98 bool JSKeyboardEventConstructor::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
       
    99 {
       
   100     return getStaticValueSlot<JSKeyboardEventConstructor, DOMObject>(exec, &JSKeyboardEventConstructorTable, this, propertyName, slot);
       
   101 }
       
   102 
       
   103 bool JSKeyboardEventConstructor::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
       
   104 {
       
   105     return getStaticValueDescriptor<JSKeyboardEventConstructor, DOMObject>(exec, &JSKeyboardEventConstructorTable, this, propertyName, descriptor);
       
   106 }
       
   107 
       
   108 /* Hash table for prototype */
       
   109 #if ENABLE(JIT)
       
   110 #define THUNK_GENERATOR(generator) , generator
       
   111 #else
       
   112 #define THUNK_GENERATOR(generator)
       
   113 #endif
       
   114 
       
   115 static const HashTableValue JSKeyboardEventPrototypeTableValues[2] =
       
   116 {
       
   117     { "initKeyboardEvent", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsKeyboardEventPrototypeFunctionInitKeyboardEvent), (intptr_t)11 THUNK_GENERATOR(0) },
       
   118     { 0, 0, 0, 0 THUNK_GENERATOR(0) }
       
   119 };
       
   120 
       
   121 #undef THUNK_GENERATOR
       
   122 static JSC_CONST_HASHTABLE HashTable JSKeyboardEventPrototypeTable = { 2, 1, JSKeyboardEventPrototypeTableValues, 0 };
       
   123 const ClassInfo JSKeyboardEventPrototype::s_info = { "KeyboardEventPrototype", 0, &JSKeyboardEventPrototypeTable, 0 };
       
   124 
       
   125 JSObject* JSKeyboardEventPrototype::self(ExecState* exec, JSGlobalObject* globalObject)
       
   126 {
       
   127     return getDOMPrototype<JSKeyboardEvent>(exec, globalObject);
       
   128 }
       
   129 
       
   130 bool JSKeyboardEventPrototype::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
       
   131 {
       
   132     return getStaticFunctionSlot<JSObject>(exec, &JSKeyboardEventPrototypeTable, this, propertyName, slot);
       
   133 }
       
   134 
       
   135 bool JSKeyboardEventPrototype::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
       
   136 {
       
   137     return getStaticFunctionDescriptor<JSObject>(exec, &JSKeyboardEventPrototypeTable, this, propertyName, descriptor);
       
   138 }
       
   139 
       
   140 const ClassInfo JSKeyboardEvent::s_info = { "KeyboardEvent", &JSUIEvent::s_info, &JSKeyboardEventTable, 0 };
       
   141 
       
   142 JSKeyboardEvent::JSKeyboardEvent(NonNullPassRefPtr<Structure> structure, JSDOMGlobalObject* globalObject, PassRefPtr<KeyboardEvent> impl)
       
   143     : JSUIEvent(structure, globalObject, impl)
       
   144 {
       
   145 }
       
   146 
       
   147 JSObject* JSKeyboardEvent::createPrototype(ExecState* exec, JSGlobalObject* globalObject)
       
   148 {
       
   149     return new (exec) JSKeyboardEventPrototype(globalObject, JSKeyboardEventPrototype::createStructure(JSUIEventPrototype::self(exec, globalObject)));
       
   150 }
       
   151 
       
   152 bool JSKeyboardEvent::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
       
   153 {
       
   154     return getStaticValueSlot<JSKeyboardEvent, Base>(exec, &JSKeyboardEventTable, this, propertyName, slot);
       
   155 }
       
   156 
       
   157 bool JSKeyboardEvent::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
       
   158 {
       
   159     return getStaticValueDescriptor<JSKeyboardEvent, Base>(exec, &JSKeyboardEventTable, this, propertyName, descriptor);
       
   160 }
       
   161 
       
   162 JSValue jsKeyboardEventKeyIdentifier(ExecState* exec, JSValue slotBase, const Identifier&)
       
   163 {
       
   164     JSKeyboardEvent* castedThis = static_cast<JSKeyboardEvent*>(asObject(slotBase));
       
   165     UNUSED_PARAM(exec);
       
   166     KeyboardEvent* imp = static_cast<KeyboardEvent*>(castedThis->impl());
       
   167     JSValue result = jsString(exec, imp->keyIdentifier());
       
   168     return result;
       
   169 }
       
   170 
       
   171 JSValue jsKeyboardEventKeyLocation(ExecState* exec, JSValue slotBase, const Identifier&)
       
   172 {
       
   173     JSKeyboardEvent* castedThis = static_cast<JSKeyboardEvent*>(asObject(slotBase));
       
   174     UNUSED_PARAM(exec);
       
   175     KeyboardEvent* imp = static_cast<KeyboardEvent*>(castedThis->impl());
       
   176     JSValue result = jsNumber(exec, imp->keyLocation());
       
   177     return result;
       
   178 }
       
   179 
       
   180 JSValue jsKeyboardEventCtrlKey(ExecState* exec, JSValue slotBase, const Identifier&)
       
   181 {
       
   182     JSKeyboardEvent* castedThis = static_cast<JSKeyboardEvent*>(asObject(slotBase));
       
   183     UNUSED_PARAM(exec);
       
   184     KeyboardEvent* imp = static_cast<KeyboardEvent*>(castedThis->impl());
       
   185     JSValue result = jsBoolean(imp->ctrlKey());
       
   186     return result;
       
   187 }
       
   188 
       
   189 JSValue jsKeyboardEventShiftKey(ExecState* exec, JSValue slotBase, const Identifier&)
       
   190 {
       
   191     JSKeyboardEvent* castedThis = static_cast<JSKeyboardEvent*>(asObject(slotBase));
       
   192     UNUSED_PARAM(exec);
       
   193     KeyboardEvent* imp = static_cast<KeyboardEvent*>(castedThis->impl());
       
   194     JSValue result = jsBoolean(imp->shiftKey());
       
   195     return result;
       
   196 }
       
   197 
       
   198 JSValue jsKeyboardEventAltKey(ExecState* exec, JSValue slotBase, const Identifier&)
       
   199 {
       
   200     JSKeyboardEvent* castedThis = static_cast<JSKeyboardEvent*>(asObject(slotBase));
       
   201     UNUSED_PARAM(exec);
       
   202     KeyboardEvent* imp = static_cast<KeyboardEvent*>(castedThis->impl());
       
   203     JSValue result = jsBoolean(imp->altKey());
       
   204     return result;
       
   205 }
       
   206 
       
   207 JSValue jsKeyboardEventMetaKey(ExecState* exec, JSValue slotBase, const Identifier&)
       
   208 {
       
   209     JSKeyboardEvent* castedThis = static_cast<JSKeyboardEvent*>(asObject(slotBase));
       
   210     UNUSED_PARAM(exec);
       
   211     KeyboardEvent* imp = static_cast<KeyboardEvent*>(castedThis->impl());
       
   212     JSValue result = jsBoolean(imp->metaKey());
       
   213     return result;
       
   214 }
       
   215 
       
   216 JSValue jsKeyboardEventAltGraphKey(ExecState* exec, JSValue slotBase, const Identifier&)
       
   217 {
       
   218     JSKeyboardEvent* castedThis = static_cast<JSKeyboardEvent*>(asObject(slotBase));
       
   219     UNUSED_PARAM(exec);
       
   220     KeyboardEvent* imp = static_cast<KeyboardEvent*>(castedThis->impl());
       
   221     JSValue result = jsBoolean(imp->altGraphKey());
       
   222     return result;
       
   223 }
       
   224 
       
   225 JSValue jsKeyboardEventConstructor(ExecState* exec, JSValue slotBase, const Identifier&)
       
   226 {
       
   227     JSKeyboardEvent* domObject = static_cast<JSKeyboardEvent*>(asObject(slotBase));
       
   228     return JSKeyboardEvent::getConstructor(exec, domObject->globalObject());
       
   229 }
       
   230 JSValue JSKeyboardEvent::getConstructor(ExecState* exec, JSGlobalObject* globalObject)
       
   231 {
       
   232     return getDOMConstructor<JSKeyboardEventConstructor>(exec, static_cast<JSDOMGlobalObject*>(globalObject));
       
   233 }
       
   234 
       
   235 EncodedJSValue JSC_HOST_CALL jsKeyboardEventPrototypeFunctionInitKeyboardEvent(ExecState* exec)
       
   236 {
       
   237     JSValue thisValue = exec->hostThisValue();
       
   238     if (!thisValue.inherits(&JSKeyboardEvent::s_info))
       
   239         return throwVMTypeError(exec);
       
   240     JSKeyboardEvent* castedThis = static_cast<JSKeyboardEvent*>(asObject(thisValue));
       
   241     KeyboardEvent* imp = static_cast<KeyboardEvent*>(castedThis->impl());
       
   242     const String& type = ustringToString(exec->argument(0).toString(exec));
       
   243     bool canBubble = exec->argument(1).toBoolean(exec);
       
   244     bool cancelable = exec->argument(2).toBoolean(exec);
       
   245     DOMWindow* view = toDOMWindow(exec->argument(3));
       
   246     const String& keyIdentifier = ustringToString(exec->argument(4).toString(exec));
       
   247     unsigned keyLocation = exec->argument(5).toInt32(exec);
       
   248     bool ctrlKey = exec->argument(6).toBoolean(exec);
       
   249     bool altKey = exec->argument(7).toBoolean(exec);
       
   250     bool shiftKey = exec->argument(8).toBoolean(exec);
       
   251     bool metaKey = exec->argument(9).toBoolean(exec);
       
   252     bool altGraphKey = exec->argument(10).toBoolean(exec);
       
   253 
       
   254     imp->initKeyboardEvent(type, canBubble, cancelable, view, keyIdentifier, keyLocation, ctrlKey, altKey, shiftKey, metaKey, altGraphKey);
       
   255     return JSValue::encode(jsUndefined());
       
   256 }
       
   257 
       
   258 
       
   259 }