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 "JSWheelEvent.h"
23 
24 #include "ExceptionCode.h"
25 #include "JSDOMBinding.h"
26 #include "JSDOMWindow.h"
27 #include "WheelEvent.h"
28 #include <runtime/Error.h>
29 #include <wtf/GetPtr.h>
30 
31 using namespace JSC;
32 
33 namespace WebCore {
34 
35 ASSERT_CLASS_FITS_IN_CELL(JSWheelEvent);
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 JSWheelEventTableValues[17] =
45 {
46     { "screenX", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsWheelEventScreenX), (intptr_t)0 THUNK_GENERATOR(0) },
47     { "screenY", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsWheelEventScreenY), (intptr_t)0 THUNK_GENERATOR(0) },
48     { "clientX", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsWheelEventClientX), (intptr_t)0 THUNK_GENERATOR(0) },
49     { "clientY", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsWheelEventClientY), (intptr_t)0 THUNK_GENERATOR(0) },
50     { "ctrlKey", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsWheelEventCtrlKey), (intptr_t)0 THUNK_GENERATOR(0) },
51     { "shiftKey", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsWheelEventShiftKey), (intptr_t)0 THUNK_GENERATOR(0) },
52     { "altKey", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsWheelEventAltKey), (intptr_t)0 THUNK_GENERATOR(0) },
53     { "metaKey", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsWheelEventMetaKey), (intptr_t)0 THUNK_GENERATOR(0) },
54     { "wheelDelta", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsWheelEventWheelDelta), (intptr_t)0 THUNK_GENERATOR(0) },
55     { "wheelDeltaX", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsWheelEventWheelDeltaX), (intptr_t)0 THUNK_GENERATOR(0) },
56     { "wheelDeltaY", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsWheelEventWheelDeltaY), (intptr_t)0 THUNK_GENERATOR(0) },
57     { "offsetX", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsWheelEventOffsetX), (intptr_t)0 THUNK_GENERATOR(0) },
58     { "offsetY", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsWheelEventOffsetY), (intptr_t)0 THUNK_GENERATOR(0) },
59     { "x", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsWheelEventX), (intptr_t)0 THUNK_GENERATOR(0) },
60     { "y", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsWheelEventY), (intptr_t)0 THUNK_GENERATOR(0) },
61     { "constructor", DontEnum | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsWheelEventConstructor), (intptr_t)0 THUNK_GENERATOR(0) },
62     { 0, 0, 0, 0 THUNK_GENERATOR(0) }
63 };
64 
65 #undef THUNK_GENERATOR
66 static JSC_CONST_HASHTABLE HashTable JSWheelEventTable = { 33, 31, JSWheelEventTableValues, 0 };
67 /* Hash table for constructor */
68 #if ENABLE(JIT)
69 #define THUNK_GENERATOR(generator) , generator
70 #else
71 #define THUNK_GENERATOR(generator)
72 #endif
73 
74 static const HashTableValue JSWheelEventConstructorTableValues[1] =
75 {
76     { 0, 0, 0, 0 THUNK_GENERATOR(0) }
77 };
78 
79 #undef THUNK_GENERATOR
80 static JSC_CONST_HASHTABLE HashTable JSWheelEventConstructorTable = { 1, 0, JSWheelEventConstructorTableValues, 0 };
81 class JSWheelEventConstructor : public DOMConstructorObject {
82 public:
83     JSWheelEventConstructor(JSC::ExecState*, JSC::Structure*, JSDOMGlobalObject*);
84 
85     virtual bool getOwnPropertySlot(JSC::ExecState*, const JSC::Identifier&, JSC::PropertySlot&);
86     virtual bool getOwnPropertyDescriptor(JSC::ExecState*, const JSC::Identifier&, JSC::PropertyDescriptor&);
87     static const JSC::ClassInfo s_info;
createStructure(JSC::JSGlobalData & globalData,JSC::JSValue prototype)88     static JSC::Structure* createStructure(JSC::JSGlobalData& globalData, JSC::JSValue prototype)
89     {
90         return JSC::Structure::create(globalData, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), AnonymousSlotCount, &s_info);
91     }
92 protected:
93     static const unsigned StructureFlags = JSC::OverridesGetOwnPropertySlot | JSC::ImplementsHasInstance | DOMConstructorObject::StructureFlags;
94 };
95 
96 const ClassInfo JSWheelEventConstructor::s_info = { "WheelEventConstructor", &DOMConstructorObject::s_info, &JSWheelEventConstructorTable, 0 };
97 
JSWheelEventConstructor(ExecState * exec,Structure * structure,JSDOMGlobalObject * globalObject)98 JSWheelEventConstructor::JSWheelEventConstructor(ExecState* exec, Structure* structure, JSDOMGlobalObject* globalObject)
99     : DOMConstructorObject(structure, globalObject)
100 {
101     ASSERT(inherits(&s_info));
102     putDirect(exec->globalData(), exec->propertyNames().prototype, JSWheelEventPrototype::self(exec, globalObject), DontDelete | ReadOnly);
103 }
104 
getOwnPropertySlot(ExecState * exec,const Identifier & propertyName,PropertySlot & slot)105 bool JSWheelEventConstructor::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
106 {
107     return getStaticValueSlot<JSWheelEventConstructor, JSDOMWrapper>(exec, &JSWheelEventConstructorTable, this, propertyName, slot);
108 }
109 
getOwnPropertyDescriptor(ExecState * exec,const Identifier & propertyName,PropertyDescriptor & descriptor)110 bool JSWheelEventConstructor::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
111 {
112     return getStaticValueDescriptor<JSWheelEventConstructor, JSDOMWrapper>(exec, &JSWheelEventConstructorTable, this, propertyName, descriptor);
113 }
114 
115 /* Hash table for prototype */
116 #if ENABLE(JIT)
117 #define THUNK_GENERATOR(generator) , generator
118 #else
119 #define THUNK_GENERATOR(generator)
120 #endif
121 
122 static const HashTableValue JSWheelEventPrototypeTableValues[2] =
123 {
124     { "initWebKitWheelEvent", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsWheelEventPrototypeFunctionInitWebKitWheelEvent), (intptr_t)11 THUNK_GENERATOR(0) },
125     { 0, 0, 0, 0 THUNK_GENERATOR(0) }
126 };
127 
128 #undef THUNK_GENERATOR
129 static JSC_CONST_HASHTABLE HashTable JSWheelEventPrototypeTable = { 2, 1, JSWheelEventPrototypeTableValues, 0 };
130 const ClassInfo JSWheelEventPrototype::s_info = { "WheelEventPrototype", &JSC::JSObjectWithGlobalObject::s_info, &JSWheelEventPrototypeTable, 0 };
131 
self(ExecState * exec,JSGlobalObject * globalObject)132 JSObject* JSWheelEventPrototype::self(ExecState* exec, JSGlobalObject* globalObject)
133 {
134     return getDOMPrototype<JSWheelEvent>(exec, globalObject);
135 }
136 
getOwnPropertySlot(ExecState * exec,const Identifier & propertyName,PropertySlot & slot)137 bool JSWheelEventPrototype::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
138 {
139     return getStaticFunctionSlot<JSObject>(exec, &JSWheelEventPrototypeTable, this, propertyName, slot);
140 }
141 
getOwnPropertyDescriptor(ExecState * exec,const Identifier & propertyName,PropertyDescriptor & descriptor)142 bool JSWheelEventPrototype::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
143 {
144     return getStaticFunctionDescriptor<JSObject>(exec, &JSWheelEventPrototypeTable, this, propertyName, descriptor);
145 }
146 
147 const ClassInfo JSWheelEvent::s_info = { "WheelEvent", &JSUIEvent::s_info, &JSWheelEventTable, 0 };
148 
JSWheelEvent(Structure * structure,JSDOMGlobalObject * globalObject,PassRefPtr<WheelEvent> impl)149 JSWheelEvent::JSWheelEvent(Structure* structure, JSDOMGlobalObject* globalObject, PassRefPtr<WheelEvent> impl)
150     : JSUIEvent(structure, globalObject, impl)
151 {
152     ASSERT(inherits(&s_info));
153 }
154 
createPrototype(ExecState * exec,JSGlobalObject * globalObject)155 JSObject* JSWheelEvent::createPrototype(ExecState* exec, JSGlobalObject* globalObject)
156 {
157     return new (exec) JSWheelEventPrototype(exec->globalData(), globalObject, JSWheelEventPrototype::createStructure(exec->globalData(), JSUIEventPrototype::self(exec, globalObject)));
158 }
159 
getOwnPropertySlot(ExecState * exec,const Identifier & propertyName,PropertySlot & slot)160 bool JSWheelEvent::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
161 {
162     return getStaticValueSlot<JSWheelEvent, Base>(exec, &JSWheelEventTable, this, propertyName, slot);
163 }
164 
getOwnPropertyDescriptor(ExecState * exec,const Identifier & propertyName,PropertyDescriptor & descriptor)165 bool JSWheelEvent::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
166 {
167     return getStaticValueDescriptor<JSWheelEvent, Base>(exec, &JSWheelEventTable, this, propertyName, descriptor);
168 }
169 
jsWheelEventScreenX(ExecState * exec,JSValue slotBase,const Identifier &)170 JSValue jsWheelEventScreenX(ExecState* exec, JSValue slotBase, const Identifier&)
171 {
172     JSWheelEvent* castedThis = static_cast<JSWheelEvent*>(asObject(slotBase));
173     UNUSED_PARAM(exec);
174     WheelEvent* imp = static_cast<WheelEvent*>(castedThis->impl());
175     JSValue result = jsNumber(imp->screenX());
176     return result;
177 }
178 
179 
jsWheelEventScreenY(ExecState * exec,JSValue slotBase,const Identifier &)180 JSValue jsWheelEventScreenY(ExecState* exec, JSValue slotBase, const Identifier&)
181 {
182     JSWheelEvent* castedThis = static_cast<JSWheelEvent*>(asObject(slotBase));
183     UNUSED_PARAM(exec);
184     WheelEvent* imp = static_cast<WheelEvent*>(castedThis->impl());
185     JSValue result = jsNumber(imp->screenY());
186     return result;
187 }
188 
189 
jsWheelEventClientX(ExecState * exec,JSValue slotBase,const Identifier &)190 JSValue jsWheelEventClientX(ExecState* exec, JSValue slotBase, const Identifier&)
191 {
192     JSWheelEvent* castedThis = static_cast<JSWheelEvent*>(asObject(slotBase));
193     UNUSED_PARAM(exec);
194     WheelEvent* imp = static_cast<WheelEvent*>(castedThis->impl());
195     JSValue result = jsNumber(imp->clientX());
196     return result;
197 }
198 
199 
jsWheelEventClientY(ExecState * exec,JSValue slotBase,const Identifier &)200 JSValue jsWheelEventClientY(ExecState* exec, JSValue slotBase, const Identifier&)
201 {
202     JSWheelEvent* castedThis = static_cast<JSWheelEvent*>(asObject(slotBase));
203     UNUSED_PARAM(exec);
204     WheelEvent* imp = static_cast<WheelEvent*>(castedThis->impl());
205     JSValue result = jsNumber(imp->clientY());
206     return result;
207 }
208 
209 
jsWheelEventCtrlKey(ExecState * exec,JSValue slotBase,const Identifier &)210 JSValue jsWheelEventCtrlKey(ExecState* exec, JSValue slotBase, const Identifier&)
211 {
212     JSWheelEvent* castedThis = static_cast<JSWheelEvent*>(asObject(slotBase));
213     UNUSED_PARAM(exec);
214     WheelEvent* imp = static_cast<WheelEvent*>(castedThis->impl());
215     JSValue result = jsBoolean(imp->ctrlKey());
216     return result;
217 }
218 
219 
jsWheelEventShiftKey(ExecState * exec,JSValue slotBase,const Identifier &)220 JSValue jsWheelEventShiftKey(ExecState* exec, JSValue slotBase, const Identifier&)
221 {
222     JSWheelEvent* castedThis = static_cast<JSWheelEvent*>(asObject(slotBase));
223     UNUSED_PARAM(exec);
224     WheelEvent* imp = static_cast<WheelEvent*>(castedThis->impl());
225     JSValue result = jsBoolean(imp->shiftKey());
226     return result;
227 }
228 
229 
jsWheelEventAltKey(ExecState * exec,JSValue slotBase,const Identifier &)230 JSValue jsWheelEventAltKey(ExecState* exec, JSValue slotBase, const Identifier&)
231 {
232     JSWheelEvent* castedThis = static_cast<JSWheelEvent*>(asObject(slotBase));
233     UNUSED_PARAM(exec);
234     WheelEvent* imp = static_cast<WheelEvent*>(castedThis->impl());
235     JSValue result = jsBoolean(imp->altKey());
236     return result;
237 }
238 
239 
jsWheelEventMetaKey(ExecState * exec,JSValue slotBase,const Identifier &)240 JSValue jsWheelEventMetaKey(ExecState* exec, JSValue slotBase, const Identifier&)
241 {
242     JSWheelEvent* castedThis = static_cast<JSWheelEvent*>(asObject(slotBase));
243     UNUSED_PARAM(exec);
244     WheelEvent* imp = static_cast<WheelEvent*>(castedThis->impl());
245     JSValue result = jsBoolean(imp->metaKey());
246     return result;
247 }
248 
249 
jsWheelEventWheelDelta(ExecState * exec,JSValue slotBase,const Identifier &)250 JSValue jsWheelEventWheelDelta(ExecState* exec, JSValue slotBase, const Identifier&)
251 {
252     JSWheelEvent* castedThis = static_cast<JSWheelEvent*>(asObject(slotBase));
253     UNUSED_PARAM(exec);
254     WheelEvent* imp = static_cast<WheelEvent*>(castedThis->impl());
255     JSValue result = jsNumber(imp->wheelDelta());
256     return result;
257 }
258 
259 
jsWheelEventWheelDeltaX(ExecState * exec,JSValue slotBase,const Identifier &)260 JSValue jsWheelEventWheelDeltaX(ExecState* exec, JSValue slotBase, const Identifier&)
261 {
262     JSWheelEvent* castedThis = static_cast<JSWheelEvent*>(asObject(slotBase));
263     UNUSED_PARAM(exec);
264     WheelEvent* imp = static_cast<WheelEvent*>(castedThis->impl());
265     JSValue result = jsNumber(imp->wheelDeltaX());
266     return result;
267 }
268 
269 
jsWheelEventWheelDeltaY(ExecState * exec,JSValue slotBase,const Identifier &)270 JSValue jsWheelEventWheelDeltaY(ExecState* exec, JSValue slotBase, const Identifier&)
271 {
272     JSWheelEvent* castedThis = static_cast<JSWheelEvent*>(asObject(slotBase));
273     UNUSED_PARAM(exec);
274     WheelEvent* imp = static_cast<WheelEvent*>(castedThis->impl());
275     JSValue result = jsNumber(imp->wheelDeltaY());
276     return result;
277 }
278 
279 
jsWheelEventOffsetX(ExecState * exec,JSValue slotBase,const Identifier &)280 JSValue jsWheelEventOffsetX(ExecState* exec, JSValue slotBase, const Identifier&)
281 {
282     JSWheelEvent* castedThis = static_cast<JSWheelEvent*>(asObject(slotBase));
283     UNUSED_PARAM(exec);
284     WheelEvent* imp = static_cast<WheelEvent*>(castedThis->impl());
285     JSValue result = jsNumber(imp->offsetX());
286     return result;
287 }
288 
289 
jsWheelEventOffsetY(ExecState * exec,JSValue slotBase,const Identifier &)290 JSValue jsWheelEventOffsetY(ExecState* exec, JSValue slotBase, const Identifier&)
291 {
292     JSWheelEvent* castedThis = static_cast<JSWheelEvent*>(asObject(slotBase));
293     UNUSED_PARAM(exec);
294     WheelEvent* imp = static_cast<WheelEvent*>(castedThis->impl());
295     JSValue result = jsNumber(imp->offsetY());
296     return result;
297 }
298 
299 
jsWheelEventX(ExecState * exec,JSValue slotBase,const Identifier &)300 JSValue jsWheelEventX(ExecState* exec, JSValue slotBase, const Identifier&)
301 {
302     JSWheelEvent* castedThis = static_cast<JSWheelEvent*>(asObject(slotBase));
303     UNUSED_PARAM(exec);
304     WheelEvent* imp = static_cast<WheelEvent*>(castedThis->impl());
305     JSValue result = jsNumber(imp->x());
306     return result;
307 }
308 
309 
jsWheelEventY(ExecState * exec,JSValue slotBase,const Identifier &)310 JSValue jsWheelEventY(ExecState* exec, JSValue slotBase, const Identifier&)
311 {
312     JSWheelEvent* castedThis = static_cast<JSWheelEvent*>(asObject(slotBase));
313     UNUSED_PARAM(exec);
314     WheelEvent* imp = static_cast<WheelEvent*>(castedThis->impl());
315     JSValue result = jsNumber(imp->y());
316     return result;
317 }
318 
319 
jsWheelEventConstructor(ExecState * exec,JSValue slotBase,const Identifier &)320 JSValue jsWheelEventConstructor(ExecState* exec, JSValue slotBase, const Identifier&)
321 {
322     JSWheelEvent* domObject = static_cast<JSWheelEvent*>(asObject(slotBase));
323     return JSWheelEvent::getConstructor(exec, domObject->globalObject());
324 }
325 
getConstructor(ExecState * exec,JSGlobalObject * globalObject)326 JSValue JSWheelEvent::getConstructor(ExecState* exec, JSGlobalObject* globalObject)
327 {
328     return getDOMConstructor<JSWheelEventConstructor>(exec, static_cast<JSDOMGlobalObject*>(globalObject));
329 }
330 
jsWheelEventPrototypeFunctionInitWebKitWheelEvent(ExecState * exec)331 EncodedJSValue JSC_HOST_CALL jsWheelEventPrototypeFunctionInitWebKitWheelEvent(ExecState* exec)
332 {
333     JSValue thisValue = exec->hostThisValue();
334     if (!thisValue.inherits(&JSWheelEvent::s_info))
335         return throwVMTypeError(exec);
336     JSWheelEvent* castedThis = static_cast<JSWheelEvent*>(asObject(thisValue));
337     WheelEvent* imp = static_cast<WheelEvent*>(castedThis->impl());
338     int wheelDeltaX(exec->argument(0).toInt32(exec));
339     if (exec->hadException())
340         return JSValue::encode(jsUndefined());
341     int wheelDeltaY(exec->argument(1).toInt32(exec));
342     if (exec->hadException())
343         return JSValue::encode(jsUndefined());
344     DOMWindow* view(toDOMWindow(exec->argument(2)));
345     if (exec->hadException())
346         return JSValue::encode(jsUndefined());
347     int screenX(exec->argument(3).toInt32(exec));
348     if (exec->hadException())
349         return JSValue::encode(jsUndefined());
350     int screenY(exec->argument(4).toInt32(exec));
351     if (exec->hadException())
352         return JSValue::encode(jsUndefined());
353     int clientX(exec->argument(5).toInt32(exec));
354     if (exec->hadException())
355         return JSValue::encode(jsUndefined());
356     int clientY(exec->argument(6).toInt32(exec));
357     if (exec->hadException())
358         return JSValue::encode(jsUndefined());
359     bool ctrlKey(exec->argument(7).toBoolean(exec));
360     if (exec->hadException())
361         return JSValue::encode(jsUndefined());
362     bool altKey(exec->argument(8).toBoolean(exec));
363     if (exec->hadException())
364         return JSValue::encode(jsUndefined());
365     bool shiftKey(exec->argument(9).toBoolean(exec));
366     if (exec->hadException())
367         return JSValue::encode(jsUndefined());
368     bool metaKey(exec->argument(10).toBoolean(exec));
369     if (exec->hadException())
370         return JSValue::encode(jsUndefined());
371 
372     imp->initWebKitWheelEvent(wheelDeltaX, wheelDeltaY, view, screenX, screenY, clientX, clientY, ctrlKey, altKey, shiftKey, metaKey);
373     return JSValue::encode(jsUndefined());
374 }
375 
376 
377 }
378