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