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 "JSDeprecatedCSSOMRect.h" |
23 | |
24 | #include "JSDOMAttribute.h" |
25 | #include "JSDOMBinding.h" |
26 | #include "JSDOMConstructorNotConstructable.h" |
27 | #include "JSDOMConvertInterface.h" |
28 | #include "JSDOMExceptionHandling.h" |
29 | #include "JSDOMGlobalObject.h" |
30 | #include "JSDOMWrapperCache.h" |
31 | #include "JSDeprecatedCSSOMPrimitiveValue.h" |
32 | #include "ScriptExecutionContext.h" |
33 | #include <JavaScriptCore/FunctionPrototype.h> |
34 | #include <JavaScriptCore/HeapSnapshotBuilder.h> |
35 | #include <JavaScriptCore/JSCInlines.h> |
36 | #include <wtf/GetPtr.h> |
37 | #include <wtf/PointerPreparations.h> |
38 | #include <wtf/URL.h> |
39 | |
40 | |
41 | namespace WebCore { |
42 | using namespace JSC; |
43 | |
44 | // Attributes |
45 | |
46 | JSC::EncodedJSValue jsDeprecatedCSSOMRectConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
47 | bool setJSDeprecatedCSSOMRectConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
48 | JSC::EncodedJSValue jsDeprecatedCSSOMRectTop(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
49 | JSC::EncodedJSValue jsDeprecatedCSSOMRectRight(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
50 | JSC::EncodedJSValue jsDeprecatedCSSOMRectBottom(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
51 | JSC::EncodedJSValue jsDeprecatedCSSOMRectLeft(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
52 | |
53 | class JSDeprecatedCSSOMRectPrototype : public JSC::JSNonFinalObject { |
54 | public: |
55 | using Base = JSC::JSNonFinalObject; |
56 | static JSDeprecatedCSSOMRectPrototype* create(JSC::VM& vm, JSDOMGlobalObject* globalObject, JSC::Structure* structure) |
57 | { |
58 | JSDeprecatedCSSOMRectPrototype* ptr = new (NotNull, JSC::allocateCell<JSDeprecatedCSSOMRectPrototype>(vm.heap)) JSDeprecatedCSSOMRectPrototype(vm, globalObject, structure); |
59 | ptr->finishCreation(vm); |
60 | return ptr; |
61 | } |
62 | |
63 | DECLARE_INFO; |
64 | static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) |
65 | { |
66 | return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); |
67 | } |
68 | |
69 | private: |
70 | JSDeprecatedCSSOMRectPrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure) |
71 | : JSC::JSNonFinalObject(vm, structure) |
72 | { |
73 | } |
74 | |
75 | void finishCreation(JSC::VM&); |
76 | }; |
77 | |
78 | using JSDeprecatedCSSOMRectConstructor = JSDOMConstructorNotConstructable<JSDeprecatedCSSOMRect>; |
79 | |
80 | template<> JSValue JSDeprecatedCSSOMRectConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject) |
81 | { |
82 | UNUSED_PARAM(vm); |
83 | return globalObject.functionPrototype(); |
84 | } |
85 | |
86 | template<> void JSDeprecatedCSSOMRectConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject) |
87 | { |
88 | putDirect(vm, vm.propertyNames->prototype, JSDeprecatedCSSOMRect::prototype(vm, globalObject), JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
89 | putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String("Rect"_s )), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
90 | putDirect(vm, vm.propertyNames->length, jsNumber(0), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
91 | } |
92 | |
93 | template<> const ClassInfo JSDeprecatedCSSOMRectConstructor::s_info = { "Rect" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSDeprecatedCSSOMRectConstructor) }; |
94 | |
95 | /* Hash table for prototype */ |
96 | |
97 | static const HashTableValue JSDeprecatedCSSOMRectPrototypeTableValues[] = |
98 | { |
99 | { "constructor" , static_cast<unsigned>(JSC::PropertyAttribute::DontEnum), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsDeprecatedCSSOMRectConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSDeprecatedCSSOMRectConstructor) } }, |
100 | { "top" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsDeprecatedCSSOMRectTop), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
101 | { "right" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsDeprecatedCSSOMRectRight), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
102 | { "bottom" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsDeprecatedCSSOMRectBottom), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
103 | { "left" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsDeprecatedCSSOMRectLeft), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
104 | }; |
105 | |
106 | const ClassInfo JSDeprecatedCSSOMRectPrototype::s_info = { "RectPrototype" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSDeprecatedCSSOMRectPrototype) }; |
107 | |
108 | void JSDeprecatedCSSOMRectPrototype::finishCreation(VM& vm) |
109 | { |
110 | Base::finishCreation(vm); |
111 | reifyStaticProperties(vm, JSDeprecatedCSSOMRect::info(), JSDeprecatedCSSOMRectPrototypeTableValues, *this); |
112 | } |
113 | |
114 | const ClassInfo JSDeprecatedCSSOMRect::s_info = { "Rect" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSDeprecatedCSSOMRect) }; |
115 | |
116 | JSDeprecatedCSSOMRect::JSDeprecatedCSSOMRect(Structure* structure, JSDOMGlobalObject& globalObject, Ref<DeprecatedCSSOMRect>&& impl) |
117 | : JSDOMWrapper<DeprecatedCSSOMRect>(structure, globalObject, WTFMove(impl)) |
118 | { |
119 | } |
120 | |
121 | void JSDeprecatedCSSOMRect::finishCreation(VM& vm) |
122 | { |
123 | Base::finishCreation(vm); |
124 | ASSERT(inherits(vm, info())); |
125 | |
126 | } |
127 | |
128 | JSObject* JSDeprecatedCSSOMRect::createPrototype(VM& vm, JSDOMGlobalObject& globalObject) |
129 | { |
130 | return JSDeprecatedCSSOMRectPrototype::create(vm, &globalObject, JSDeprecatedCSSOMRectPrototype::createStructure(vm, &globalObject, globalObject.objectPrototype())); |
131 | } |
132 | |
133 | JSObject* JSDeprecatedCSSOMRect::prototype(VM& vm, JSDOMGlobalObject& globalObject) |
134 | { |
135 | return getDOMPrototype<JSDeprecatedCSSOMRect>(vm, globalObject); |
136 | } |
137 | |
138 | JSValue JSDeprecatedCSSOMRect::getConstructor(VM& vm, const JSGlobalObject* globalObject) |
139 | { |
140 | return getDOMConstructor<JSDeprecatedCSSOMRectConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject)); |
141 | } |
142 | |
143 | void JSDeprecatedCSSOMRect::destroy(JSC::JSCell* cell) |
144 | { |
145 | JSDeprecatedCSSOMRect* thisObject = static_cast<JSDeprecatedCSSOMRect*>(cell); |
146 | thisObject->JSDeprecatedCSSOMRect::~JSDeprecatedCSSOMRect(); |
147 | } |
148 | |
149 | template<> inline JSDeprecatedCSSOMRect* IDLAttribute<JSDeprecatedCSSOMRect>::cast(ExecState& state, EncodedJSValue thisValue) |
150 | { |
151 | return jsDynamicCast<JSDeprecatedCSSOMRect*>(state.vm(), JSValue::decode(thisValue)); |
152 | } |
153 | |
154 | EncodedJSValue jsDeprecatedCSSOMRectConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName) |
155 | { |
156 | VM& vm = state->vm(); |
157 | auto throwScope = DECLARE_THROW_SCOPE(vm); |
158 | auto* prototype = jsDynamicCast<JSDeprecatedCSSOMRectPrototype*>(vm, JSValue::decode(thisValue)); |
159 | if (UNLIKELY(!prototype)) |
160 | return throwVMTypeError(state, throwScope); |
161 | return JSValue::encode(JSDeprecatedCSSOMRect::getConstructor(state->vm(), prototype->globalObject())); |
162 | } |
163 | |
164 | bool setJSDeprecatedCSSOMRectConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
165 | { |
166 | VM& vm = state->vm(); |
167 | auto throwScope = DECLARE_THROW_SCOPE(vm); |
168 | auto* prototype = jsDynamicCast<JSDeprecatedCSSOMRectPrototype*>(vm, JSValue::decode(thisValue)); |
169 | if (UNLIKELY(!prototype)) { |
170 | throwVMTypeError(state, throwScope); |
171 | return false; |
172 | } |
173 | // Shadowing a built-in constructor |
174 | return prototype->putDirect(vm, vm.propertyNames->constructor, JSValue::decode(encodedValue)); |
175 | } |
176 | |
177 | static inline JSValue jsDeprecatedCSSOMRectTopGetter(ExecState& state, JSDeprecatedCSSOMRect& thisObject, ThrowScope& throwScope) |
178 | { |
179 | UNUSED_PARAM(throwScope); |
180 | UNUSED_PARAM(state); |
181 | auto& impl = thisObject.wrapped(); |
182 | JSValue result = toJS<IDLInterface<DeprecatedCSSOMPrimitiveValue>>(state, *thisObject.globalObject(), throwScope, impl.top()); |
183 | return result; |
184 | } |
185 | |
186 | EncodedJSValue jsDeprecatedCSSOMRectTop(ExecState* state, EncodedJSValue thisValue, PropertyName) |
187 | { |
188 | return IDLAttribute<JSDeprecatedCSSOMRect>::get<jsDeprecatedCSSOMRectTopGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "top" ); |
189 | } |
190 | |
191 | static inline JSValue jsDeprecatedCSSOMRectRightGetter(ExecState& state, JSDeprecatedCSSOMRect& thisObject, ThrowScope& throwScope) |
192 | { |
193 | UNUSED_PARAM(throwScope); |
194 | UNUSED_PARAM(state); |
195 | auto& impl = thisObject.wrapped(); |
196 | JSValue result = toJS<IDLInterface<DeprecatedCSSOMPrimitiveValue>>(state, *thisObject.globalObject(), throwScope, impl.right()); |
197 | return result; |
198 | } |
199 | |
200 | EncodedJSValue jsDeprecatedCSSOMRectRight(ExecState* state, EncodedJSValue thisValue, PropertyName) |
201 | { |
202 | return IDLAttribute<JSDeprecatedCSSOMRect>::get<jsDeprecatedCSSOMRectRightGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "right" ); |
203 | } |
204 | |
205 | static inline JSValue jsDeprecatedCSSOMRectBottomGetter(ExecState& state, JSDeprecatedCSSOMRect& thisObject, ThrowScope& throwScope) |
206 | { |
207 | UNUSED_PARAM(throwScope); |
208 | UNUSED_PARAM(state); |
209 | auto& impl = thisObject.wrapped(); |
210 | JSValue result = toJS<IDLInterface<DeprecatedCSSOMPrimitiveValue>>(state, *thisObject.globalObject(), throwScope, impl.bottom()); |
211 | return result; |
212 | } |
213 | |
214 | EncodedJSValue jsDeprecatedCSSOMRectBottom(ExecState* state, EncodedJSValue thisValue, PropertyName) |
215 | { |
216 | return IDLAttribute<JSDeprecatedCSSOMRect>::get<jsDeprecatedCSSOMRectBottomGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "bottom" ); |
217 | } |
218 | |
219 | static inline JSValue jsDeprecatedCSSOMRectLeftGetter(ExecState& state, JSDeprecatedCSSOMRect& thisObject, ThrowScope& throwScope) |
220 | { |
221 | UNUSED_PARAM(throwScope); |
222 | UNUSED_PARAM(state); |
223 | auto& impl = thisObject.wrapped(); |
224 | JSValue result = toJS<IDLInterface<DeprecatedCSSOMPrimitiveValue>>(state, *thisObject.globalObject(), throwScope, impl.left()); |
225 | return result; |
226 | } |
227 | |
228 | EncodedJSValue jsDeprecatedCSSOMRectLeft(ExecState* state, EncodedJSValue thisValue, PropertyName) |
229 | { |
230 | return IDLAttribute<JSDeprecatedCSSOMRect>::get<jsDeprecatedCSSOMRectLeftGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "left" ); |
231 | } |
232 | |
233 | void JSDeprecatedCSSOMRect::heapSnapshot(JSCell* cell, HeapSnapshotBuilder& builder) |
234 | { |
235 | auto* thisObject = jsCast<JSDeprecatedCSSOMRect*>(cell); |
236 | builder.setWrappedObjectForCell(cell, &thisObject->wrapped()); |
237 | if (thisObject->scriptExecutionContext()) |
238 | builder.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); |
239 | Base::heapSnapshot(cell, builder); |
240 | } |
241 | |
242 | bool JSDeprecatedCSSOMRectOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor, const char** reason) |
243 | { |
244 | UNUSED_PARAM(handle); |
245 | UNUSED_PARAM(visitor); |
246 | UNUSED_PARAM(reason); |
247 | return false; |
248 | } |
249 | |
250 | void JSDeprecatedCSSOMRectOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context) |
251 | { |
252 | auto* jsDeprecatedCSSOMRect = static_cast<JSDeprecatedCSSOMRect*>(handle.slot()->asCell()); |
253 | auto& world = *static_cast<DOMWrapperWorld*>(context); |
254 | uncacheWrapper(world, &jsDeprecatedCSSOMRect->wrapped(), jsDeprecatedCSSOMRect); |
255 | } |
256 | |
257 | JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject* globalObject, Ref<DeprecatedCSSOMRect>&& impl) |
258 | { |
259 | // If you hit this failure the interface definition has the ImplementationLacksVTable |
260 | // attribute. You should remove that attribute. If the class has subclasses |
261 | // that may be passed through this toJS() function you should use the SkipVTableValidation |
262 | // attribute to DeprecatedCSSOMRect. |
263 | static_assert(!std::is_polymorphic<DeprecatedCSSOMRect>::value, "DeprecatedCSSOMRect is polymorphic but the IDL claims it is not" ); |
264 | return createWrapper<DeprecatedCSSOMRect>(globalObject, WTFMove(impl)); |
265 | } |
266 | |
267 | JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, DeprecatedCSSOMRect& impl) |
268 | { |
269 | return wrap(state, globalObject, impl); |
270 | } |
271 | |
272 | DeprecatedCSSOMRect* JSDeprecatedCSSOMRect::toWrapped(JSC::VM& vm, JSC::JSValue value) |
273 | { |
274 | if (auto* wrapper = jsDynamicCast<JSDeprecatedCSSOMRect*>(vm, value)) |
275 | return &wrapper->wrapped(); |
276 | return nullptr; |
277 | } |
278 | |
279 | } |
280 | |