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 "JSDOMAttribute.h" |
25 | #include "JSDOMBinding.h" |
26 | #include "JSDOMConstructor.h" |
27 | #include "JSDOMConvertBoolean.h" |
28 | #include "JSDOMConvertInterface.h" |
29 | #include "JSDOMConvertNullable.h" |
30 | #include "JSDOMConvertNumbers.h" |
31 | #include "JSDOMConvertStrings.h" |
32 | #include "JSDOMExceptionHandling.h" |
33 | #include "JSDOMOperation.h" |
34 | #include "JSDOMWrapperCache.h" |
35 | #include "JSEventTarget.h" |
36 | #include "JSWindowProxy.h" |
37 | #include "ScriptExecutionContext.h" |
38 | #include <JavaScriptCore/HeapSnapshotBuilder.h> |
39 | #include <JavaScriptCore/JSCInlines.h> |
40 | #include <wtf/GetPtr.h> |
41 | #include <wtf/PointerPreparations.h> |
42 | #include <wtf/URL.h> |
43 | |
44 | |
45 | namespace WebCore { |
46 | using namespace JSC; |
47 | |
48 | template<> WheelEvent::Init convertDictionary<WheelEvent::Init>(ExecState& state, JSValue value) |
49 | { |
50 | VM& vm = state.vm(); |
51 | auto throwScope = DECLARE_THROW_SCOPE(vm); |
52 | bool isNullOrUndefined = value.isUndefinedOrNull(); |
53 | auto* object = isNullOrUndefined ? nullptr : value.getObject(); |
54 | if (UNLIKELY(!isNullOrUndefined && !object)) { |
55 | throwTypeError(&state, throwScope); |
56 | return { }; |
57 | } |
58 | WheelEvent::Init result; |
59 | JSValue bubblesValue; |
60 | if (isNullOrUndefined) |
61 | bubblesValue = jsUndefined(); |
62 | else { |
63 | bubblesValue = object->get(&state, Identifier::fromString(&state, "bubbles" )); |
64 | RETURN_IF_EXCEPTION(throwScope, { }); |
65 | } |
66 | if (!bubblesValue.isUndefined()) { |
67 | result.bubbles = convert<IDLBoolean>(state, bubblesValue); |
68 | RETURN_IF_EXCEPTION(throwScope, { }); |
69 | } else |
70 | result.bubbles = false; |
71 | JSValue cancelableValue; |
72 | if (isNullOrUndefined) |
73 | cancelableValue = jsUndefined(); |
74 | else { |
75 | cancelableValue = object->get(&state, Identifier::fromString(&state, "cancelable" )); |
76 | RETURN_IF_EXCEPTION(throwScope, { }); |
77 | } |
78 | if (!cancelableValue.isUndefined()) { |
79 | result.cancelable = convert<IDLBoolean>(state, cancelableValue); |
80 | RETURN_IF_EXCEPTION(throwScope, { }); |
81 | } else |
82 | result.cancelable = false; |
83 | JSValue composedValue; |
84 | if (isNullOrUndefined) |
85 | composedValue = jsUndefined(); |
86 | else { |
87 | composedValue = object->get(&state, Identifier::fromString(&state, "composed" )); |
88 | RETURN_IF_EXCEPTION(throwScope, { }); |
89 | } |
90 | if (!composedValue.isUndefined()) { |
91 | result.composed = convert<IDLBoolean>(state, composedValue); |
92 | RETURN_IF_EXCEPTION(throwScope, { }); |
93 | } else |
94 | result.composed = false; |
95 | JSValue detailValue; |
96 | if (isNullOrUndefined) |
97 | detailValue = jsUndefined(); |
98 | else { |
99 | detailValue = object->get(&state, Identifier::fromString(&state, "detail" )); |
100 | RETURN_IF_EXCEPTION(throwScope, { }); |
101 | } |
102 | if (!detailValue.isUndefined()) { |
103 | result.detail = convert<IDLLong>(state, detailValue); |
104 | RETURN_IF_EXCEPTION(throwScope, { }); |
105 | } else |
106 | result.detail = 0; |
107 | JSValue viewValue; |
108 | if (isNullOrUndefined) |
109 | viewValue = jsUndefined(); |
110 | else { |
111 | viewValue = object->get(&state, Identifier::fromString(&state, "view" )); |
112 | RETURN_IF_EXCEPTION(throwScope, { }); |
113 | } |
114 | if (!viewValue.isUndefined()) { |
115 | result.view = convert<IDLNullable<IDLInterface<WindowProxy>>>(state, viewValue); |
116 | RETURN_IF_EXCEPTION(throwScope, { }); |
117 | } else |
118 | result.view = nullptr; |
119 | JSValue altKeyValue; |
120 | if (isNullOrUndefined) |
121 | altKeyValue = jsUndefined(); |
122 | else { |
123 | altKeyValue = object->get(&state, Identifier::fromString(&state, "altKey" )); |
124 | RETURN_IF_EXCEPTION(throwScope, { }); |
125 | } |
126 | if (!altKeyValue.isUndefined()) { |
127 | result.altKey = convert<IDLBoolean>(state, altKeyValue); |
128 | RETURN_IF_EXCEPTION(throwScope, { }); |
129 | } else |
130 | result.altKey = false; |
131 | JSValue ctrlKeyValue; |
132 | if (isNullOrUndefined) |
133 | ctrlKeyValue = jsUndefined(); |
134 | else { |
135 | ctrlKeyValue = object->get(&state, Identifier::fromString(&state, "ctrlKey" )); |
136 | RETURN_IF_EXCEPTION(throwScope, { }); |
137 | } |
138 | if (!ctrlKeyValue.isUndefined()) { |
139 | result.ctrlKey = convert<IDLBoolean>(state, ctrlKeyValue); |
140 | RETURN_IF_EXCEPTION(throwScope, { }); |
141 | } else |
142 | result.ctrlKey = false; |
143 | JSValue metaKeyValue; |
144 | if (isNullOrUndefined) |
145 | metaKeyValue = jsUndefined(); |
146 | else { |
147 | metaKeyValue = object->get(&state, Identifier::fromString(&state, "metaKey" )); |
148 | RETURN_IF_EXCEPTION(throwScope, { }); |
149 | } |
150 | if (!metaKeyValue.isUndefined()) { |
151 | result.metaKey = convert<IDLBoolean>(state, metaKeyValue); |
152 | RETURN_IF_EXCEPTION(throwScope, { }); |
153 | } else |
154 | result.metaKey = false; |
155 | JSValue modifierAltGraphValue; |
156 | if (isNullOrUndefined) |
157 | modifierAltGraphValue = jsUndefined(); |
158 | else { |
159 | modifierAltGraphValue = object->get(&state, Identifier::fromString(&state, "modifierAltGraph" )); |
160 | RETURN_IF_EXCEPTION(throwScope, { }); |
161 | } |
162 | if (!modifierAltGraphValue.isUndefined()) { |
163 | result.modifierAltGraph = convert<IDLBoolean>(state, modifierAltGraphValue); |
164 | RETURN_IF_EXCEPTION(throwScope, { }); |
165 | } else |
166 | result.modifierAltGraph = false; |
167 | JSValue modifierCapsLockValue; |
168 | if (isNullOrUndefined) |
169 | modifierCapsLockValue = jsUndefined(); |
170 | else { |
171 | modifierCapsLockValue = object->get(&state, Identifier::fromString(&state, "modifierCapsLock" )); |
172 | RETURN_IF_EXCEPTION(throwScope, { }); |
173 | } |
174 | if (!modifierCapsLockValue.isUndefined()) { |
175 | result.modifierCapsLock = convert<IDLBoolean>(state, modifierCapsLockValue); |
176 | RETURN_IF_EXCEPTION(throwScope, { }); |
177 | } else |
178 | result.modifierCapsLock = false; |
179 | JSValue shiftKeyValue; |
180 | if (isNullOrUndefined) |
181 | shiftKeyValue = jsUndefined(); |
182 | else { |
183 | shiftKeyValue = object->get(&state, Identifier::fromString(&state, "shiftKey" )); |
184 | RETURN_IF_EXCEPTION(throwScope, { }); |
185 | } |
186 | if (!shiftKeyValue.isUndefined()) { |
187 | result.shiftKey = convert<IDLBoolean>(state, shiftKeyValue); |
188 | RETURN_IF_EXCEPTION(throwScope, { }); |
189 | } else |
190 | result.shiftKey = false; |
191 | JSValue buttonValue; |
192 | if (isNullOrUndefined) |
193 | buttonValue = jsUndefined(); |
194 | else { |
195 | buttonValue = object->get(&state, Identifier::fromString(&state, "button" )); |
196 | RETURN_IF_EXCEPTION(throwScope, { }); |
197 | } |
198 | if (!buttonValue.isUndefined()) { |
199 | result.button = convert<IDLUnsignedShort>(state, buttonValue); |
200 | RETURN_IF_EXCEPTION(throwScope, { }); |
201 | } else |
202 | result.button = 0; |
203 | JSValue buttonsValue; |
204 | if (isNullOrUndefined) |
205 | buttonsValue = jsUndefined(); |
206 | else { |
207 | buttonsValue = object->get(&state, Identifier::fromString(&state, "buttons" )); |
208 | RETURN_IF_EXCEPTION(throwScope, { }); |
209 | } |
210 | if (!buttonsValue.isUndefined()) { |
211 | result.buttons = convert<IDLUnsignedShort>(state, buttonsValue); |
212 | RETURN_IF_EXCEPTION(throwScope, { }); |
213 | } else |
214 | result.buttons = 0; |
215 | JSValue clientXValue; |
216 | if (isNullOrUndefined) |
217 | clientXValue = jsUndefined(); |
218 | else { |
219 | clientXValue = object->get(&state, Identifier::fromString(&state, "clientX" )); |
220 | RETURN_IF_EXCEPTION(throwScope, { }); |
221 | } |
222 | if (!clientXValue.isUndefined()) { |
223 | result.clientX = convert<IDLLong>(state, clientXValue); |
224 | RETURN_IF_EXCEPTION(throwScope, { }); |
225 | } else |
226 | result.clientX = 0; |
227 | JSValue clientYValue; |
228 | if (isNullOrUndefined) |
229 | clientYValue = jsUndefined(); |
230 | else { |
231 | clientYValue = object->get(&state, Identifier::fromString(&state, "clientY" )); |
232 | RETURN_IF_EXCEPTION(throwScope, { }); |
233 | } |
234 | if (!clientYValue.isUndefined()) { |
235 | result.clientY = convert<IDLLong>(state, clientYValue); |
236 | RETURN_IF_EXCEPTION(throwScope, { }); |
237 | } else |
238 | result.clientY = 0; |
239 | JSValue relatedTargetValue; |
240 | if (isNullOrUndefined) |
241 | relatedTargetValue = jsUndefined(); |
242 | else { |
243 | relatedTargetValue = object->get(&state, Identifier::fromString(&state, "relatedTarget" )); |
244 | RETURN_IF_EXCEPTION(throwScope, { }); |
245 | } |
246 | if (!relatedTargetValue.isUndefined()) { |
247 | result.relatedTarget = convert<IDLNullable<IDLInterface<EventTarget>>>(state, relatedTargetValue); |
248 | RETURN_IF_EXCEPTION(throwScope, { }); |
249 | } else |
250 | result.relatedTarget = nullptr; |
251 | JSValue screenXValue; |
252 | if (isNullOrUndefined) |
253 | screenXValue = jsUndefined(); |
254 | else { |
255 | screenXValue = object->get(&state, Identifier::fromString(&state, "screenX" )); |
256 | RETURN_IF_EXCEPTION(throwScope, { }); |
257 | } |
258 | if (!screenXValue.isUndefined()) { |
259 | result.screenX = convert<IDLLong>(state, screenXValue); |
260 | RETURN_IF_EXCEPTION(throwScope, { }); |
261 | } else |
262 | result.screenX = 0; |
263 | JSValue screenYValue; |
264 | if (isNullOrUndefined) |
265 | screenYValue = jsUndefined(); |
266 | else { |
267 | screenYValue = object->get(&state, Identifier::fromString(&state, "screenY" )); |
268 | RETURN_IF_EXCEPTION(throwScope, { }); |
269 | } |
270 | if (!screenYValue.isUndefined()) { |
271 | result.screenY = convert<IDLLong>(state, screenYValue); |
272 | RETURN_IF_EXCEPTION(throwScope, { }); |
273 | } else |
274 | result.screenY = 0; |
275 | JSValue deltaModeValue; |
276 | if (isNullOrUndefined) |
277 | deltaModeValue = jsUndefined(); |
278 | else { |
279 | deltaModeValue = object->get(&state, Identifier::fromString(&state, "deltaMode" )); |
280 | RETURN_IF_EXCEPTION(throwScope, { }); |
281 | } |
282 | if (!deltaModeValue.isUndefined()) { |
283 | result.deltaMode = convert<IDLUnsignedLong>(state, deltaModeValue); |
284 | RETURN_IF_EXCEPTION(throwScope, { }); |
285 | } else |
286 | result.deltaMode = 0; |
287 | JSValue deltaXValue; |
288 | if (isNullOrUndefined) |
289 | deltaXValue = jsUndefined(); |
290 | else { |
291 | deltaXValue = object->get(&state, Identifier::fromString(&state, "deltaX" )); |
292 | RETURN_IF_EXCEPTION(throwScope, { }); |
293 | } |
294 | if (!deltaXValue.isUndefined()) { |
295 | result.deltaX = convert<IDLDouble>(state, deltaXValue); |
296 | RETURN_IF_EXCEPTION(throwScope, { }); |
297 | } else |
298 | result.deltaX = 0.0; |
299 | JSValue deltaYValue; |
300 | if (isNullOrUndefined) |
301 | deltaYValue = jsUndefined(); |
302 | else { |
303 | deltaYValue = object->get(&state, Identifier::fromString(&state, "deltaY" )); |
304 | RETURN_IF_EXCEPTION(throwScope, { }); |
305 | } |
306 | if (!deltaYValue.isUndefined()) { |
307 | result.deltaY = convert<IDLDouble>(state, deltaYValue); |
308 | RETURN_IF_EXCEPTION(throwScope, { }); |
309 | } else |
310 | result.deltaY = 0.0; |
311 | JSValue deltaZValue; |
312 | if (isNullOrUndefined) |
313 | deltaZValue = jsUndefined(); |
314 | else { |
315 | deltaZValue = object->get(&state, Identifier::fromString(&state, "deltaZ" )); |
316 | RETURN_IF_EXCEPTION(throwScope, { }); |
317 | } |
318 | if (!deltaZValue.isUndefined()) { |
319 | result.deltaZ = convert<IDLDouble>(state, deltaZValue); |
320 | RETURN_IF_EXCEPTION(throwScope, { }); |
321 | } else |
322 | result.deltaZ = 0.0; |
323 | JSValue wheelDeltaXValue; |
324 | if (isNullOrUndefined) |
325 | wheelDeltaXValue = jsUndefined(); |
326 | else { |
327 | wheelDeltaXValue = object->get(&state, Identifier::fromString(&state, "wheelDeltaX" )); |
328 | RETURN_IF_EXCEPTION(throwScope, { }); |
329 | } |
330 | if (!wheelDeltaXValue.isUndefined()) { |
331 | result.wheelDeltaX = convert<IDLLong>(state, wheelDeltaXValue); |
332 | RETURN_IF_EXCEPTION(throwScope, { }); |
333 | } else |
334 | result.wheelDeltaX = 0; |
335 | JSValue wheelDeltaYValue; |
336 | if (isNullOrUndefined) |
337 | wheelDeltaYValue = jsUndefined(); |
338 | else { |
339 | wheelDeltaYValue = object->get(&state, Identifier::fromString(&state, "wheelDeltaY" )); |
340 | RETURN_IF_EXCEPTION(throwScope, { }); |
341 | } |
342 | if (!wheelDeltaYValue.isUndefined()) { |
343 | result.wheelDeltaY = convert<IDLLong>(state, wheelDeltaYValue); |
344 | RETURN_IF_EXCEPTION(throwScope, { }); |
345 | } else |
346 | result.wheelDeltaY = 0; |
347 | return result; |
348 | } |
349 | |
350 | // Functions |
351 | |
352 | JSC::EncodedJSValue JSC_HOST_CALL jsWheelEventPrototypeFunctionInitWebKitWheelEvent(JSC::ExecState*); |
353 | |
354 | // Attributes |
355 | |
356 | JSC::EncodedJSValue jsWheelEventConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
357 | bool setJSWheelEventConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
358 | JSC::EncodedJSValue jsWheelEventDeltaX(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
359 | JSC::EncodedJSValue jsWheelEventDeltaY(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
360 | JSC::EncodedJSValue jsWheelEventDeltaZ(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
361 | JSC::EncodedJSValue jsWheelEventDeltaMode(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
362 | JSC::EncodedJSValue jsWheelEventWheelDeltaX(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
363 | JSC::EncodedJSValue jsWheelEventWheelDeltaY(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
364 | JSC::EncodedJSValue jsWheelEventWheelDelta(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
365 | JSC::EncodedJSValue jsWheelEventWebkitDirectionInvertedFromDevice(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
366 | |
367 | class JSWheelEventPrototype : public JSC::JSNonFinalObject { |
368 | public: |
369 | using Base = JSC::JSNonFinalObject; |
370 | static JSWheelEventPrototype* create(JSC::VM& vm, JSDOMGlobalObject* globalObject, JSC::Structure* structure) |
371 | { |
372 | JSWheelEventPrototype* ptr = new (NotNull, JSC::allocateCell<JSWheelEventPrototype>(vm.heap)) JSWheelEventPrototype(vm, globalObject, structure); |
373 | ptr->finishCreation(vm); |
374 | return ptr; |
375 | } |
376 | |
377 | DECLARE_INFO; |
378 | static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) |
379 | { |
380 | return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); |
381 | } |
382 | |
383 | private: |
384 | JSWheelEventPrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure) |
385 | : JSC::JSNonFinalObject(vm, structure) |
386 | { |
387 | } |
388 | |
389 | void finishCreation(JSC::VM&); |
390 | }; |
391 | |
392 | using JSWheelEventConstructor = JSDOMConstructor<JSWheelEvent>; |
393 | |
394 | /* Hash table for constructor */ |
395 | |
396 | static const HashTableValue JSWheelEventConstructorTableValues[] = |
397 | { |
398 | { "DOM_DELTA_PIXEL" , JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(0x00) } }, |
399 | { "DOM_DELTA_LINE" , JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(0x01) } }, |
400 | { "DOM_DELTA_PAGE" , JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(0x02) } }, |
401 | }; |
402 | |
403 | static_assert(WheelEvent::DOM_DELTA_PIXEL == 0x00, "DOM_DELTA_PIXEL in WheelEvent does not match value from IDL" ); |
404 | static_assert(WheelEvent::DOM_DELTA_LINE == 0x01, "DOM_DELTA_LINE in WheelEvent does not match value from IDL" ); |
405 | static_assert(WheelEvent::DOM_DELTA_PAGE == 0x02, "DOM_DELTA_PAGE in WheelEvent does not match value from IDL" ); |
406 | |
407 | template<> EncodedJSValue JSC_HOST_CALL JSWheelEventConstructor::construct(ExecState* state) |
408 | { |
409 | VM& vm = state->vm(); |
410 | auto throwScope = DECLARE_THROW_SCOPE(vm); |
411 | UNUSED_PARAM(throwScope); |
412 | auto* castedThis = jsCast<JSWheelEventConstructor*>(state->jsCallee()); |
413 | ASSERT(castedThis); |
414 | if (UNLIKELY(state->argumentCount() < 1)) |
415 | return throwVMError(state, throwScope, createNotEnoughArgumentsError(state)); |
416 | auto type = convert<IDLDOMString>(*state, state->uncheckedArgument(0)); |
417 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
418 | auto eventInitDict = convert<IDLDictionary<WheelEvent::Init>>(*state, state->argument(1)); |
419 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
420 | auto object = WheelEvent::create(WTFMove(type), WTFMove(eventInitDict)); |
421 | return JSValue::encode(toJSNewlyCreated<IDLInterface<WheelEvent>>(*state, *castedThis->globalObject(), WTFMove(object))); |
422 | } |
423 | |
424 | template<> JSValue JSWheelEventConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject) |
425 | { |
426 | return JSMouseEvent::getConstructor(vm, &globalObject); |
427 | } |
428 | |
429 | template<> void JSWheelEventConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject) |
430 | { |
431 | putDirect(vm, vm.propertyNames->prototype, JSWheelEvent::prototype(vm, globalObject), JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
432 | putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String("WheelEvent"_s )), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
433 | putDirect(vm, vm.propertyNames->length, jsNumber(1), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
434 | reifyStaticProperties(vm, JSWheelEvent::info(), JSWheelEventConstructorTableValues, *this); |
435 | } |
436 | |
437 | template<> const ClassInfo JSWheelEventConstructor::s_info = { "WheelEvent" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSWheelEventConstructor) }; |
438 | |
439 | /* Hash table for prototype */ |
440 | |
441 | static const HashTableValue JSWheelEventPrototypeTableValues[] = |
442 | { |
443 | { "constructor" , static_cast<unsigned>(JSC::PropertyAttribute::DontEnum), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsWheelEventConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSWheelEventConstructor) } }, |
444 | { "deltaX" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsWheelEventDeltaX), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
445 | { "deltaY" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsWheelEventDeltaY), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
446 | { "deltaZ" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsWheelEventDeltaZ), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
447 | { "deltaMode" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsWheelEventDeltaMode), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
448 | { "wheelDeltaX" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsWheelEventWheelDeltaX), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
449 | { "wheelDeltaY" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsWheelEventWheelDeltaY), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
450 | { "wheelDelta" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsWheelEventWheelDelta), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
451 | { "webkitDirectionInvertedFromDevice" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsWheelEventWebkitDirectionInvertedFromDevice), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
452 | { "initWebKitWheelEvent" , static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsWheelEventPrototypeFunctionInitWebKitWheelEvent), (intptr_t) (0) } }, |
453 | { "DOM_DELTA_PIXEL" , JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(0x00) } }, |
454 | { "DOM_DELTA_LINE" , JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(0x01) } }, |
455 | { "DOM_DELTA_PAGE" , JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(0x02) } }, |
456 | }; |
457 | |
458 | const ClassInfo JSWheelEventPrototype::s_info = { "WheelEventPrototype" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSWheelEventPrototype) }; |
459 | |
460 | void JSWheelEventPrototype::finishCreation(VM& vm) |
461 | { |
462 | Base::finishCreation(vm); |
463 | reifyStaticProperties(vm, JSWheelEvent::info(), JSWheelEventPrototypeTableValues, *this); |
464 | } |
465 | |
466 | const ClassInfo JSWheelEvent::s_info = { "WheelEvent" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSWheelEvent) }; |
467 | |
468 | JSWheelEvent::JSWheelEvent(Structure* structure, JSDOMGlobalObject& globalObject, Ref<WheelEvent>&& impl) |
469 | : JSMouseEvent(structure, globalObject, WTFMove(impl)) |
470 | { |
471 | } |
472 | |
473 | void JSWheelEvent::finishCreation(VM& vm) |
474 | { |
475 | Base::finishCreation(vm); |
476 | ASSERT(inherits(vm, info())); |
477 | |
478 | } |
479 | |
480 | JSObject* JSWheelEvent::createPrototype(VM& vm, JSDOMGlobalObject& globalObject) |
481 | { |
482 | return JSWheelEventPrototype::create(vm, &globalObject, JSWheelEventPrototype::createStructure(vm, &globalObject, JSMouseEvent::prototype(vm, globalObject))); |
483 | } |
484 | |
485 | JSObject* JSWheelEvent::prototype(VM& vm, JSDOMGlobalObject& globalObject) |
486 | { |
487 | return getDOMPrototype<JSWheelEvent>(vm, globalObject); |
488 | } |
489 | |
490 | JSValue JSWheelEvent::getConstructor(VM& vm, const JSGlobalObject* globalObject) |
491 | { |
492 | return getDOMConstructor<JSWheelEventConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject)); |
493 | } |
494 | |
495 | template<> inline JSWheelEvent* IDLAttribute<JSWheelEvent>::cast(ExecState& state, EncodedJSValue thisValue) |
496 | { |
497 | return jsDynamicCast<JSWheelEvent*>(state.vm(), JSValue::decode(thisValue)); |
498 | } |
499 | |
500 | template<> inline JSWheelEvent* IDLOperation<JSWheelEvent>::cast(ExecState& state) |
501 | { |
502 | return jsDynamicCast<JSWheelEvent*>(state.vm(), state.thisValue()); |
503 | } |
504 | |
505 | EncodedJSValue jsWheelEventConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName) |
506 | { |
507 | VM& vm = state->vm(); |
508 | auto throwScope = DECLARE_THROW_SCOPE(vm); |
509 | auto* prototype = jsDynamicCast<JSWheelEventPrototype*>(vm, JSValue::decode(thisValue)); |
510 | if (UNLIKELY(!prototype)) |
511 | return throwVMTypeError(state, throwScope); |
512 | return JSValue::encode(JSWheelEvent::getConstructor(state->vm(), prototype->globalObject())); |
513 | } |
514 | |
515 | bool setJSWheelEventConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
516 | { |
517 | VM& vm = state->vm(); |
518 | auto throwScope = DECLARE_THROW_SCOPE(vm); |
519 | auto* prototype = jsDynamicCast<JSWheelEventPrototype*>(vm, JSValue::decode(thisValue)); |
520 | if (UNLIKELY(!prototype)) { |
521 | throwVMTypeError(state, throwScope); |
522 | return false; |
523 | } |
524 | // Shadowing a built-in constructor |
525 | return prototype->putDirect(vm, vm.propertyNames->constructor, JSValue::decode(encodedValue)); |
526 | } |
527 | |
528 | static inline JSValue jsWheelEventDeltaXGetter(ExecState& state, JSWheelEvent& thisObject, ThrowScope& throwScope) |
529 | { |
530 | UNUSED_PARAM(throwScope); |
531 | UNUSED_PARAM(state); |
532 | auto& impl = thisObject.wrapped(); |
533 | JSValue result = toJS<IDLUnrestrictedDouble>(state, throwScope, impl.deltaX()); |
534 | return result; |
535 | } |
536 | |
537 | EncodedJSValue jsWheelEventDeltaX(ExecState* state, EncodedJSValue thisValue, PropertyName) |
538 | { |
539 | return IDLAttribute<JSWheelEvent>::get<jsWheelEventDeltaXGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "deltaX" ); |
540 | } |
541 | |
542 | static inline JSValue jsWheelEventDeltaYGetter(ExecState& state, JSWheelEvent& thisObject, ThrowScope& throwScope) |
543 | { |
544 | UNUSED_PARAM(throwScope); |
545 | UNUSED_PARAM(state); |
546 | auto& impl = thisObject.wrapped(); |
547 | JSValue result = toJS<IDLUnrestrictedDouble>(state, throwScope, impl.deltaY()); |
548 | return result; |
549 | } |
550 | |
551 | EncodedJSValue jsWheelEventDeltaY(ExecState* state, EncodedJSValue thisValue, PropertyName) |
552 | { |
553 | return IDLAttribute<JSWheelEvent>::get<jsWheelEventDeltaYGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "deltaY" ); |
554 | } |
555 | |
556 | static inline JSValue jsWheelEventDeltaZGetter(ExecState& state, JSWheelEvent& thisObject, ThrowScope& throwScope) |
557 | { |
558 | UNUSED_PARAM(throwScope); |
559 | UNUSED_PARAM(state); |
560 | auto& impl = thisObject.wrapped(); |
561 | JSValue result = toJS<IDLUnrestrictedDouble>(state, throwScope, impl.deltaZ()); |
562 | return result; |
563 | } |
564 | |
565 | EncodedJSValue jsWheelEventDeltaZ(ExecState* state, EncodedJSValue thisValue, PropertyName) |
566 | { |
567 | return IDLAttribute<JSWheelEvent>::get<jsWheelEventDeltaZGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "deltaZ" ); |
568 | } |
569 | |
570 | static inline JSValue jsWheelEventDeltaModeGetter(ExecState& state, JSWheelEvent& thisObject, ThrowScope& throwScope) |
571 | { |
572 | UNUSED_PARAM(throwScope); |
573 | UNUSED_PARAM(state); |
574 | auto& impl = thisObject.wrapped(); |
575 | JSValue result = toJS<IDLUnsignedLong>(state, throwScope, impl.deltaMode()); |
576 | return result; |
577 | } |
578 | |
579 | EncodedJSValue jsWheelEventDeltaMode(ExecState* state, EncodedJSValue thisValue, PropertyName) |
580 | { |
581 | return IDLAttribute<JSWheelEvent>::get<jsWheelEventDeltaModeGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "deltaMode" ); |
582 | } |
583 | |
584 | static inline JSValue jsWheelEventWheelDeltaXGetter(ExecState& state, JSWheelEvent& thisObject, ThrowScope& throwScope) |
585 | { |
586 | UNUSED_PARAM(throwScope); |
587 | UNUSED_PARAM(state); |
588 | auto& impl = thisObject.wrapped(); |
589 | JSValue result = toJS<IDLLong>(state, throwScope, impl.wheelDeltaX()); |
590 | return result; |
591 | } |
592 | |
593 | EncodedJSValue jsWheelEventWheelDeltaX(ExecState* state, EncodedJSValue thisValue, PropertyName) |
594 | { |
595 | return IDLAttribute<JSWheelEvent>::get<jsWheelEventWheelDeltaXGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "wheelDeltaX" ); |
596 | } |
597 | |
598 | static inline JSValue jsWheelEventWheelDeltaYGetter(ExecState& state, JSWheelEvent& thisObject, ThrowScope& throwScope) |
599 | { |
600 | UNUSED_PARAM(throwScope); |
601 | UNUSED_PARAM(state); |
602 | auto& impl = thisObject.wrapped(); |
603 | JSValue result = toJS<IDLLong>(state, throwScope, impl.wheelDeltaY()); |
604 | return result; |
605 | } |
606 | |
607 | EncodedJSValue jsWheelEventWheelDeltaY(ExecState* state, EncodedJSValue thisValue, PropertyName) |
608 | { |
609 | return IDLAttribute<JSWheelEvent>::get<jsWheelEventWheelDeltaYGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "wheelDeltaY" ); |
610 | } |
611 | |
612 | static inline JSValue jsWheelEventWheelDeltaGetter(ExecState& state, JSWheelEvent& thisObject, ThrowScope& throwScope) |
613 | { |
614 | UNUSED_PARAM(throwScope); |
615 | UNUSED_PARAM(state); |
616 | auto& impl = thisObject.wrapped(); |
617 | JSValue result = toJS<IDLLong>(state, throwScope, impl.wheelDelta()); |
618 | return result; |
619 | } |
620 | |
621 | EncodedJSValue jsWheelEventWheelDelta(ExecState* state, EncodedJSValue thisValue, PropertyName) |
622 | { |
623 | return IDLAttribute<JSWheelEvent>::get<jsWheelEventWheelDeltaGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "wheelDelta" ); |
624 | } |
625 | |
626 | static inline JSValue jsWheelEventWebkitDirectionInvertedFromDeviceGetter(ExecState& state, JSWheelEvent& thisObject, ThrowScope& throwScope) |
627 | { |
628 | UNUSED_PARAM(throwScope); |
629 | UNUSED_PARAM(state); |
630 | auto& impl = thisObject.wrapped(); |
631 | JSValue result = toJS<IDLBoolean>(state, throwScope, impl.webkitDirectionInvertedFromDevice()); |
632 | return result; |
633 | } |
634 | |
635 | EncodedJSValue jsWheelEventWebkitDirectionInvertedFromDevice(ExecState* state, EncodedJSValue thisValue, PropertyName) |
636 | { |
637 | return IDLAttribute<JSWheelEvent>::get<jsWheelEventWebkitDirectionInvertedFromDeviceGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "webkitDirectionInvertedFromDevice" ); |
638 | } |
639 | |
640 | static inline JSC::EncodedJSValue jsWheelEventPrototypeFunctionInitWebKitWheelEventBody(JSC::ExecState* state, typename IDLOperation<JSWheelEvent>::ClassParameter castedThis, JSC::ThrowScope& throwScope) |
641 | { |
642 | UNUSED_PARAM(state); |
643 | UNUSED_PARAM(throwScope); |
644 | auto& impl = castedThis->wrapped(); |
645 | auto wheelDeltaX = convert<IDLLong>(*state, state->argument(0)); |
646 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
647 | auto wheelDeltaY = convert<IDLLong>(*state, state->argument(1)); |
648 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
649 | auto view = convert<IDLNullable<IDLInterface<WindowProxy>>>(*state, state->argument(2), [](JSC::ExecState& state, JSC::ThrowScope& scope) { throwArgumentTypeError(state, scope, 2, "view" , "WheelEvent" , "initWebKitWheelEvent" , "WindowProxy" ); }); |
650 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
651 | auto screenX = convert<IDLLong>(*state, state->argument(3)); |
652 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
653 | auto screenY = convert<IDLLong>(*state, state->argument(4)); |
654 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
655 | auto clientX = convert<IDLLong>(*state, state->argument(5)); |
656 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
657 | auto clientY = convert<IDLLong>(*state, state->argument(6)); |
658 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
659 | auto ctrlKey = convert<IDLBoolean>(*state, state->argument(7)); |
660 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
661 | auto altKey = convert<IDLBoolean>(*state, state->argument(8)); |
662 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
663 | auto shiftKey = convert<IDLBoolean>(*state, state->argument(9)); |
664 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
665 | auto metaKey = convert<IDLBoolean>(*state, state->argument(10)); |
666 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
667 | impl.initWebKitWheelEvent(WTFMove(wheelDeltaX), WTFMove(wheelDeltaY), WTFMove(view), WTFMove(screenX), WTFMove(screenY), WTFMove(clientX), WTFMove(clientY), WTFMove(ctrlKey), WTFMove(altKey), WTFMove(shiftKey), WTFMove(metaKey)); |
668 | return JSValue::encode(jsUndefined()); |
669 | } |
670 | |
671 | EncodedJSValue JSC_HOST_CALL jsWheelEventPrototypeFunctionInitWebKitWheelEvent(ExecState* state) |
672 | { |
673 | return IDLOperation<JSWheelEvent>::call<jsWheelEventPrototypeFunctionInitWebKitWheelEventBody>(*state, "initWebKitWheelEvent" ); |
674 | } |
675 | |
676 | void JSWheelEvent::heapSnapshot(JSCell* cell, HeapSnapshotBuilder& builder) |
677 | { |
678 | auto* thisObject = jsCast<JSWheelEvent*>(cell); |
679 | builder.setWrappedObjectForCell(cell, &thisObject->wrapped()); |
680 | if (thisObject->scriptExecutionContext()) |
681 | builder.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); |
682 | Base::heapSnapshot(cell, builder); |
683 | } |
684 | |
685 | #if ENABLE(BINDING_INTEGRITY) |
686 | #if PLATFORM(WIN) |
687 | #pragma warning(disable: 4483) |
688 | extern "C" { extern void (*const __identifier("??_7WheelEvent@WebCore@@6B@" )[])(); } |
689 | #else |
690 | extern "C" { extern void* _ZTVN7WebCore10WheelEventE[]; } |
691 | #endif |
692 | #endif |
693 | |
694 | JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject* globalObject, Ref<WheelEvent>&& impl) |
695 | { |
696 | |
697 | #if ENABLE(BINDING_INTEGRITY) |
698 | void* actualVTablePointer = *(reinterpret_cast<void**>(impl.ptr())); |
699 | #if PLATFORM(WIN) |
700 | void* expectedVTablePointer = WTF_PREPARE_VTBL_POINTER_FOR_INSPECTION(__identifier("??_7WheelEvent@WebCore@@6B@" )); |
701 | #else |
702 | void* expectedVTablePointer = WTF_PREPARE_VTBL_POINTER_FOR_INSPECTION(&_ZTVN7WebCore10WheelEventE[2]); |
703 | #endif |
704 | |
705 | // If this fails WheelEvent does not have a vtable, so you need to add the |
706 | // ImplementationLacksVTable attribute to the interface definition |
707 | static_assert(std::is_polymorphic<WheelEvent>::value, "WheelEvent is not polymorphic" ); |
708 | |
709 | // If you hit this assertion you either have a use after free bug, or |
710 | // WheelEvent has subclasses. If WheelEvent has subclasses that get passed |
711 | // to toJS() we currently require WheelEvent you to opt out of binding hardening |
712 | // by adding the SkipVTableValidation attribute to the interface IDL definition |
713 | RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer); |
714 | #endif |
715 | return createWrapper<WheelEvent>(globalObject, WTFMove(impl)); |
716 | } |
717 | |
718 | JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, WheelEvent& impl) |
719 | { |
720 | return wrap(state, globalObject, impl); |
721 | } |
722 | |
723 | |
724 | } |
725 | |