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 "JSDOMPoint.h" |
23 | |
24 | #include "JSDOMAttribute.h" |
25 | #include "JSDOMBinding.h" |
26 | #include "JSDOMConstructor.h" |
27 | #include "JSDOMConvertDictionary.h" |
28 | #include "JSDOMConvertInterface.h" |
29 | #include "JSDOMConvertNumbers.h" |
30 | #include "JSDOMExceptionHandling.h" |
31 | #include "JSDOMGlobalObject.h" |
32 | #include "JSDOMOperation.h" |
33 | #include "JSDOMPoint.h" |
34 | #include "JSDOMPointInit.h" |
35 | #include "JSDOMWrapperCache.h" |
36 | #include "ScriptExecutionContext.h" |
37 | #include <JavaScriptCore/HeapSnapshotBuilder.h> |
38 | #include <JavaScriptCore/JSCInlines.h> |
39 | #include <wtf/GetPtr.h> |
40 | #include <wtf/PointerPreparations.h> |
41 | #include <wtf/URL.h> |
42 | |
43 | |
44 | namespace WebCore { |
45 | using namespace JSC; |
46 | |
47 | // Functions |
48 | |
49 | JSC::EncodedJSValue JSC_HOST_CALL jsDOMPointConstructorFunctionFromPoint(JSC::ExecState*); |
50 | |
51 | // Attributes |
52 | |
53 | JSC::EncodedJSValue jsDOMPointConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
54 | bool setJSDOMPointConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
55 | JSC::EncodedJSValue jsDOMPointX(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
56 | bool setJSDOMPointX(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
57 | JSC::EncodedJSValue jsDOMPointY(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
58 | bool setJSDOMPointY(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
59 | JSC::EncodedJSValue jsDOMPointZ(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
60 | bool setJSDOMPointZ(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
61 | JSC::EncodedJSValue jsDOMPointW(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
62 | bool setJSDOMPointW(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
63 | |
64 | class JSDOMPointPrototype : public JSC::JSNonFinalObject { |
65 | public: |
66 | using Base = JSC::JSNonFinalObject; |
67 | static JSDOMPointPrototype* create(JSC::VM& vm, JSDOMGlobalObject* globalObject, JSC::Structure* structure) |
68 | { |
69 | JSDOMPointPrototype* ptr = new (NotNull, JSC::allocateCell<JSDOMPointPrototype>(vm.heap)) JSDOMPointPrototype(vm, globalObject, structure); |
70 | ptr->finishCreation(vm); |
71 | return ptr; |
72 | } |
73 | |
74 | DECLARE_INFO; |
75 | static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) |
76 | { |
77 | return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); |
78 | } |
79 | |
80 | private: |
81 | JSDOMPointPrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure) |
82 | : JSC::JSNonFinalObject(vm, structure) |
83 | { |
84 | } |
85 | |
86 | void finishCreation(JSC::VM&); |
87 | }; |
88 | |
89 | using JSDOMPointConstructor = JSDOMConstructor<JSDOMPoint>; |
90 | |
91 | /* Hash table for constructor */ |
92 | |
93 | static const HashTableValue JSDOMPointConstructorTableValues[] = |
94 | { |
95 | { "fromPoint" , static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsDOMPointConstructorFunctionFromPoint), (intptr_t) (0) } }, |
96 | }; |
97 | |
98 | static inline EncodedJSValue constructJSDOMPoint1(ExecState* state) |
99 | { |
100 | VM& vm = state->vm(); |
101 | auto throwScope = DECLARE_THROW_SCOPE(vm); |
102 | UNUSED_PARAM(throwScope); |
103 | auto* castedThis = jsCast<JSDOMPointConstructor*>(state->jsCallee()); |
104 | ASSERT(castedThis); |
105 | auto point = convert<IDLDictionary<DOMPointInit>>(*state, state->uncheckedArgument(0)); |
106 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
107 | auto object = DOMPoint::create(WTFMove(point)); |
108 | return JSValue::encode(toJSNewlyCreated<IDLInterface<DOMPoint>>(*state, *castedThis->globalObject(), WTFMove(object))); |
109 | } |
110 | |
111 | static inline EncodedJSValue constructJSDOMPoint2(ExecState* state) |
112 | { |
113 | VM& vm = state->vm(); |
114 | auto throwScope = DECLARE_THROW_SCOPE(vm); |
115 | UNUSED_PARAM(throwScope); |
116 | auto* castedThis = jsCast<JSDOMPointConstructor*>(state->jsCallee()); |
117 | ASSERT(castedThis); |
118 | auto x = state->argument(0).isUndefined() ? 0 : convert<IDLUnrestrictedDouble>(*state, state->uncheckedArgument(0)); |
119 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
120 | auto y = state->argument(1).isUndefined() ? 0 : convert<IDLUnrestrictedDouble>(*state, state->uncheckedArgument(1)); |
121 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
122 | auto z = state->argument(2).isUndefined() ? 0 : convert<IDLUnrestrictedDouble>(*state, state->uncheckedArgument(2)); |
123 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
124 | auto w = state->argument(3).isUndefined() ? 1 : convert<IDLUnrestrictedDouble>(*state, state->uncheckedArgument(3)); |
125 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
126 | auto object = DOMPoint::create(WTFMove(x), WTFMove(y), WTFMove(z), WTFMove(w)); |
127 | return JSValue::encode(toJSNewlyCreated<IDLInterface<DOMPoint>>(*state, *castedThis->globalObject(), WTFMove(object))); |
128 | } |
129 | |
130 | template<> EncodedJSValue JSC_HOST_CALL JSDOMPointConstructor::construct(ExecState* state) |
131 | { |
132 | VM& vm = state->vm(); |
133 | auto throwScope = DECLARE_THROW_SCOPE(vm); |
134 | UNUSED_PARAM(throwScope); |
135 | size_t argsCount = std::min<size_t>(4, state->argumentCount()); |
136 | if (argsCount == 0) { |
137 | return constructJSDOMPoint2(state); |
138 | } |
139 | if (argsCount == 1) { |
140 | JSValue distinguishingArg = state->uncheckedArgument(0); |
141 | if (distinguishingArg.isUndefined()) |
142 | return constructJSDOMPoint2(state); |
143 | if (distinguishingArg.isUndefinedOrNull()) |
144 | return constructJSDOMPoint1(state); |
145 | if (distinguishingArg.isObject()) |
146 | return constructJSDOMPoint1(state); |
147 | if (distinguishingArg.isNumber()) |
148 | return constructJSDOMPoint2(state); |
149 | return constructJSDOMPoint2(state); |
150 | } |
151 | if (argsCount == 2) { |
152 | return constructJSDOMPoint2(state); |
153 | } |
154 | if (argsCount == 3) { |
155 | return constructJSDOMPoint2(state); |
156 | } |
157 | if (argsCount == 4) { |
158 | return constructJSDOMPoint2(state); |
159 | } |
160 | return throwVMTypeError(state, throwScope); |
161 | } |
162 | |
163 | template<> JSValue JSDOMPointConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject) |
164 | { |
165 | return JSDOMPointReadOnly::getConstructor(vm, &globalObject); |
166 | } |
167 | |
168 | template<> void JSDOMPointConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject) |
169 | { |
170 | putDirect(vm, vm.propertyNames->prototype, JSDOMPoint::prototype(vm, globalObject), JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
171 | putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String("DOMPoint"_s )), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
172 | putDirect(vm, vm.propertyNames->length, jsNumber(0), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
173 | reifyStaticProperties(vm, JSDOMPoint::info(), JSDOMPointConstructorTableValues, *this); |
174 | } |
175 | |
176 | template<> const ClassInfo JSDOMPointConstructor::s_info = { "DOMPoint" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSDOMPointConstructor) }; |
177 | |
178 | /* Hash table for prototype */ |
179 | |
180 | static const HashTableValue JSDOMPointPrototypeTableValues[] = |
181 | { |
182 | { "constructor" , static_cast<unsigned>(JSC::PropertyAttribute::DontEnum), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsDOMPointConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSDOMPointConstructor) } }, |
183 | { "x" , static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsDOMPointX), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSDOMPointX) } }, |
184 | { "y" , static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsDOMPointY), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSDOMPointY) } }, |
185 | { "z" , static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsDOMPointZ), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSDOMPointZ) } }, |
186 | { "w" , static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsDOMPointW), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSDOMPointW) } }, |
187 | }; |
188 | |
189 | const ClassInfo JSDOMPointPrototype::s_info = { "DOMPointPrototype" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSDOMPointPrototype) }; |
190 | |
191 | void JSDOMPointPrototype::finishCreation(VM& vm) |
192 | { |
193 | Base::finishCreation(vm); |
194 | reifyStaticProperties(vm, JSDOMPoint::info(), JSDOMPointPrototypeTableValues, *this); |
195 | } |
196 | |
197 | const ClassInfo JSDOMPoint::s_info = { "DOMPoint" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSDOMPoint) }; |
198 | |
199 | JSDOMPoint::JSDOMPoint(Structure* structure, JSDOMGlobalObject& globalObject, Ref<DOMPoint>&& impl) |
200 | : JSDOMPointReadOnly(structure, globalObject, WTFMove(impl)) |
201 | { |
202 | } |
203 | |
204 | void JSDOMPoint::finishCreation(VM& vm) |
205 | { |
206 | Base::finishCreation(vm); |
207 | ASSERT(inherits(vm, info())); |
208 | |
209 | } |
210 | |
211 | JSObject* JSDOMPoint::createPrototype(VM& vm, JSDOMGlobalObject& globalObject) |
212 | { |
213 | return JSDOMPointPrototype::create(vm, &globalObject, JSDOMPointPrototype::createStructure(vm, &globalObject, JSDOMPointReadOnly::prototype(vm, globalObject))); |
214 | } |
215 | |
216 | JSObject* JSDOMPoint::prototype(VM& vm, JSDOMGlobalObject& globalObject) |
217 | { |
218 | return getDOMPrototype<JSDOMPoint>(vm, globalObject); |
219 | } |
220 | |
221 | JSValue JSDOMPoint::getConstructor(VM& vm, const JSGlobalObject* globalObject) |
222 | { |
223 | return getDOMConstructor<JSDOMPointConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject)); |
224 | } |
225 | |
226 | template<> inline JSDOMPoint* IDLAttribute<JSDOMPoint>::cast(ExecState& state, EncodedJSValue thisValue) |
227 | { |
228 | return jsDynamicCast<JSDOMPoint*>(state.vm(), JSValue::decode(thisValue)); |
229 | } |
230 | |
231 | template<> inline JSDOMPoint* IDLOperation<JSDOMPoint>::cast(ExecState& state) |
232 | { |
233 | return jsDynamicCast<JSDOMPoint*>(state.vm(), state.thisValue()); |
234 | } |
235 | |
236 | EncodedJSValue jsDOMPointConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName) |
237 | { |
238 | VM& vm = state->vm(); |
239 | auto throwScope = DECLARE_THROW_SCOPE(vm); |
240 | auto* prototype = jsDynamicCast<JSDOMPointPrototype*>(vm, JSValue::decode(thisValue)); |
241 | if (UNLIKELY(!prototype)) |
242 | return throwVMTypeError(state, throwScope); |
243 | return JSValue::encode(JSDOMPoint::getConstructor(state->vm(), prototype->globalObject())); |
244 | } |
245 | |
246 | bool setJSDOMPointConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
247 | { |
248 | VM& vm = state->vm(); |
249 | auto throwScope = DECLARE_THROW_SCOPE(vm); |
250 | auto* prototype = jsDynamicCast<JSDOMPointPrototype*>(vm, JSValue::decode(thisValue)); |
251 | if (UNLIKELY(!prototype)) { |
252 | throwVMTypeError(state, throwScope); |
253 | return false; |
254 | } |
255 | // Shadowing a built-in constructor |
256 | return prototype->putDirect(vm, vm.propertyNames->constructor, JSValue::decode(encodedValue)); |
257 | } |
258 | |
259 | static inline JSValue jsDOMPointXGetter(ExecState& state, JSDOMPoint& thisObject, ThrowScope& throwScope) |
260 | { |
261 | UNUSED_PARAM(throwScope); |
262 | UNUSED_PARAM(state); |
263 | auto& impl = thisObject.wrapped(); |
264 | JSValue result = toJS<IDLUnrestrictedDouble>(state, throwScope, impl.x()); |
265 | return result; |
266 | } |
267 | |
268 | EncodedJSValue jsDOMPointX(ExecState* state, EncodedJSValue thisValue, PropertyName) |
269 | { |
270 | return IDLAttribute<JSDOMPoint>::get<jsDOMPointXGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "x" ); |
271 | } |
272 | |
273 | static inline bool setJSDOMPointXSetter(ExecState& state, JSDOMPoint& thisObject, JSValue value, ThrowScope& throwScope) |
274 | { |
275 | UNUSED_PARAM(throwScope); |
276 | auto& impl = thisObject.wrapped(); |
277 | auto nativeValue = convert<IDLUnrestrictedDouble>(state, value); |
278 | RETURN_IF_EXCEPTION(throwScope, false); |
279 | AttributeSetter::call(state, throwScope, [&] { |
280 | return impl.setX(WTFMove(nativeValue)); |
281 | }); |
282 | return true; |
283 | } |
284 | |
285 | bool setJSDOMPointX(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
286 | { |
287 | return IDLAttribute<JSDOMPoint>::set<setJSDOMPointXSetter>(*state, thisValue, encodedValue, "x" ); |
288 | } |
289 | |
290 | static inline JSValue jsDOMPointYGetter(ExecState& state, JSDOMPoint& thisObject, ThrowScope& throwScope) |
291 | { |
292 | UNUSED_PARAM(throwScope); |
293 | UNUSED_PARAM(state); |
294 | auto& impl = thisObject.wrapped(); |
295 | JSValue result = toJS<IDLUnrestrictedDouble>(state, throwScope, impl.y()); |
296 | return result; |
297 | } |
298 | |
299 | EncodedJSValue jsDOMPointY(ExecState* state, EncodedJSValue thisValue, PropertyName) |
300 | { |
301 | return IDLAttribute<JSDOMPoint>::get<jsDOMPointYGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "y" ); |
302 | } |
303 | |
304 | static inline bool setJSDOMPointYSetter(ExecState& state, JSDOMPoint& thisObject, JSValue value, ThrowScope& throwScope) |
305 | { |
306 | UNUSED_PARAM(throwScope); |
307 | auto& impl = thisObject.wrapped(); |
308 | auto nativeValue = convert<IDLUnrestrictedDouble>(state, value); |
309 | RETURN_IF_EXCEPTION(throwScope, false); |
310 | AttributeSetter::call(state, throwScope, [&] { |
311 | return impl.setY(WTFMove(nativeValue)); |
312 | }); |
313 | return true; |
314 | } |
315 | |
316 | bool setJSDOMPointY(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
317 | { |
318 | return IDLAttribute<JSDOMPoint>::set<setJSDOMPointYSetter>(*state, thisValue, encodedValue, "y" ); |
319 | } |
320 | |
321 | static inline JSValue jsDOMPointZGetter(ExecState& state, JSDOMPoint& thisObject, ThrowScope& throwScope) |
322 | { |
323 | UNUSED_PARAM(throwScope); |
324 | UNUSED_PARAM(state); |
325 | auto& impl = thisObject.wrapped(); |
326 | JSValue result = toJS<IDLUnrestrictedDouble>(state, throwScope, impl.z()); |
327 | return result; |
328 | } |
329 | |
330 | EncodedJSValue jsDOMPointZ(ExecState* state, EncodedJSValue thisValue, PropertyName) |
331 | { |
332 | return IDLAttribute<JSDOMPoint>::get<jsDOMPointZGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "z" ); |
333 | } |
334 | |
335 | static inline bool setJSDOMPointZSetter(ExecState& state, JSDOMPoint& thisObject, JSValue value, ThrowScope& throwScope) |
336 | { |
337 | UNUSED_PARAM(throwScope); |
338 | auto& impl = thisObject.wrapped(); |
339 | auto nativeValue = convert<IDLUnrestrictedDouble>(state, value); |
340 | RETURN_IF_EXCEPTION(throwScope, false); |
341 | AttributeSetter::call(state, throwScope, [&] { |
342 | return impl.setZ(WTFMove(nativeValue)); |
343 | }); |
344 | return true; |
345 | } |
346 | |
347 | bool setJSDOMPointZ(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
348 | { |
349 | return IDLAttribute<JSDOMPoint>::set<setJSDOMPointZSetter>(*state, thisValue, encodedValue, "z" ); |
350 | } |
351 | |
352 | static inline JSValue jsDOMPointWGetter(ExecState& state, JSDOMPoint& thisObject, ThrowScope& throwScope) |
353 | { |
354 | UNUSED_PARAM(throwScope); |
355 | UNUSED_PARAM(state); |
356 | auto& impl = thisObject.wrapped(); |
357 | JSValue result = toJS<IDLUnrestrictedDouble>(state, throwScope, impl.w()); |
358 | return result; |
359 | } |
360 | |
361 | EncodedJSValue jsDOMPointW(ExecState* state, EncodedJSValue thisValue, PropertyName) |
362 | { |
363 | return IDLAttribute<JSDOMPoint>::get<jsDOMPointWGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "w" ); |
364 | } |
365 | |
366 | static inline bool setJSDOMPointWSetter(ExecState& state, JSDOMPoint& thisObject, JSValue value, ThrowScope& throwScope) |
367 | { |
368 | UNUSED_PARAM(throwScope); |
369 | auto& impl = thisObject.wrapped(); |
370 | auto nativeValue = convert<IDLUnrestrictedDouble>(state, value); |
371 | RETURN_IF_EXCEPTION(throwScope, false); |
372 | AttributeSetter::call(state, throwScope, [&] { |
373 | return impl.setW(WTFMove(nativeValue)); |
374 | }); |
375 | return true; |
376 | } |
377 | |
378 | bool setJSDOMPointW(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
379 | { |
380 | return IDLAttribute<JSDOMPoint>::set<setJSDOMPointWSetter>(*state, thisValue, encodedValue, "w" ); |
381 | } |
382 | |
383 | static inline JSC::EncodedJSValue jsDOMPointConstructorFunctionFromPointBody(JSC::ExecState* state, JSC::ThrowScope& throwScope) |
384 | { |
385 | UNUSED_PARAM(state); |
386 | UNUSED_PARAM(throwScope); |
387 | auto other = convert<IDLDictionary<DOMPointInit>>(*state, state->argument(0)); |
388 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
389 | return JSValue::encode(toJSNewlyCreated<IDLInterface<DOMPoint>>(*state, *jsCast<JSDOMGlobalObject*>(state->lexicalGlobalObject()), DOMPoint::fromPoint(WTFMove(other)))); |
390 | } |
391 | |
392 | EncodedJSValue JSC_HOST_CALL jsDOMPointConstructorFunctionFromPoint(ExecState* state) |
393 | { |
394 | return IDLOperation<JSDOMPoint>::callStatic<jsDOMPointConstructorFunctionFromPointBody>(*state, "fromPoint" ); |
395 | } |
396 | |
397 | void JSDOMPoint::heapSnapshot(JSCell* cell, HeapSnapshotBuilder& builder) |
398 | { |
399 | auto* thisObject = jsCast<JSDOMPoint*>(cell); |
400 | builder.setWrappedObjectForCell(cell, &thisObject->wrapped()); |
401 | if (thisObject->scriptExecutionContext()) |
402 | builder.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); |
403 | Base::heapSnapshot(cell, builder); |
404 | } |
405 | |
406 | bool JSDOMPointOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor, const char** reason) |
407 | { |
408 | auto* jsDOMPoint = jsCast<JSDOMPoint*>(handle.slot()->asCell()); |
409 | DOMPoint* root = &jsDOMPoint->wrapped(); |
410 | if (UNLIKELY(reason)) |
411 | *reason = "Reachable from DOMPoint" ; |
412 | return visitor.containsOpaqueRoot(root); |
413 | } |
414 | |
415 | void JSDOMPointOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context) |
416 | { |
417 | auto* jsDOMPoint = static_cast<JSDOMPoint*>(handle.slot()->asCell()); |
418 | auto& world = *static_cast<DOMWrapperWorld*>(context); |
419 | uncacheWrapper(world, &jsDOMPoint->wrapped(), jsDOMPoint); |
420 | } |
421 | |
422 | JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject* globalObject, Ref<DOMPoint>&& impl) |
423 | { |
424 | // If you hit this failure the interface definition has the ImplementationLacksVTable |
425 | // attribute. You should remove that attribute. If the class has subclasses |
426 | // that may be passed through this toJS() function you should use the SkipVTableValidation |
427 | // attribute to DOMPoint. |
428 | static_assert(!std::is_polymorphic<DOMPoint>::value, "DOMPoint is polymorphic but the IDL claims it is not" ); |
429 | return createWrapper<DOMPoint>(globalObject, WTFMove(impl)); |
430 | } |
431 | |
432 | JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, DOMPoint& impl) |
433 | { |
434 | return wrap(state, globalObject, impl); |
435 | } |
436 | |
437 | |
438 | } |
439 | |