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 | |
23 | #if ENABLE(TOUCH_EVENTS) |
24 | |
25 | #include "JSTouch.h" |
26 | |
27 | #include "JSDOMAttribute.h" |
28 | #include "JSDOMBinding.h" |
29 | #include "JSDOMConstructorNotConstructable.h" |
30 | #include "JSDOMConvertInterface.h" |
31 | #include "JSDOMConvertNumbers.h" |
32 | #include "JSDOMExceptionHandling.h" |
33 | #include "JSDOMGlobalObject.h" |
34 | #include "JSDOMWrapperCache.h" |
35 | #include "JSEventTarget.h" |
36 | #include "ScriptExecutionContext.h" |
37 | #include <JavaScriptCore/FunctionPrototype.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 | // Attributes |
49 | |
50 | JSC::EncodedJSValue jsTouchConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
51 | bool setJSTouchConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
52 | JSC::EncodedJSValue jsTouchClientX(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
53 | JSC::EncodedJSValue jsTouchClientY(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
54 | JSC::EncodedJSValue jsTouchScreenX(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
55 | JSC::EncodedJSValue jsTouchScreenY(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
56 | JSC::EncodedJSValue jsTouchPageX(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
57 | JSC::EncodedJSValue jsTouchPageY(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
58 | JSC::EncodedJSValue jsTouchTarget(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
59 | JSC::EncodedJSValue jsTouchIdentifier(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
60 | JSC::EncodedJSValue jsTouchWebkitRadiusX(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
61 | JSC::EncodedJSValue jsTouchWebkitRadiusY(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
62 | JSC::EncodedJSValue jsTouchWebkitRotationAngle(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
63 | JSC::EncodedJSValue jsTouchWebkitForce(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
64 | |
65 | class JSTouchPrototype : public JSC::JSNonFinalObject { |
66 | public: |
67 | using Base = JSC::JSNonFinalObject; |
68 | static JSTouchPrototype* create(JSC::VM& vm, JSDOMGlobalObject* globalObject, JSC::Structure* structure) |
69 | { |
70 | JSTouchPrototype* ptr = new (NotNull, JSC::allocateCell<JSTouchPrototype>(vm.heap)) JSTouchPrototype(vm, globalObject, structure); |
71 | ptr->finishCreation(vm); |
72 | return ptr; |
73 | } |
74 | |
75 | DECLARE_INFO; |
76 | static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) |
77 | { |
78 | return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); |
79 | } |
80 | |
81 | private: |
82 | JSTouchPrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure) |
83 | : JSC::JSNonFinalObject(vm, structure) |
84 | { |
85 | } |
86 | |
87 | void finishCreation(JSC::VM&); |
88 | }; |
89 | |
90 | using JSTouchConstructor = JSDOMConstructorNotConstructable<JSTouch>; |
91 | |
92 | template<> JSValue JSTouchConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject) |
93 | { |
94 | UNUSED_PARAM(vm); |
95 | return globalObject.functionPrototype(); |
96 | } |
97 | |
98 | template<> void JSTouchConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject) |
99 | { |
100 | putDirect(vm, vm.propertyNames->prototype, JSTouch::prototype(vm, globalObject), JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
101 | putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String("Touch"_s )), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
102 | putDirect(vm, vm.propertyNames->length, jsNumber(0), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
103 | } |
104 | |
105 | template<> const ClassInfo JSTouchConstructor::s_info = { "Touch" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSTouchConstructor) }; |
106 | |
107 | /* Hash table for prototype */ |
108 | |
109 | static const HashTableValue JSTouchPrototypeTableValues[] = |
110 | { |
111 | { "constructor" , static_cast<unsigned>(JSC::PropertyAttribute::DontEnum), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTouchConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTouchConstructor) } }, |
112 | { "clientX" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTouchClientX), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
113 | { "clientY" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTouchClientY), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
114 | { "screenX" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTouchScreenX), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
115 | { "screenY" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTouchScreenY), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
116 | { "pageX" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTouchPageX), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
117 | { "pageY" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTouchPageY), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
118 | { "target" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTouchTarget), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
119 | { "identifier" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTouchIdentifier), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
120 | { "webkitRadiusX" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTouchWebkitRadiusX), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
121 | { "webkitRadiusY" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTouchWebkitRadiusY), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
122 | { "webkitRotationAngle" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTouchWebkitRotationAngle), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
123 | { "webkitForce" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTouchWebkitForce), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
124 | }; |
125 | |
126 | const ClassInfo JSTouchPrototype::s_info = { "TouchPrototype" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSTouchPrototype) }; |
127 | |
128 | void JSTouchPrototype::finishCreation(VM& vm) |
129 | { |
130 | Base::finishCreation(vm); |
131 | reifyStaticProperties(vm, JSTouch::info(), JSTouchPrototypeTableValues, *this); |
132 | } |
133 | |
134 | const ClassInfo JSTouch::s_info = { "Touch" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSTouch) }; |
135 | |
136 | JSTouch::JSTouch(Structure* structure, JSDOMGlobalObject& globalObject, Ref<Touch>&& impl) |
137 | : JSDOMWrapper<Touch>(structure, globalObject, WTFMove(impl)) |
138 | { |
139 | } |
140 | |
141 | void JSTouch::finishCreation(VM& vm) |
142 | { |
143 | Base::finishCreation(vm); |
144 | ASSERT(inherits(vm, info())); |
145 | |
146 | } |
147 | |
148 | JSObject* JSTouch::createPrototype(VM& vm, JSDOMGlobalObject& globalObject) |
149 | { |
150 | return JSTouchPrototype::create(vm, &globalObject, JSTouchPrototype::createStructure(vm, &globalObject, globalObject.objectPrototype())); |
151 | } |
152 | |
153 | JSObject* JSTouch::prototype(VM& vm, JSDOMGlobalObject& globalObject) |
154 | { |
155 | return getDOMPrototype<JSTouch>(vm, globalObject); |
156 | } |
157 | |
158 | JSValue JSTouch::getConstructor(VM& vm, const JSGlobalObject* globalObject) |
159 | { |
160 | return getDOMConstructor<JSTouchConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject)); |
161 | } |
162 | |
163 | void JSTouch::destroy(JSC::JSCell* cell) |
164 | { |
165 | JSTouch* thisObject = static_cast<JSTouch*>(cell); |
166 | thisObject->JSTouch::~JSTouch(); |
167 | } |
168 | |
169 | template<> inline JSTouch* IDLAttribute<JSTouch>::cast(ExecState& state, EncodedJSValue thisValue) |
170 | { |
171 | return jsDynamicCast<JSTouch*>(state.vm(), JSValue::decode(thisValue)); |
172 | } |
173 | |
174 | EncodedJSValue jsTouchConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName) |
175 | { |
176 | VM& vm = state->vm(); |
177 | auto throwScope = DECLARE_THROW_SCOPE(vm); |
178 | auto* prototype = jsDynamicCast<JSTouchPrototype*>(vm, JSValue::decode(thisValue)); |
179 | if (UNLIKELY(!prototype)) |
180 | return throwVMTypeError(state, throwScope); |
181 | return JSValue::encode(JSTouch::getConstructor(state->vm(), prototype->globalObject())); |
182 | } |
183 | |
184 | bool setJSTouchConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
185 | { |
186 | VM& vm = state->vm(); |
187 | auto throwScope = DECLARE_THROW_SCOPE(vm); |
188 | auto* prototype = jsDynamicCast<JSTouchPrototype*>(vm, JSValue::decode(thisValue)); |
189 | if (UNLIKELY(!prototype)) { |
190 | throwVMTypeError(state, throwScope); |
191 | return false; |
192 | } |
193 | // Shadowing a built-in constructor |
194 | return prototype->putDirect(vm, vm.propertyNames->constructor, JSValue::decode(encodedValue)); |
195 | } |
196 | |
197 | static inline JSValue jsTouchClientXGetter(ExecState& state, JSTouch& thisObject, ThrowScope& throwScope) |
198 | { |
199 | UNUSED_PARAM(throwScope); |
200 | UNUSED_PARAM(state); |
201 | auto& impl = thisObject.wrapped(); |
202 | JSValue result = toJS<IDLLong>(state, throwScope, impl.clientX()); |
203 | return result; |
204 | } |
205 | |
206 | EncodedJSValue jsTouchClientX(ExecState* state, EncodedJSValue thisValue, PropertyName) |
207 | { |
208 | return IDLAttribute<JSTouch>::get<jsTouchClientXGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "clientX" ); |
209 | } |
210 | |
211 | static inline JSValue jsTouchClientYGetter(ExecState& state, JSTouch& thisObject, ThrowScope& throwScope) |
212 | { |
213 | UNUSED_PARAM(throwScope); |
214 | UNUSED_PARAM(state); |
215 | auto& impl = thisObject.wrapped(); |
216 | JSValue result = toJS<IDLLong>(state, throwScope, impl.clientY()); |
217 | return result; |
218 | } |
219 | |
220 | EncodedJSValue jsTouchClientY(ExecState* state, EncodedJSValue thisValue, PropertyName) |
221 | { |
222 | return IDLAttribute<JSTouch>::get<jsTouchClientYGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "clientY" ); |
223 | } |
224 | |
225 | static inline JSValue jsTouchScreenXGetter(ExecState& state, JSTouch& thisObject, ThrowScope& throwScope) |
226 | { |
227 | UNUSED_PARAM(throwScope); |
228 | UNUSED_PARAM(state); |
229 | auto& impl = thisObject.wrapped(); |
230 | JSValue result = toJS<IDLLong>(state, throwScope, impl.screenX()); |
231 | return result; |
232 | } |
233 | |
234 | EncodedJSValue jsTouchScreenX(ExecState* state, EncodedJSValue thisValue, PropertyName) |
235 | { |
236 | return IDLAttribute<JSTouch>::get<jsTouchScreenXGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "screenX" ); |
237 | } |
238 | |
239 | static inline JSValue jsTouchScreenYGetter(ExecState& state, JSTouch& thisObject, ThrowScope& throwScope) |
240 | { |
241 | UNUSED_PARAM(throwScope); |
242 | UNUSED_PARAM(state); |
243 | auto& impl = thisObject.wrapped(); |
244 | JSValue result = toJS<IDLLong>(state, throwScope, impl.screenY()); |
245 | return result; |
246 | } |
247 | |
248 | EncodedJSValue jsTouchScreenY(ExecState* state, EncodedJSValue thisValue, PropertyName) |
249 | { |
250 | return IDLAttribute<JSTouch>::get<jsTouchScreenYGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "screenY" ); |
251 | } |
252 | |
253 | static inline JSValue jsTouchPageXGetter(ExecState& state, JSTouch& thisObject, ThrowScope& throwScope) |
254 | { |
255 | UNUSED_PARAM(throwScope); |
256 | UNUSED_PARAM(state); |
257 | auto& impl = thisObject.wrapped(); |
258 | JSValue result = toJS<IDLLong>(state, throwScope, impl.pageX()); |
259 | return result; |
260 | } |
261 | |
262 | EncodedJSValue jsTouchPageX(ExecState* state, EncodedJSValue thisValue, PropertyName) |
263 | { |
264 | return IDLAttribute<JSTouch>::get<jsTouchPageXGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "pageX" ); |
265 | } |
266 | |
267 | static inline JSValue jsTouchPageYGetter(ExecState& state, JSTouch& thisObject, ThrowScope& throwScope) |
268 | { |
269 | UNUSED_PARAM(throwScope); |
270 | UNUSED_PARAM(state); |
271 | auto& impl = thisObject.wrapped(); |
272 | JSValue result = toJS<IDLLong>(state, throwScope, impl.pageY()); |
273 | return result; |
274 | } |
275 | |
276 | EncodedJSValue jsTouchPageY(ExecState* state, EncodedJSValue thisValue, PropertyName) |
277 | { |
278 | return IDLAttribute<JSTouch>::get<jsTouchPageYGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "pageY" ); |
279 | } |
280 | |
281 | static inline JSValue jsTouchTargetGetter(ExecState& state, JSTouch& thisObject, ThrowScope& throwScope) |
282 | { |
283 | UNUSED_PARAM(throwScope); |
284 | UNUSED_PARAM(state); |
285 | auto& impl = thisObject.wrapped(); |
286 | JSValue result = toJS<IDLInterface<EventTarget>>(state, *thisObject.globalObject(), throwScope, impl.target()); |
287 | return result; |
288 | } |
289 | |
290 | EncodedJSValue jsTouchTarget(ExecState* state, EncodedJSValue thisValue, PropertyName) |
291 | { |
292 | return IDLAttribute<JSTouch>::get<jsTouchTargetGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "target" ); |
293 | } |
294 | |
295 | static inline JSValue jsTouchIdentifierGetter(ExecState& state, JSTouch& thisObject, ThrowScope& throwScope) |
296 | { |
297 | UNUSED_PARAM(throwScope); |
298 | UNUSED_PARAM(state); |
299 | auto& impl = thisObject.wrapped(); |
300 | JSValue result = toJS<IDLUnsignedLong>(state, throwScope, impl.identifier()); |
301 | return result; |
302 | } |
303 | |
304 | EncodedJSValue jsTouchIdentifier(ExecState* state, EncodedJSValue thisValue, PropertyName) |
305 | { |
306 | return IDLAttribute<JSTouch>::get<jsTouchIdentifierGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "identifier" ); |
307 | } |
308 | |
309 | static inline JSValue jsTouchWebkitRadiusXGetter(ExecState& state, JSTouch& thisObject, ThrowScope& throwScope) |
310 | { |
311 | UNUSED_PARAM(throwScope); |
312 | UNUSED_PARAM(state); |
313 | auto& impl = thisObject.wrapped(); |
314 | JSValue result = toJS<IDLLong>(state, throwScope, impl.webkitRadiusX()); |
315 | return result; |
316 | } |
317 | |
318 | EncodedJSValue jsTouchWebkitRadiusX(ExecState* state, EncodedJSValue thisValue, PropertyName) |
319 | { |
320 | return IDLAttribute<JSTouch>::get<jsTouchWebkitRadiusXGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "webkitRadiusX" ); |
321 | } |
322 | |
323 | static inline JSValue jsTouchWebkitRadiusYGetter(ExecState& state, JSTouch& thisObject, ThrowScope& throwScope) |
324 | { |
325 | UNUSED_PARAM(throwScope); |
326 | UNUSED_PARAM(state); |
327 | auto& impl = thisObject.wrapped(); |
328 | JSValue result = toJS<IDLLong>(state, throwScope, impl.webkitRadiusY()); |
329 | return result; |
330 | } |
331 | |
332 | EncodedJSValue jsTouchWebkitRadiusY(ExecState* state, EncodedJSValue thisValue, PropertyName) |
333 | { |
334 | return IDLAttribute<JSTouch>::get<jsTouchWebkitRadiusYGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "webkitRadiusY" ); |
335 | } |
336 | |
337 | static inline JSValue jsTouchWebkitRotationAngleGetter(ExecState& state, JSTouch& thisObject, ThrowScope& throwScope) |
338 | { |
339 | UNUSED_PARAM(throwScope); |
340 | UNUSED_PARAM(state); |
341 | auto& impl = thisObject.wrapped(); |
342 | JSValue result = toJS<IDLUnrestrictedFloat>(state, throwScope, impl.webkitRotationAngle()); |
343 | return result; |
344 | } |
345 | |
346 | EncodedJSValue jsTouchWebkitRotationAngle(ExecState* state, EncodedJSValue thisValue, PropertyName) |
347 | { |
348 | return IDLAttribute<JSTouch>::get<jsTouchWebkitRotationAngleGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "webkitRotationAngle" ); |
349 | } |
350 | |
351 | static inline JSValue jsTouchWebkitForceGetter(ExecState& state, JSTouch& thisObject, ThrowScope& throwScope) |
352 | { |
353 | UNUSED_PARAM(throwScope); |
354 | UNUSED_PARAM(state); |
355 | auto& impl = thisObject.wrapped(); |
356 | JSValue result = toJS<IDLUnrestrictedFloat>(state, throwScope, impl.webkitForce()); |
357 | return result; |
358 | } |
359 | |
360 | EncodedJSValue jsTouchWebkitForce(ExecState* state, EncodedJSValue thisValue, PropertyName) |
361 | { |
362 | return IDLAttribute<JSTouch>::get<jsTouchWebkitForceGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "webkitForce" ); |
363 | } |
364 | |
365 | void JSTouch::heapSnapshot(JSCell* cell, HeapSnapshotBuilder& builder) |
366 | { |
367 | auto* thisObject = jsCast<JSTouch*>(cell); |
368 | builder.setWrappedObjectForCell(cell, &thisObject->wrapped()); |
369 | if (thisObject->scriptExecutionContext()) |
370 | builder.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); |
371 | Base::heapSnapshot(cell, builder); |
372 | } |
373 | |
374 | bool JSTouchOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor, const char** reason) |
375 | { |
376 | UNUSED_PARAM(handle); |
377 | UNUSED_PARAM(visitor); |
378 | UNUSED_PARAM(reason); |
379 | return false; |
380 | } |
381 | |
382 | void JSTouchOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context) |
383 | { |
384 | auto* jsTouch = static_cast<JSTouch*>(handle.slot()->asCell()); |
385 | auto& world = *static_cast<DOMWrapperWorld*>(context); |
386 | uncacheWrapper(world, &jsTouch->wrapped(), jsTouch); |
387 | } |
388 | |
389 | JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject* globalObject, Ref<Touch>&& impl) |
390 | { |
391 | // If you hit this failure the interface definition has the ImplementationLacksVTable |
392 | // attribute. You should remove that attribute. If the class has subclasses |
393 | // that may be passed through this toJS() function you should use the SkipVTableValidation |
394 | // attribute to Touch. |
395 | static_assert(!std::is_polymorphic<Touch>::value, "Touch is polymorphic but the IDL claims it is not" ); |
396 | return createWrapper<Touch>(globalObject, WTFMove(impl)); |
397 | } |
398 | |
399 | JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, Touch& impl) |
400 | { |
401 | return wrap(state, globalObject, impl); |
402 | } |
403 | |
404 | Touch* JSTouch::toWrapped(JSC::VM& vm, JSC::JSValue value) |
405 | { |
406 | if (auto* wrapper = jsDynamicCast<JSTouch*>(vm, value)) |
407 | return &wrapper->wrapped(); |
408 | return nullptr; |
409 | } |
410 | |
411 | } |
412 | |
413 | #endif // ENABLE(TOUCH_EVENTS) |
414 | |