|
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 "JSMouseEvent.h" |
|
23 |
|
24 #include "Clipboard.h" |
|
25 #include "EventTarget.h" |
|
26 #include "JSClipboard.h" |
|
27 #include "JSDOMWindow.h" |
|
28 #include "JSEventTarget.h" |
|
29 #include "JSNode.h" |
|
30 #include "MouseEvent.h" |
|
31 #include "Node.h" |
|
32 #include <runtime/Error.h> |
|
33 #include <runtime/JSNumberCell.h> |
|
34 #include <wtf/GetPtr.h> |
|
35 |
|
36 using namespace JSC; |
|
37 |
|
38 namespace WebCore { |
|
39 |
|
40 ASSERT_CLASS_FITS_IN_CELL(JSMouseEvent); |
|
41 |
|
42 /* Hash table */ |
|
43 #if ENABLE(JIT) |
|
44 #define THUNK_GENERATOR(generator) , generator |
|
45 #else |
|
46 #define THUNK_GENERATOR(generator) |
|
47 #endif |
|
48 |
|
49 static const HashTableValue JSMouseEventTableValues[19] = |
|
50 { |
|
51 { "screenX", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsMouseEventScreenX), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
52 { "screenY", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsMouseEventScreenY), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
53 { "clientX", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsMouseEventClientX), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
54 { "clientY", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsMouseEventClientY), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
55 { "ctrlKey", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsMouseEventCtrlKey), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
56 { "shiftKey", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsMouseEventShiftKey), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
57 { "altKey", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsMouseEventAltKey), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
58 { "metaKey", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsMouseEventMetaKey), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
59 { "button", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsMouseEventButton), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
60 { "relatedTarget", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsMouseEventRelatedTarget), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
61 { "offsetX", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsMouseEventOffsetX), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
62 { "offsetY", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsMouseEventOffsetY), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
63 { "x", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsMouseEventX), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
64 { "y", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsMouseEventY), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
65 { "fromElement", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsMouseEventFromElement), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
66 { "toElement", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsMouseEventToElement), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
67 { "dataTransfer", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsMouseEventDataTransfer), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
68 { "constructor", DontEnum | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsMouseEventConstructor), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
69 { 0, 0, 0, 0 THUNK_GENERATOR(0) } |
|
70 }; |
|
71 |
|
72 #undef THUNK_GENERATOR |
|
73 static JSC_CONST_HASHTABLE HashTable JSMouseEventTable = { 65, 63, JSMouseEventTableValues, 0 }; |
|
74 /* Hash table for constructor */ |
|
75 #if ENABLE(JIT) |
|
76 #define THUNK_GENERATOR(generator) , generator |
|
77 #else |
|
78 #define THUNK_GENERATOR(generator) |
|
79 #endif |
|
80 |
|
81 static const HashTableValue JSMouseEventConstructorTableValues[1] = |
|
82 { |
|
83 { 0, 0, 0, 0 THUNK_GENERATOR(0) } |
|
84 }; |
|
85 |
|
86 #undef THUNK_GENERATOR |
|
87 static JSC_CONST_HASHTABLE HashTable JSMouseEventConstructorTable = { 1, 0, JSMouseEventConstructorTableValues, 0 }; |
|
88 class JSMouseEventConstructor : public DOMConstructorObject { |
|
89 public: |
|
90 JSMouseEventConstructor(JSC::ExecState*, JSDOMGlobalObject*); |
|
91 |
|
92 virtual bool getOwnPropertySlot(JSC::ExecState*, const JSC::Identifier&, JSC::PropertySlot&); |
|
93 virtual bool getOwnPropertyDescriptor(JSC::ExecState*, const JSC::Identifier&, JSC::PropertyDescriptor&); |
|
94 virtual const JSC::ClassInfo* classInfo() const { return &s_info; } |
|
95 static const JSC::ClassInfo s_info; |
|
96 static PassRefPtr<JSC::Structure> createStructure(JSC::JSValue prototype) |
|
97 { |
|
98 return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), AnonymousSlotCount); |
|
99 } |
|
100 protected: |
|
101 static const unsigned StructureFlags = JSC::OverridesGetOwnPropertySlot | JSC::ImplementsHasInstance | DOMConstructorObject::StructureFlags; |
|
102 }; |
|
103 |
|
104 const ClassInfo JSMouseEventConstructor::s_info = { "MouseEventConstructor", 0, &JSMouseEventConstructorTable, 0 }; |
|
105 |
|
106 JSMouseEventConstructor::JSMouseEventConstructor(ExecState* exec, JSDOMGlobalObject* globalObject) |
|
107 : DOMConstructorObject(JSMouseEventConstructor::createStructure(globalObject->objectPrototype()), globalObject) |
|
108 { |
|
109 putDirect(exec->propertyNames().prototype, JSMouseEventPrototype::self(exec, globalObject), DontDelete | ReadOnly); |
|
110 } |
|
111 |
|
112 bool JSMouseEventConstructor::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) |
|
113 { |
|
114 return getStaticValueSlot<JSMouseEventConstructor, DOMObject>(exec, &JSMouseEventConstructorTable, this, propertyName, slot); |
|
115 } |
|
116 |
|
117 bool JSMouseEventConstructor::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) |
|
118 { |
|
119 return getStaticValueDescriptor<JSMouseEventConstructor, DOMObject>(exec, &JSMouseEventConstructorTable, this, propertyName, descriptor); |
|
120 } |
|
121 |
|
122 /* Hash table for prototype */ |
|
123 #if ENABLE(JIT) |
|
124 #define THUNK_GENERATOR(generator) , generator |
|
125 #else |
|
126 #define THUNK_GENERATOR(generator) |
|
127 #endif |
|
128 |
|
129 static const HashTableValue JSMouseEventPrototypeTableValues[2] = |
|
130 { |
|
131 { "initMouseEvent", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsMouseEventPrototypeFunctionInitMouseEvent), (intptr_t)15 THUNK_GENERATOR(0) }, |
|
132 { 0, 0, 0, 0 THUNK_GENERATOR(0) } |
|
133 }; |
|
134 |
|
135 #undef THUNK_GENERATOR |
|
136 static JSC_CONST_HASHTABLE HashTable JSMouseEventPrototypeTable = { 2, 1, JSMouseEventPrototypeTableValues, 0 }; |
|
137 const ClassInfo JSMouseEventPrototype::s_info = { "MouseEventPrototype", 0, &JSMouseEventPrototypeTable, 0 }; |
|
138 |
|
139 JSObject* JSMouseEventPrototype::self(ExecState* exec, JSGlobalObject* globalObject) |
|
140 { |
|
141 return getDOMPrototype<JSMouseEvent>(exec, globalObject); |
|
142 } |
|
143 |
|
144 bool JSMouseEventPrototype::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) |
|
145 { |
|
146 return getStaticFunctionSlot<JSObject>(exec, &JSMouseEventPrototypeTable, this, propertyName, slot); |
|
147 } |
|
148 |
|
149 bool JSMouseEventPrototype::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) |
|
150 { |
|
151 return getStaticFunctionDescriptor<JSObject>(exec, &JSMouseEventPrototypeTable, this, propertyName, descriptor); |
|
152 } |
|
153 |
|
154 const ClassInfo JSMouseEvent::s_info = { "MouseEvent", &JSUIEvent::s_info, &JSMouseEventTable, 0 }; |
|
155 |
|
156 JSMouseEvent::JSMouseEvent(NonNullPassRefPtr<Structure> structure, JSDOMGlobalObject* globalObject, PassRefPtr<MouseEvent> impl) |
|
157 : JSUIEvent(structure, globalObject, impl) |
|
158 { |
|
159 } |
|
160 |
|
161 JSObject* JSMouseEvent::createPrototype(ExecState* exec, JSGlobalObject* globalObject) |
|
162 { |
|
163 return new (exec) JSMouseEventPrototype(globalObject, JSMouseEventPrototype::createStructure(JSUIEventPrototype::self(exec, globalObject))); |
|
164 } |
|
165 |
|
166 bool JSMouseEvent::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) |
|
167 { |
|
168 return getStaticValueSlot<JSMouseEvent, Base>(exec, &JSMouseEventTable, this, propertyName, slot); |
|
169 } |
|
170 |
|
171 bool JSMouseEvent::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) |
|
172 { |
|
173 return getStaticValueDescriptor<JSMouseEvent, Base>(exec, &JSMouseEventTable, this, propertyName, descriptor); |
|
174 } |
|
175 |
|
176 JSValue jsMouseEventScreenX(ExecState* exec, JSValue slotBase, const Identifier&) |
|
177 { |
|
178 JSMouseEvent* castedThis = static_cast<JSMouseEvent*>(asObject(slotBase)); |
|
179 UNUSED_PARAM(exec); |
|
180 MouseEvent* imp = static_cast<MouseEvent*>(castedThis->impl()); |
|
181 JSValue result = jsNumber(exec, imp->screenX()); |
|
182 return result; |
|
183 } |
|
184 |
|
185 JSValue jsMouseEventScreenY(ExecState* exec, JSValue slotBase, const Identifier&) |
|
186 { |
|
187 JSMouseEvent* castedThis = static_cast<JSMouseEvent*>(asObject(slotBase)); |
|
188 UNUSED_PARAM(exec); |
|
189 MouseEvent* imp = static_cast<MouseEvent*>(castedThis->impl()); |
|
190 JSValue result = jsNumber(exec, imp->screenY()); |
|
191 return result; |
|
192 } |
|
193 |
|
194 JSValue jsMouseEventClientX(ExecState* exec, JSValue slotBase, const Identifier&) |
|
195 { |
|
196 JSMouseEvent* castedThis = static_cast<JSMouseEvent*>(asObject(slotBase)); |
|
197 UNUSED_PARAM(exec); |
|
198 MouseEvent* imp = static_cast<MouseEvent*>(castedThis->impl()); |
|
199 JSValue result = jsNumber(exec, imp->clientX()); |
|
200 return result; |
|
201 } |
|
202 |
|
203 JSValue jsMouseEventClientY(ExecState* exec, JSValue slotBase, const Identifier&) |
|
204 { |
|
205 JSMouseEvent* castedThis = static_cast<JSMouseEvent*>(asObject(slotBase)); |
|
206 UNUSED_PARAM(exec); |
|
207 MouseEvent* imp = static_cast<MouseEvent*>(castedThis->impl()); |
|
208 JSValue result = jsNumber(exec, imp->clientY()); |
|
209 return result; |
|
210 } |
|
211 |
|
212 JSValue jsMouseEventCtrlKey(ExecState* exec, JSValue slotBase, const Identifier&) |
|
213 { |
|
214 JSMouseEvent* castedThis = static_cast<JSMouseEvent*>(asObject(slotBase)); |
|
215 UNUSED_PARAM(exec); |
|
216 MouseEvent* imp = static_cast<MouseEvent*>(castedThis->impl()); |
|
217 JSValue result = jsBoolean(imp->ctrlKey()); |
|
218 return result; |
|
219 } |
|
220 |
|
221 JSValue jsMouseEventShiftKey(ExecState* exec, JSValue slotBase, const Identifier&) |
|
222 { |
|
223 JSMouseEvent* castedThis = static_cast<JSMouseEvent*>(asObject(slotBase)); |
|
224 UNUSED_PARAM(exec); |
|
225 MouseEvent* imp = static_cast<MouseEvent*>(castedThis->impl()); |
|
226 JSValue result = jsBoolean(imp->shiftKey()); |
|
227 return result; |
|
228 } |
|
229 |
|
230 JSValue jsMouseEventAltKey(ExecState* exec, JSValue slotBase, const Identifier&) |
|
231 { |
|
232 JSMouseEvent* castedThis = static_cast<JSMouseEvent*>(asObject(slotBase)); |
|
233 UNUSED_PARAM(exec); |
|
234 MouseEvent* imp = static_cast<MouseEvent*>(castedThis->impl()); |
|
235 JSValue result = jsBoolean(imp->altKey()); |
|
236 return result; |
|
237 } |
|
238 |
|
239 JSValue jsMouseEventMetaKey(ExecState* exec, JSValue slotBase, const Identifier&) |
|
240 { |
|
241 JSMouseEvent* castedThis = static_cast<JSMouseEvent*>(asObject(slotBase)); |
|
242 UNUSED_PARAM(exec); |
|
243 MouseEvent* imp = static_cast<MouseEvent*>(castedThis->impl()); |
|
244 JSValue result = jsBoolean(imp->metaKey()); |
|
245 return result; |
|
246 } |
|
247 |
|
248 JSValue jsMouseEventButton(ExecState* exec, JSValue slotBase, const Identifier&) |
|
249 { |
|
250 JSMouseEvent* castedThis = static_cast<JSMouseEvent*>(asObject(slotBase)); |
|
251 UNUSED_PARAM(exec); |
|
252 MouseEvent* imp = static_cast<MouseEvent*>(castedThis->impl()); |
|
253 JSValue result = jsNumber(exec, imp->button()); |
|
254 return result; |
|
255 } |
|
256 |
|
257 JSValue jsMouseEventRelatedTarget(ExecState* exec, JSValue slotBase, const Identifier&) |
|
258 { |
|
259 JSMouseEvent* castedThis = static_cast<JSMouseEvent*>(asObject(slotBase)); |
|
260 UNUSED_PARAM(exec); |
|
261 MouseEvent* imp = static_cast<MouseEvent*>(castedThis->impl()); |
|
262 JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->relatedTarget())); |
|
263 return result; |
|
264 } |
|
265 |
|
266 JSValue jsMouseEventOffsetX(ExecState* exec, JSValue slotBase, const Identifier&) |
|
267 { |
|
268 JSMouseEvent* castedThis = static_cast<JSMouseEvent*>(asObject(slotBase)); |
|
269 UNUSED_PARAM(exec); |
|
270 MouseEvent* imp = static_cast<MouseEvent*>(castedThis->impl()); |
|
271 JSValue result = jsNumber(exec, imp->offsetX()); |
|
272 return result; |
|
273 } |
|
274 |
|
275 JSValue jsMouseEventOffsetY(ExecState* exec, JSValue slotBase, const Identifier&) |
|
276 { |
|
277 JSMouseEvent* castedThis = static_cast<JSMouseEvent*>(asObject(slotBase)); |
|
278 UNUSED_PARAM(exec); |
|
279 MouseEvent* imp = static_cast<MouseEvent*>(castedThis->impl()); |
|
280 JSValue result = jsNumber(exec, imp->offsetY()); |
|
281 return result; |
|
282 } |
|
283 |
|
284 JSValue jsMouseEventX(ExecState* exec, JSValue slotBase, const Identifier&) |
|
285 { |
|
286 JSMouseEvent* castedThis = static_cast<JSMouseEvent*>(asObject(slotBase)); |
|
287 UNUSED_PARAM(exec); |
|
288 MouseEvent* imp = static_cast<MouseEvent*>(castedThis->impl()); |
|
289 JSValue result = jsNumber(exec, imp->x()); |
|
290 return result; |
|
291 } |
|
292 |
|
293 JSValue jsMouseEventY(ExecState* exec, JSValue slotBase, const Identifier&) |
|
294 { |
|
295 JSMouseEvent* castedThis = static_cast<JSMouseEvent*>(asObject(slotBase)); |
|
296 UNUSED_PARAM(exec); |
|
297 MouseEvent* imp = static_cast<MouseEvent*>(castedThis->impl()); |
|
298 JSValue result = jsNumber(exec, imp->y()); |
|
299 return result; |
|
300 } |
|
301 |
|
302 JSValue jsMouseEventFromElement(ExecState* exec, JSValue slotBase, const Identifier&) |
|
303 { |
|
304 JSMouseEvent* castedThis = static_cast<JSMouseEvent*>(asObject(slotBase)); |
|
305 UNUSED_PARAM(exec); |
|
306 MouseEvent* imp = static_cast<MouseEvent*>(castedThis->impl()); |
|
307 JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->fromElement())); |
|
308 return result; |
|
309 } |
|
310 |
|
311 JSValue jsMouseEventToElement(ExecState* exec, JSValue slotBase, const Identifier&) |
|
312 { |
|
313 JSMouseEvent* castedThis = static_cast<JSMouseEvent*>(asObject(slotBase)); |
|
314 UNUSED_PARAM(exec); |
|
315 MouseEvent* imp = static_cast<MouseEvent*>(castedThis->impl()); |
|
316 JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->toElement())); |
|
317 return result; |
|
318 } |
|
319 |
|
320 JSValue jsMouseEventDataTransfer(ExecState* exec, JSValue slotBase, const Identifier&) |
|
321 { |
|
322 JSMouseEvent* castedThis = static_cast<JSMouseEvent*>(asObject(slotBase)); |
|
323 UNUSED_PARAM(exec); |
|
324 MouseEvent* imp = static_cast<MouseEvent*>(castedThis->impl()); |
|
325 JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->dataTransfer())); |
|
326 return result; |
|
327 } |
|
328 |
|
329 JSValue jsMouseEventConstructor(ExecState* exec, JSValue slotBase, const Identifier&) |
|
330 { |
|
331 JSMouseEvent* domObject = static_cast<JSMouseEvent*>(asObject(slotBase)); |
|
332 return JSMouseEvent::getConstructor(exec, domObject->globalObject()); |
|
333 } |
|
334 JSValue JSMouseEvent::getConstructor(ExecState* exec, JSGlobalObject* globalObject) |
|
335 { |
|
336 return getDOMConstructor<JSMouseEventConstructor>(exec, static_cast<JSDOMGlobalObject*>(globalObject)); |
|
337 } |
|
338 |
|
339 EncodedJSValue JSC_HOST_CALL jsMouseEventPrototypeFunctionInitMouseEvent(ExecState* exec) |
|
340 { |
|
341 JSValue thisValue = exec->hostThisValue(); |
|
342 if (!thisValue.inherits(&JSMouseEvent::s_info)) |
|
343 return throwVMTypeError(exec); |
|
344 JSMouseEvent* castedThis = static_cast<JSMouseEvent*>(asObject(thisValue)); |
|
345 MouseEvent* imp = static_cast<MouseEvent*>(castedThis->impl()); |
|
346 const String& type = ustringToString(exec->argument(0).toString(exec)); |
|
347 bool canBubble = exec->argument(1).toBoolean(exec); |
|
348 bool cancelable = exec->argument(2).toBoolean(exec); |
|
349 DOMWindow* view = toDOMWindow(exec->argument(3)); |
|
350 int detail = exec->argument(4).toInt32(exec); |
|
351 int screenX = exec->argument(5).toInt32(exec); |
|
352 int screenY = exec->argument(6).toInt32(exec); |
|
353 int clientX = exec->argument(7).toInt32(exec); |
|
354 int clientY = exec->argument(8).toInt32(exec); |
|
355 bool ctrlKey = exec->argument(9).toBoolean(exec); |
|
356 bool altKey = exec->argument(10).toBoolean(exec); |
|
357 bool shiftKey = exec->argument(11).toBoolean(exec); |
|
358 bool metaKey = exec->argument(12).toBoolean(exec); |
|
359 unsigned short button = exec->argument(13).toInt32(exec); |
|
360 EventTarget* relatedTarget = toEventTarget(exec->argument(14)); |
|
361 |
|
362 imp->initMouseEvent(type, canBubble, cancelable, view, detail, screenX, screenY, clientX, clientY, ctrlKey, altKey, shiftKey, metaKey, button, relatedTarget); |
|
363 return JSValue::encode(jsUndefined()); |
|
364 } |
|
365 |
|
366 |
|
367 } |