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