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