/* This file is part of the WebKit open source project. This file has been generated by generate-bindings.pl. DO NOT MODIFY! This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "config.h" #include "JSUIEvent.h" #include "DOMWindow.h" #include "ExceptionCode.h" #include "JSDOMBinding.h" #include "JSDOMWindow.h" #include "UIEvent.h" #include #include using namespace JSC; namespace WebCore { ASSERT_CLASS_FITS_IN_CELL(JSUIEvent); /* Hash table */ #if ENABLE(JIT) #define THUNK_GENERATOR(generator) , generator #else #define THUNK_GENERATOR(generator) #endif static const HashTableValue JSUIEventTableValues[11] = { { "view", DontDelete | ReadOnly, (intptr_t)static_cast(jsUIEventView), (intptr_t)0 THUNK_GENERATOR(0) }, { "detail", DontDelete | ReadOnly, (intptr_t)static_cast(jsUIEventDetail), (intptr_t)0 THUNK_GENERATOR(0) }, { "keyCode", DontDelete | ReadOnly, (intptr_t)static_cast(jsUIEventKeyCode), (intptr_t)0 THUNK_GENERATOR(0) }, { "charCode", DontDelete | ReadOnly, (intptr_t)static_cast(jsUIEventCharCode), (intptr_t)0 THUNK_GENERATOR(0) }, { "layerX", DontDelete | ReadOnly, (intptr_t)static_cast(jsUIEventLayerX), (intptr_t)0 THUNK_GENERATOR(0) }, { "layerY", DontDelete | ReadOnly, (intptr_t)static_cast(jsUIEventLayerY), (intptr_t)0 THUNK_GENERATOR(0) }, { "pageX", DontDelete | ReadOnly, (intptr_t)static_cast(jsUIEventPageX), (intptr_t)0 THUNK_GENERATOR(0) }, { "pageY", DontDelete | ReadOnly, (intptr_t)static_cast(jsUIEventPageY), (intptr_t)0 THUNK_GENERATOR(0) }, { "which", DontDelete | ReadOnly, (intptr_t)static_cast(jsUIEventWhich), (intptr_t)0 THUNK_GENERATOR(0) }, { "constructor", DontEnum | ReadOnly, (intptr_t)static_cast(jsUIEventConstructor), (intptr_t)0 THUNK_GENERATOR(0) }, { 0, 0, 0, 0 THUNK_GENERATOR(0) } }; #undef THUNK_GENERATOR static JSC_CONST_HASHTABLE HashTable JSUIEventTable = { 34, 31, JSUIEventTableValues, 0 }; /* Hash table for constructor */ #if ENABLE(JIT) #define THUNK_GENERATOR(generator) , generator #else #define THUNK_GENERATOR(generator) #endif static const HashTableValue JSUIEventConstructorTableValues[1] = { { 0, 0, 0, 0 THUNK_GENERATOR(0) } }; #undef THUNK_GENERATOR static JSC_CONST_HASHTABLE HashTable JSUIEventConstructorTable = { 1, 0, JSUIEventConstructorTableValues, 0 }; class JSUIEventConstructor : public DOMConstructorObject { public: JSUIEventConstructor(JSC::ExecState*, JSC::Structure*, JSDOMGlobalObject*); virtual bool getOwnPropertySlot(JSC::ExecState*, const JSC::Identifier&, JSC::PropertySlot&); virtual bool getOwnPropertyDescriptor(JSC::ExecState*, const JSC::Identifier&, JSC::PropertyDescriptor&); static const JSC::ClassInfo s_info; static JSC::Structure* createStructure(JSC::JSGlobalData& globalData, JSC::JSValue prototype) { return JSC::Structure::create(globalData, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), AnonymousSlotCount, &s_info); } protected: static const unsigned StructureFlags = JSC::OverridesGetOwnPropertySlot | JSC::ImplementsHasInstance | DOMConstructorObject::StructureFlags; }; const ClassInfo JSUIEventConstructor::s_info = { "UIEventConstructor", &DOMConstructorObject::s_info, &JSUIEventConstructorTable, 0 }; JSUIEventConstructor::JSUIEventConstructor(ExecState* exec, Structure* structure, JSDOMGlobalObject* globalObject) : DOMConstructorObject(structure, globalObject) { ASSERT(inherits(&s_info)); putDirect(exec->globalData(), exec->propertyNames().prototype, JSUIEventPrototype::self(exec, globalObject), DontDelete | ReadOnly); } bool JSUIEventConstructor::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) { return getStaticValueSlot(exec, &JSUIEventConstructorTable, this, propertyName, slot); } bool JSUIEventConstructor::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) { return getStaticValueDescriptor(exec, &JSUIEventConstructorTable, this, propertyName, descriptor); } /* Hash table for prototype */ #if ENABLE(JIT) #define THUNK_GENERATOR(generator) , generator #else #define THUNK_GENERATOR(generator) #endif static const HashTableValue JSUIEventPrototypeTableValues[2] = { { "initUIEvent", DontDelete | Function, (intptr_t)static_cast(jsUIEventPrototypeFunctionInitUIEvent), (intptr_t)5 THUNK_GENERATOR(0) }, { 0, 0, 0, 0 THUNK_GENERATOR(0) } }; #undef THUNK_GENERATOR static JSC_CONST_HASHTABLE HashTable JSUIEventPrototypeTable = { 2, 1, JSUIEventPrototypeTableValues, 0 }; const ClassInfo JSUIEventPrototype::s_info = { "UIEventPrototype", &JSC::JSObjectWithGlobalObject::s_info, &JSUIEventPrototypeTable, 0 }; JSObject* JSUIEventPrototype::self(ExecState* exec, JSGlobalObject* globalObject) { return getDOMPrototype(exec, globalObject); } bool JSUIEventPrototype::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) { return getStaticFunctionSlot(exec, &JSUIEventPrototypeTable, this, propertyName, slot); } bool JSUIEventPrototype::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) { return getStaticFunctionDescriptor(exec, &JSUIEventPrototypeTable, this, propertyName, descriptor); } const ClassInfo JSUIEvent::s_info = { "UIEvent", &JSEvent::s_info, &JSUIEventTable, 0 }; JSUIEvent::JSUIEvent(Structure* structure, JSDOMGlobalObject* globalObject, PassRefPtr impl) : JSEvent(structure, globalObject, impl) { ASSERT(inherits(&s_info)); } JSObject* JSUIEvent::createPrototype(ExecState* exec, JSGlobalObject* globalObject) { return new (exec) JSUIEventPrototype(exec->globalData(), globalObject, JSUIEventPrototype::createStructure(exec->globalData(), JSEventPrototype::self(exec, globalObject))); } bool JSUIEvent::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) { return getStaticValueSlot(exec, &JSUIEventTable, this, propertyName, slot); } bool JSUIEvent::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) { return getStaticValueDescriptor(exec, &JSUIEventTable, this, propertyName, descriptor); } JSValue jsUIEventView(ExecState* exec, JSValue slotBase, const Identifier&) { JSUIEvent* castedThis = static_cast(asObject(slotBase)); UNUSED_PARAM(exec); UIEvent* imp = static_cast(castedThis->impl()); JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->view())); return result; } JSValue jsUIEventDetail(ExecState* exec, JSValue slotBase, const Identifier&) { JSUIEvent* castedThis = static_cast(asObject(slotBase)); UNUSED_PARAM(exec); UIEvent* imp = static_cast(castedThis->impl()); JSValue result = jsNumber(imp->detail()); return result; } JSValue jsUIEventKeyCode(ExecState* exec, JSValue slotBase, const Identifier&) { JSUIEvent* castedThis = static_cast(asObject(slotBase)); UNUSED_PARAM(exec); UIEvent* imp = static_cast(castedThis->impl()); JSValue result = jsNumber(imp->keyCode()); return result; } JSValue jsUIEventCharCode(ExecState* exec, JSValue slotBase, const Identifier&) { JSUIEvent* castedThis = static_cast(asObject(slotBase)); UNUSED_PARAM(exec); UIEvent* imp = static_cast(castedThis->impl()); JSValue result = jsNumber(imp->charCode()); return result; } JSValue jsUIEventLayerX(ExecState* exec, JSValue slotBase, const Identifier&) { JSUIEvent* castedThis = static_cast(asObject(slotBase)); UNUSED_PARAM(exec); UIEvent* imp = static_cast(castedThis->impl()); JSValue result = jsNumber(imp->layerX()); return result; } JSValue jsUIEventLayerY(ExecState* exec, JSValue slotBase, const Identifier&) { JSUIEvent* castedThis = static_cast(asObject(slotBase)); UNUSED_PARAM(exec); UIEvent* imp = static_cast(castedThis->impl()); JSValue result = jsNumber(imp->layerY()); return result; } JSValue jsUIEventPageX(ExecState* exec, JSValue slotBase, const Identifier&) { JSUIEvent* castedThis = static_cast(asObject(slotBase)); UNUSED_PARAM(exec); UIEvent* imp = static_cast(castedThis->impl()); JSValue result = jsNumber(imp->pageX()); return result; } JSValue jsUIEventPageY(ExecState* exec, JSValue slotBase, const Identifier&) { JSUIEvent* castedThis = static_cast(asObject(slotBase)); UNUSED_PARAM(exec); UIEvent* imp = static_cast(castedThis->impl()); JSValue result = jsNumber(imp->pageY()); return result; } JSValue jsUIEventWhich(ExecState* exec, JSValue slotBase, const Identifier&) { JSUIEvent* castedThis = static_cast(asObject(slotBase)); UNUSED_PARAM(exec); UIEvent* imp = static_cast(castedThis->impl()); JSValue result = jsNumber(imp->which()); return result; } JSValue jsUIEventConstructor(ExecState* exec, JSValue slotBase, const Identifier&) { JSUIEvent* domObject = static_cast(asObject(slotBase)); return JSUIEvent::getConstructor(exec, domObject->globalObject()); } JSValue JSUIEvent::getConstructor(ExecState* exec, JSGlobalObject* globalObject) { return getDOMConstructor(exec, static_cast(globalObject)); } EncodedJSValue JSC_HOST_CALL jsUIEventPrototypeFunctionInitUIEvent(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSUIEvent::s_info)) return throwVMTypeError(exec); JSUIEvent* castedThis = static_cast(asObject(thisValue)); UIEvent* imp = static_cast(castedThis->impl()); const String& type(ustringToString(exec->argument(0).toString(exec))); if (exec->hadException()) return JSValue::encode(jsUndefined()); bool canBubble(exec->argument(1).toBoolean(exec)); if (exec->hadException()) return JSValue::encode(jsUndefined()); bool cancelable(exec->argument(2).toBoolean(exec)); if (exec->hadException()) return JSValue::encode(jsUndefined()); DOMWindow* view(toDOMWindow(exec->argument(3))); if (exec->hadException()) return JSValue::encode(jsUndefined()); int detail(exec->argument(4).toInt32(exec)); if (exec->hadException()) return JSValue::encode(jsUndefined()); imp->initUIEvent(type, canBubble, cancelable, view, detail); return JSValue::encode(jsUndefined()); } }