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(CSS_PAINTING_API) |
24 | |
25 | #include "JSPaintWorkletGlobalScope.h" |
26 | |
27 | #include "JSDOMAttribute.h" |
28 | #include "JSDOMBinding.h" |
29 | #include "JSDOMConstructorNotConstructable.h" |
30 | #include "JSDOMConvertNumbers.h" |
31 | #include "JSDOMConvertObject.h" |
32 | #include "JSDOMConvertStrings.h" |
33 | #include "JSDOMExceptionHandling.h" |
34 | #include "JSDOMOperation.h" |
35 | #include "JSDOMWrapperCache.h" |
36 | #include "RuntimeEnabledFeatures.h" |
37 | #include "ScriptExecutionContext.h" |
38 | #include "WebCoreJSClientData.h" |
39 | #include <JavaScriptCore/HeapSnapshotBuilder.h> |
40 | #include <JavaScriptCore/JSCInlines.h> |
41 | #include <wtf/GetPtr.h> |
42 | #include <wtf/PointerPreparations.h> |
43 | #include <wtf/URL.h> |
44 | |
45 | #if ENABLE(CSS_PAINTING_API) |
46 | #include "JSCSSPaintSize.h" |
47 | #include "JSPaintWorkletGlobalScope.h" |
48 | #endif |
49 | |
50 | #if ENABLE(CSS_TYPED_OM) |
51 | #include "JSStylePropertyMapReadOnly.h" |
52 | #include "JSTypedOMCSSImageValue.h" |
53 | #include "JSTypedOMCSSNumericValue.h" |
54 | #include "JSTypedOMCSSStyleValue.h" |
55 | #include "JSTypedOMCSSUnitValue.h" |
56 | #include "JSTypedOMCSSUnparsedValue.h" |
57 | #endif |
58 | |
59 | |
60 | namespace WebCore { |
61 | using namespace JSC; |
62 | |
63 | // Functions |
64 | |
65 | JSC::EncodedJSValue JSC_HOST_CALL jsPaintWorkletGlobalScopeInstanceFunctionRegisterPaint(JSC::ExecState*); |
66 | |
67 | // Attributes |
68 | |
69 | JSC::EncodedJSValue jsPaintWorkletGlobalScopeConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
70 | bool setJSPaintWorkletGlobalScopeConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
71 | JSC::EncodedJSValue jsPaintWorkletGlobalScopeDevicePixelRatio(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
72 | #if ENABLE(CSS_PAINTING_API) |
73 | JSC::EncodedJSValue jsPaintWorkletGlobalScopeCSSPaintSizeConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
74 | bool setJSPaintWorkletGlobalScopeCSSPaintSizeConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
75 | #endif |
76 | #if ENABLE(CSS_TYPED_OM) |
77 | JSC::EncodedJSValue jsPaintWorkletGlobalScopeStylePropertyMapReadOnlyConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
78 | bool setJSPaintWorkletGlobalScopeStylePropertyMapReadOnlyConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
79 | #endif |
80 | #if ENABLE(CSS_TYPED_OM) |
81 | JSC::EncodedJSValue jsPaintWorkletGlobalScopeCSSImageValueConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
82 | bool setJSPaintWorkletGlobalScopeCSSImageValueConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
83 | #endif |
84 | #if ENABLE(CSS_TYPED_OM) |
85 | JSC::EncodedJSValue jsPaintWorkletGlobalScopeCSSNumericValueConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
86 | bool setJSPaintWorkletGlobalScopeCSSNumericValueConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
87 | #endif |
88 | #if ENABLE(CSS_TYPED_OM) |
89 | JSC::EncodedJSValue jsPaintWorkletGlobalScopeCSSStyleValueConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
90 | bool setJSPaintWorkletGlobalScopeCSSStyleValueConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
91 | #endif |
92 | #if ENABLE(CSS_TYPED_OM) |
93 | JSC::EncodedJSValue jsPaintWorkletGlobalScopeCSSUnitValueConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
94 | bool setJSPaintWorkletGlobalScopeCSSUnitValueConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
95 | #endif |
96 | #if ENABLE(CSS_TYPED_OM) |
97 | JSC::EncodedJSValue jsPaintWorkletGlobalScopeCSSUnparsedValueConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
98 | bool setJSPaintWorkletGlobalScopeCSSUnparsedValueConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
99 | #endif |
100 | #if ENABLE(CSS_PAINTING_API) |
101 | JSC::EncodedJSValue jsPaintWorkletGlobalScopePaintWorkletGlobalScopeConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
102 | bool setJSPaintWorkletGlobalScopePaintWorkletGlobalScopeConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
103 | #endif |
104 | |
105 | using JSPaintWorkletGlobalScopeConstructor = JSDOMConstructorNotConstructable<JSPaintWorkletGlobalScope>; |
106 | |
107 | /* Hash table */ |
108 | |
109 | static const struct CompactHashIndex JSPaintWorkletGlobalScopeTableIndex[4] = { |
110 | { 0, -1 }, |
111 | { -1, -1 }, |
112 | { -1, -1 }, |
113 | { 1, -1 }, |
114 | }; |
115 | |
116 | |
117 | static const HashTableValue JSPaintWorkletGlobalScopeTableValues[] = |
118 | { |
119 | { "devicePixelRatio" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsPaintWorkletGlobalScopeDevicePixelRatio), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
120 | { "registerPaint" , static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsPaintWorkletGlobalScopeInstanceFunctionRegisterPaint), (intptr_t) (2) } }, |
121 | }; |
122 | |
123 | static const HashTable JSPaintWorkletGlobalScopeTable = { 2, 3, true, JSPaintWorkletGlobalScope::info(), JSPaintWorkletGlobalScopeTableValues, JSPaintWorkletGlobalScopeTableIndex }; |
124 | template<> JSValue JSPaintWorkletGlobalScopeConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject) |
125 | { |
126 | return JSWorkletGlobalScope::getConstructor(vm, &globalObject); |
127 | } |
128 | |
129 | template<> void JSPaintWorkletGlobalScopeConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject) |
130 | { |
131 | putDirect(vm, vm.propertyNames->prototype, globalObject.getPrototypeDirect(vm), JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
132 | putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String("PaintWorkletGlobalScope"_s )), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
133 | putDirect(vm, vm.propertyNames->length, jsNumber(0), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
134 | } |
135 | |
136 | template<> const ClassInfo JSPaintWorkletGlobalScopeConstructor::s_info = { "PaintWorkletGlobalScope" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSPaintWorkletGlobalScopeConstructor) }; |
137 | |
138 | /* Hash table for prototype */ |
139 | |
140 | static const struct CompactHashIndex JSPaintWorkletGlobalScopePrototypeTableIndex[2] = { |
141 | { -1, -1 }, |
142 | { 0, -1 }, |
143 | }; |
144 | |
145 | |
146 | static const HashTableValue JSPaintWorkletGlobalScopePrototypeTableValues[] = |
147 | { |
148 | { "constructor" , static_cast<unsigned>(JSC::PropertyAttribute::DontEnum), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsPaintWorkletGlobalScopeConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSPaintWorkletGlobalScopeConstructor) } }, |
149 | }; |
150 | |
151 | static const HashTable JSPaintWorkletGlobalScopePrototypeTable = { 1, 1, true, JSPaintWorkletGlobalScope::info(), JSPaintWorkletGlobalScopePrototypeTableValues, JSPaintWorkletGlobalScopePrototypeTableIndex }; |
152 | const ClassInfo JSPaintWorkletGlobalScopePrototype::s_info = { "PaintWorkletGlobalScopePrototype" , &Base::s_info, &JSPaintWorkletGlobalScopePrototypeTable, nullptr, CREATE_METHOD_TABLE(JSPaintWorkletGlobalScopePrototype) }; |
153 | |
154 | const ClassInfo JSPaintWorkletGlobalScope::s_info = { "PaintWorkletGlobalScope" , &Base::s_info, &JSPaintWorkletGlobalScopeTable, nullptr, CREATE_METHOD_TABLE(JSPaintWorkletGlobalScope) }; |
155 | |
156 | JSPaintWorkletGlobalScope::JSPaintWorkletGlobalScope(VM& vm, Structure* structure, Ref<PaintWorkletGlobalScope>&& impl) |
157 | : JSWorkletGlobalScope(vm, structure, WTFMove(impl)) |
158 | { |
159 | } |
160 | |
161 | void JSPaintWorkletGlobalScope::finishCreation(VM& vm, JSProxy* proxy) |
162 | { |
163 | Base::finishCreation(vm, proxy); |
164 | |
165 | #if ENABLE(CSS_PAINTING_API) |
166 | if (RuntimeEnabledFeatures::sharedFeatures().cssPaintingAPIEnabled()) |
167 | putDirectCustomAccessor(vm, static_cast<JSVMClientData*>(vm.clientData)->builtinNames().CSSPaintSizePublicName(), CustomGetterSetter::create(vm, jsPaintWorkletGlobalScopeCSSPaintSizeConstructor, setJSPaintWorkletGlobalScopeCSSPaintSizeConstructor), attributesForStructure(static_cast<unsigned>(JSC::PropertyAttribute::DontEnum))); |
168 | #endif |
169 | #if ENABLE(CSS_TYPED_OM) |
170 | if (RuntimeEnabledFeatures::sharedFeatures().cssTypedOMEnabled()) |
171 | putDirectCustomAccessor(vm, static_cast<JSVMClientData*>(vm.clientData)->builtinNames().StylePropertyMapReadOnlyPublicName(), CustomGetterSetter::create(vm, jsPaintWorkletGlobalScopeStylePropertyMapReadOnlyConstructor, setJSPaintWorkletGlobalScopeStylePropertyMapReadOnlyConstructor), attributesForStructure(static_cast<unsigned>(JSC::PropertyAttribute::DontEnum))); |
172 | #endif |
173 | #if ENABLE(CSS_TYPED_OM) |
174 | if (RuntimeEnabledFeatures::sharedFeatures().cssTypedOMEnabled()) |
175 | putDirectCustomAccessor(vm, static_cast<JSVMClientData*>(vm.clientData)->builtinNames().CSSImageValuePublicName(), CustomGetterSetter::create(vm, jsPaintWorkletGlobalScopeCSSImageValueConstructor, setJSPaintWorkletGlobalScopeCSSImageValueConstructor), attributesForStructure(static_cast<unsigned>(JSC::PropertyAttribute::DontEnum))); |
176 | #endif |
177 | #if ENABLE(CSS_TYPED_OM) |
178 | if (RuntimeEnabledFeatures::sharedFeatures().cssTypedOMEnabled()) |
179 | putDirectCustomAccessor(vm, static_cast<JSVMClientData*>(vm.clientData)->builtinNames().CSSNumericValuePublicName(), CustomGetterSetter::create(vm, jsPaintWorkletGlobalScopeCSSNumericValueConstructor, setJSPaintWorkletGlobalScopeCSSNumericValueConstructor), attributesForStructure(static_cast<unsigned>(JSC::PropertyAttribute::DontEnum))); |
180 | #endif |
181 | #if ENABLE(CSS_TYPED_OM) |
182 | if (RuntimeEnabledFeatures::sharedFeatures().cssTypedOMEnabled()) |
183 | putDirectCustomAccessor(vm, static_cast<JSVMClientData*>(vm.clientData)->builtinNames().CSSStyleValuePublicName(), CustomGetterSetter::create(vm, jsPaintWorkletGlobalScopeCSSStyleValueConstructor, setJSPaintWorkletGlobalScopeCSSStyleValueConstructor), attributesForStructure(static_cast<unsigned>(JSC::PropertyAttribute::DontEnum))); |
184 | #endif |
185 | #if ENABLE(CSS_TYPED_OM) |
186 | if (RuntimeEnabledFeatures::sharedFeatures().cssTypedOMEnabled()) |
187 | putDirectCustomAccessor(vm, static_cast<JSVMClientData*>(vm.clientData)->builtinNames().CSSUnitValuePublicName(), CustomGetterSetter::create(vm, jsPaintWorkletGlobalScopeCSSUnitValueConstructor, setJSPaintWorkletGlobalScopeCSSUnitValueConstructor), attributesForStructure(static_cast<unsigned>(JSC::PropertyAttribute::DontEnum))); |
188 | #endif |
189 | #if ENABLE(CSS_TYPED_OM) |
190 | if (RuntimeEnabledFeatures::sharedFeatures().cssTypedOMEnabled()) |
191 | putDirectCustomAccessor(vm, static_cast<JSVMClientData*>(vm.clientData)->builtinNames().CSSUnparsedValuePublicName(), CustomGetterSetter::create(vm, jsPaintWorkletGlobalScopeCSSUnparsedValueConstructor, setJSPaintWorkletGlobalScopeCSSUnparsedValueConstructor), attributesForStructure(static_cast<unsigned>(JSC::PropertyAttribute::DontEnum))); |
192 | #endif |
193 | #if ENABLE(CSS_PAINTING_API) |
194 | if (RuntimeEnabledFeatures::sharedFeatures().cssPaintingAPIEnabled()) |
195 | putDirectCustomAccessor(vm, static_cast<JSVMClientData*>(vm.clientData)->builtinNames().PaintWorkletGlobalScopePublicName(), CustomGetterSetter::create(vm, jsPaintWorkletGlobalScopePaintWorkletGlobalScopeConstructor, setJSPaintWorkletGlobalScopePaintWorkletGlobalScopeConstructor), attributesForStructure(static_cast<unsigned>(JSC::PropertyAttribute::DontEnum))); |
196 | #endif |
197 | } |
198 | |
199 | JSValue JSPaintWorkletGlobalScope::getConstructor(VM& vm, const JSGlobalObject* globalObject) |
200 | { |
201 | return getDOMConstructor<JSPaintWorkletGlobalScopeConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject)); |
202 | } |
203 | |
204 | template<> inline JSPaintWorkletGlobalScope* IDLAttribute<JSPaintWorkletGlobalScope>::cast(ExecState& state, EncodedJSValue thisValue) |
205 | { |
206 | auto decodedThisValue = JSValue::decode(thisValue); |
207 | if (decodedThisValue.isUndefinedOrNull()) |
208 | decodedThisValue = state.thisValue().toThis(&state, NotStrictMode); |
209 | return jsDynamicCast<JSPaintWorkletGlobalScope*>(state.vm(), decodedThisValue);} |
210 | |
211 | template<> inline JSPaintWorkletGlobalScope* IDLOperation<JSPaintWorkletGlobalScope>::cast(ExecState& state) |
212 | { |
213 | return jsDynamicCast<JSPaintWorkletGlobalScope*>(state.vm(), state.thisValue()); |
214 | } |
215 | |
216 | EncodedJSValue jsPaintWorkletGlobalScopeConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName) |
217 | { |
218 | VM& vm = state->vm(); |
219 | auto throwScope = DECLARE_THROW_SCOPE(vm); |
220 | auto* prototype = jsDynamicCast<JSPaintWorkletGlobalScopePrototype*>(vm, JSValue::decode(thisValue)); |
221 | if (UNLIKELY(!prototype)) |
222 | return throwVMTypeError(state, throwScope); |
223 | return JSValue::encode(JSPaintWorkletGlobalScope::getConstructor(state->vm(), prototype->globalObject())); |
224 | } |
225 | |
226 | bool setJSPaintWorkletGlobalScopeConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
227 | { |
228 | VM& vm = state->vm(); |
229 | auto throwScope = DECLARE_THROW_SCOPE(vm); |
230 | auto* prototype = jsDynamicCast<JSPaintWorkletGlobalScopePrototype*>(vm, JSValue::decode(thisValue)); |
231 | if (UNLIKELY(!prototype)) { |
232 | throwVMTypeError(state, throwScope); |
233 | return false; |
234 | } |
235 | // Shadowing a built-in constructor |
236 | return prototype->putDirect(vm, vm.propertyNames->constructor, JSValue::decode(encodedValue)); |
237 | } |
238 | |
239 | static inline JSValue jsPaintWorkletGlobalScopeDevicePixelRatioGetter(ExecState& state, JSPaintWorkletGlobalScope& thisObject, ThrowScope& throwScope) |
240 | { |
241 | UNUSED_PARAM(throwScope); |
242 | UNUSED_PARAM(state); |
243 | auto& impl = thisObject.wrapped(); |
244 | JSValue result = toJS<IDLUnrestrictedDouble>(state, throwScope, impl.devicePixelRatio()); |
245 | return result; |
246 | } |
247 | |
248 | EncodedJSValue jsPaintWorkletGlobalScopeDevicePixelRatio(ExecState* state, EncodedJSValue thisValue, PropertyName) |
249 | { |
250 | return IDLAttribute<JSPaintWorkletGlobalScope>::get<jsPaintWorkletGlobalScopeDevicePixelRatioGetter>(*state, thisValue, "devicePixelRatio" ); |
251 | } |
252 | |
253 | #if ENABLE(CSS_PAINTING_API) |
254 | static inline JSValue jsPaintWorkletGlobalScopeCSSPaintSizeConstructorGetter(ExecState& state, JSPaintWorkletGlobalScope& thisObject, ThrowScope& throwScope) |
255 | { |
256 | UNUSED_PARAM(throwScope); |
257 | UNUSED_PARAM(state); |
258 | return JSCSSPaintSize::getConstructor(state.vm(), thisObject.globalObject()); |
259 | } |
260 | |
261 | EncodedJSValue jsPaintWorkletGlobalScopeCSSPaintSizeConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName) |
262 | { |
263 | return IDLAttribute<JSPaintWorkletGlobalScope>::get<jsPaintWorkletGlobalScopeCSSPaintSizeConstructorGetter>(*state, thisValue, "CSSPaintSize" ); |
264 | } |
265 | |
266 | #endif |
267 | |
268 | #if ENABLE(CSS_PAINTING_API) |
269 | static inline bool setJSPaintWorkletGlobalScopeCSSPaintSizeConstructorSetter(ExecState& state, JSPaintWorkletGlobalScope& thisObject, JSValue value, ThrowScope& throwScope) |
270 | { |
271 | UNUSED_PARAM(throwScope); |
272 | // Shadowing a built-in constructor. |
273 | return thisObject.putDirect(state.vm(), Identifier::fromString(&state.vm(), reinterpret_cast<const LChar*>("CSSPaintSize" ), strlen("CSSPaintSize" )), value); |
274 | } |
275 | |
276 | bool setJSPaintWorkletGlobalScopeCSSPaintSizeConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
277 | { |
278 | return IDLAttribute<JSPaintWorkletGlobalScope>::set<setJSPaintWorkletGlobalScopeCSSPaintSizeConstructorSetter>(*state, thisValue, encodedValue, "CSSPaintSize" ); |
279 | } |
280 | |
281 | #endif |
282 | |
283 | #if ENABLE(CSS_TYPED_OM) |
284 | static inline JSValue jsPaintWorkletGlobalScopeStylePropertyMapReadOnlyConstructorGetter(ExecState& state, JSPaintWorkletGlobalScope& thisObject, ThrowScope& throwScope) |
285 | { |
286 | UNUSED_PARAM(throwScope); |
287 | UNUSED_PARAM(state); |
288 | return JSStylePropertyMapReadOnly::getConstructor(state.vm(), thisObject.globalObject()); |
289 | } |
290 | |
291 | EncodedJSValue jsPaintWorkletGlobalScopeStylePropertyMapReadOnlyConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName) |
292 | { |
293 | return IDLAttribute<JSPaintWorkletGlobalScope>::get<jsPaintWorkletGlobalScopeStylePropertyMapReadOnlyConstructorGetter>(*state, thisValue, "StylePropertyMapReadOnly" ); |
294 | } |
295 | |
296 | #endif |
297 | |
298 | #if ENABLE(CSS_TYPED_OM) |
299 | static inline bool setJSPaintWorkletGlobalScopeStylePropertyMapReadOnlyConstructorSetter(ExecState& state, JSPaintWorkletGlobalScope& thisObject, JSValue value, ThrowScope& throwScope) |
300 | { |
301 | UNUSED_PARAM(throwScope); |
302 | // Shadowing a built-in constructor. |
303 | return thisObject.putDirect(state.vm(), Identifier::fromString(&state.vm(), reinterpret_cast<const LChar*>("StylePropertyMapReadOnly" ), strlen("StylePropertyMapReadOnly" )), value); |
304 | } |
305 | |
306 | bool setJSPaintWorkletGlobalScopeStylePropertyMapReadOnlyConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
307 | { |
308 | return IDLAttribute<JSPaintWorkletGlobalScope>::set<setJSPaintWorkletGlobalScopeStylePropertyMapReadOnlyConstructorSetter>(*state, thisValue, encodedValue, "StylePropertyMapReadOnly" ); |
309 | } |
310 | |
311 | #endif |
312 | |
313 | #if ENABLE(CSS_TYPED_OM) |
314 | static inline JSValue jsPaintWorkletGlobalScopeCSSImageValueConstructorGetter(ExecState& state, JSPaintWorkletGlobalScope& thisObject, ThrowScope& throwScope) |
315 | { |
316 | UNUSED_PARAM(throwScope); |
317 | UNUSED_PARAM(state); |
318 | return JSTypedOMCSSImageValue::getConstructor(state.vm(), thisObject.globalObject()); |
319 | } |
320 | |
321 | EncodedJSValue jsPaintWorkletGlobalScopeCSSImageValueConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName) |
322 | { |
323 | return IDLAttribute<JSPaintWorkletGlobalScope>::get<jsPaintWorkletGlobalScopeCSSImageValueConstructorGetter>(*state, thisValue, "CSSImageValue" ); |
324 | } |
325 | |
326 | #endif |
327 | |
328 | #if ENABLE(CSS_TYPED_OM) |
329 | static inline bool setJSPaintWorkletGlobalScopeCSSImageValueConstructorSetter(ExecState& state, JSPaintWorkletGlobalScope& thisObject, JSValue value, ThrowScope& throwScope) |
330 | { |
331 | UNUSED_PARAM(throwScope); |
332 | // Shadowing a built-in constructor. |
333 | return thisObject.putDirect(state.vm(), Identifier::fromString(&state.vm(), reinterpret_cast<const LChar*>("CSSImageValue" ), strlen("CSSImageValue" )), value); |
334 | } |
335 | |
336 | bool setJSPaintWorkletGlobalScopeCSSImageValueConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
337 | { |
338 | return IDLAttribute<JSPaintWorkletGlobalScope>::set<setJSPaintWorkletGlobalScopeCSSImageValueConstructorSetter>(*state, thisValue, encodedValue, "CSSImageValue" ); |
339 | } |
340 | |
341 | #endif |
342 | |
343 | #if ENABLE(CSS_TYPED_OM) |
344 | static inline JSValue jsPaintWorkletGlobalScopeCSSNumericValueConstructorGetter(ExecState& state, JSPaintWorkletGlobalScope& thisObject, ThrowScope& throwScope) |
345 | { |
346 | UNUSED_PARAM(throwScope); |
347 | UNUSED_PARAM(state); |
348 | return JSTypedOMCSSNumericValue::getConstructor(state.vm(), thisObject.globalObject()); |
349 | } |
350 | |
351 | EncodedJSValue jsPaintWorkletGlobalScopeCSSNumericValueConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName) |
352 | { |
353 | return IDLAttribute<JSPaintWorkletGlobalScope>::get<jsPaintWorkletGlobalScopeCSSNumericValueConstructorGetter>(*state, thisValue, "CSSNumericValue" ); |
354 | } |
355 | |
356 | #endif |
357 | |
358 | #if ENABLE(CSS_TYPED_OM) |
359 | static inline bool setJSPaintWorkletGlobalScopeCSSNumericValueConstructorSetter(ExecState& state, JSPaintWorkletGlobalScope& thisObject, JSValue value, ThrowScope& throwScope) |
360 | { |
361 | UNUSED_PARAM(throwScope); |
362 | // Shadowing a built-in constructor. |
363 | return thisObject.putDirect(state.vm(), Identifier::fromString(&state.vm(), reinterpret_cast<const LChar*>("CSSNumericValue" ), strlen("CSSNumericValue" )), value); |
364 | } |
365 | |
366 | bool setJSPaintWorkletGlobalScopeCSSNumericValueConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
367 | { |
368 | return IDLAttribute<JSPaintWorkletGlobalScope>::set<setJSPaintWorkletGlobalScopeCSSNumericValueConstructorSetter>(*state, thisValue, encodedValue, "CSSNumericValue" ); |
369 | } |
370 | |
371 | #endif |
372 | |
373 | #if ENABLE(CSS_TYPED_OM) |
374 | static inline JSValue jsPaintWorkletGlobalScopeCSSStyleValueConstructorGetter(ExecState& state, JSPaintWorkletGlobalScope& thisObject, ThrowScope& throwScope) |
375 | { |
376 | UNUSED_PARAM(throwScope); |
377 | UNUSED_PARAM(state); |
378 | return JSTypedOMCSSStyleValue::getConstructor(state.vm(), thisObject.globalObject()); |
379 | } |
380 | |
381 | EncodedJSValue jsPaintWorkletGlobalScopeCSSStyleValueConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName) |
382 | { |
383 | return IDLAttribute<JSPaintWorkletGlobalScope>::get<jsPaintWorkletGlobalScopeCSSStyleValueConstructorGetter>(*state, thisValue, "CSSStyleValue" ); |
384 | } |
385 | |
386 | #endif |
387 | |
388 | #if ENABLE(CSS_TYPED_OM) |
389 | static inline bool setJSPaintWorkletGlobalScopeCSSStyleValueConstructorSetter(ExecState& state, JSPaintWorkletGlobalScope& thisObject, JSValue value, ThrowScope& throwScope) |
390 | { |
391 | UNUSED_PARAM(throwScope); |
392 | // Shadowing a built-in constructor. |
393 | return thisObject.putDirect(state.vm(), Identifier::fromString(&state.vm(), reinterpret_cast<const LChar*>("CSSStyleValue" ), strlen("CSSStyleValue" )), value); |
394 | } |
395 | |
396 | bool setJSPaintWorkletGlobalScopeCSSStyleValueConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
397 | { |
398 | return IDLAttribute<JSPaintWorkletGlobalScope>::set<setJSPaintWorkletGlobalScopeCSSStyleValueConstructorSetter>(*state, thisValue, encodedValue, "CSSStyleValue" ); |
399 | } |
400 | |
401 | #endif |
402 | |
403 | #if ENABLE(CSS_TYPED_OM) |
404 | static inline JSValue jsPaintWorkletGlobalScopeCSSUnitValueConstructorGetter(ExecState& state, JSPaintWorkletGlobalScope& thisObject, ThrowScope& throwScope) |
405 | { |
406 | UNUSED_PARAM(throwScope); |
407 | UNUSED_PARAM(state); |
408 | return JSTypedOMCSSUnitValue::getConstructor(state.vm(), thisObject.globalObject()); |
409 | } |
410 | |
411 | EncodedJSValue jsPaintWorkletGlobalScopeCSSUnitValueConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName) |
412 | { |
413 | return IDLAttribute<JSPaintWorkletGlobalScope>::get<jsPaintWorkletGlobalScopeCSSUnitValueConstructorGetter>(*state, thisValue, "CSSUnitValue" ); |
414 | } |
415 | |
416 | #endif |
417 | |
418 | #if ENABLE(CSS_TYPED_OM) |
419 | static inline bool setJSPaintWorkletGlobalScopeCSSUnitValueConstructorSetter(ExecState& state, JSPaintWorkletGlobalScope& thisObject, JSValue value, ThrowScope& throwScope) |
420 | { |
421 | UNUSED_PARAM(throwScope); |
422 | // Shadowing a built-in constructor. |
423 | return thisObject.putDirect(state.vm(), Identifier::fromString(&state.vm(), reinterpret_cast<const LChar*>("CSSUnitValue" ), strlen("CSSUnitValue" )), value); |
424 | } |
425 | |
426 | bool setJSPaintWorkletGlobalScopeCSSUnitValueConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
427 | { |
428 | return IDLAttribute<JSPaintWorkletGlobalScope>::set<setJSPaintWorkletGlobalScopeCSSUnitValueConstructorSetter>(*state, thisValue, encodedValue, "CSSUnitValue" ); |
429 | } |
430 | |
431 | #endif |
432 | |
433 | #if ENABLE(CSS_TYPED_OM) |
434 | static inline JSValue jsPaintWorkletGlobalScopeCSSUnparsedValueConstructorGetter(ExecState& state, JSPaintWorkletGlobalScope& thisObject, ThrowScope& throwScope) |
435 | { |
436 | UNUSED_PARAM(throwScope); |
437 | UNUSED_PARAM(state); |
438 | return JSTypedOMCSSUnparsedValue::getConstructor(state.vm(), thisObject.globalObject()); |
439 | } |
440 | |
441 | EncodedJSValue jsPaintWorkletGlobalScopeCSSUnparsedValueConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName) |
442 | { |
443 | return IDLAttribute<JSPaintWorkletGlobalScope>::get<jsPaintWorkletGlobalScopeCSSUnparsedValueConstructorGetter>(*state, thisValue, "CSSUnparsedValue" ); |
444 | } |
445 | |
446 | #endif |
447 | |
448 | #if ENABLE(CSS_TYPED_OM) |
449 | static inline bool setJSPaintWorkletGlobalScopeCSSUnparsedValueConstructorSetter(ExecState& state, JSPaintWorkletGlobalScope& thisObject, JSValue value, ThrowScope& throwScope) |
450 | { |
451 | UNUSED_PARAM(throwScope); |
452 | // Shadowing a built-in constructor. |
453 | return thisObject.putDirect(state.vm(), Identifier::fromString(&state.vm(), reinterpret_cast<const LChar*>("CSSUnparsedValue" ), strlen("CSSUnparsedValue" )), value); |
454 | } |
455 | |
456 | bool setJSPaintWorkletGlobalScopeCSSUnparsedValueConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
457 | { |
458 | return IDLAttribute<JSPaintWorkletGlobalScope>::set<setJSPaintWorkletGlobalScopeCSSUnparsedValueConstructorSetter>(*state, thisValue, encodedValue, "CSSUnparsedValue" ); |
459 | } |
460 | |
461 | #endif |
462 | |
463 | #if ENABLE(CSS_PAINTING_API) |
464 | static inline JSValue jsPaintWorkletGlobalScopePaintWorkletGlobalScopeConstructorGetter(ExecState& state, JSPaintWorkletGlobalScope& thisObject, ThrowScope& throwScope) |
465 | { |
466 | UNUSED_PARAM(throwScope); |
467 | UNUSED_PARAM(state); |
468 | return JSPaintWorkletGlobalScope::getConstructor(state.vm(), thisObject.globalObject()); |
469 | } |
470 | |
471 | EncodedJSValue jsPaintWorkletGlobalScopePaintWorkletGlobalScopeConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName) |
472 | { |
473 | return IDLAttribute<JSPaintWorkletGlobalScope>::get<jsPaintWorkletGlobalScopePaintWorkletGlobalScopeConstructorGetter>(*state, thisValue, "PaintWorkletGlobalScope" ); |
474 | } |
475 | |
476 | #endif |
477 | |
478 | #if ENABLE(CSS_PAINTING_API) |
479 | static inline bool setJSPaintWorkletGlobalScopePaintWorkletGlobalScopeConstructorSetter(ExecState& state, JSPaintWorkletGlobalScope& thisObject, JSValue value, ThrowScope& throwScope) |
480 | { |
481 | UNUSED_PARAM(throwScope); |
482 | // Shadowing a built-in constructor. |
483 | return thisObject.putDirect(state.vm(), Identifier::fromString(&state.vm(), reinterpret_cast<const LChar*>("PaintWorkletGlobalScope" ), strlen("PaintWorkletGlobalScope" )), value); |
484 | } |
485 | |
486 | bool setJSPaintWorkletGlobalScopePaintWorkletGlobalScopeConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
487 | { |
488 | return IDLAttribute<JSPaintWorkletGlobalScope>::set<setJSPaintWorkletGlobalScopePaintWorkletGlobalScopeConstructorSetter>(*state, thisValue, encodedValue, "PaintWorkletGlobalScope" ); |
489 | } |
490 | |
491 | #endif |
492 | |
493 | static inline JSC::EncodedJSValue jsPaintWorkletGlobalScopeInstanceFunctionRegisterPaintBody(JSC::ExecState* state, typename IDLOperation<JSPaintWorkletGlobalScope>::ClassParameter castedThis, JSC::ThrowScope& throwScope) |
494 | { |
495 | UNUSED_PARAM(state); |
496 | UNUSED_PARAM(throwScope); |
497 | auto& impl = castedThis->wrapped(); |
498 | if (UNLIKELY(state->argumentCount() < 2)) |
499 | return throwVMError(state, throwScope, createNotEnoughArgumentsError(state)); |
500 | auto name = convert<IDLDOMString>(*state, state->uncheckedArgument(0)); |
501 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
502 | auto paintConstructor = convert<IDLObject>(*state, state->uncheckedArgument(1)); |
503 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
504 | propagateException(*state, throwScope, impl.registerPaint(*state, *jsCast<JSDOMGlobalObject*>(state->lexicalGlobalObject()), WTFMove(name), WTFMove(paintConstructor))); |
505 | return JSValue::encode(jsUndefined()); |
506 | } |
507 | |
508 | EncodedJSValue JSC_HOST_CALL jsPaintWorkletGlobalScopeInstanceFunctionRegisterPaint(ExecState* state) |
509 | { |
510 | return IDLOperation<JSPaintWorkletGlobalScope>::call<jsPaintWorkletGlobalScopeInstanceFunctionRegisterPaintBody>(*state, "registerPaint" ); |
511 | } |
512 | |
513 | void JSPaintWorkletGlobalScope::visitChildren(JSCell* cell, SlotVisitor& visitor) |
514 | { |
515 | auto* thisObject = jsCast<JSPaintWorkletGlobalScope*>(cell); |
516 | ASSERT_GC_OBJECT_INHERITS(thisObject, info()); |
517 | Base::visitChildren(thisObject, visitor); |
518 | thisObject->visitAdditionalChildren(visitor); |
519 | } |
520 | |
521 | void JSPaintWorkletGlobalScope::visitOutputConstraints(JSCell* cell, SlotVisitor& visitor) |
522 | { |
523 | auto* thisObject = jsCast<JSPaintWorkletGlobalScope*>(cell); |
524 | ASSERT_GC_OBJECT_INHERITS(thisObject, info()); |
525 | Base::visitOutputConstraints(thisObject, visitor); |
526 | thisObject->visitAdditionalChildren(visitor); |
527 | } |
528 | |
529 | void JSPaintWorkletGlobalScope::heapSnapshot(JSCell* cell, HeapSnapshotBuilder& builder) |
530 | { |
531 | auto* thisObject = jsCast<JSPaintWorkletGlobalScope*>(cell); |
532 | builder.setWrappedObjectForCell(cell, &thisObject->wrapped()); |
533 | if (thisObject->scriptExecutionContext()) |
534 | builder.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); |
535 | Base::heapSnapshot(cell, builder); |
536 | } |
537 | |
538 | PaintWorkletGlobalScope* JSPaintWorkletGlobalScope::toWrapped(JSC::VM& vm, JSC::JSValue value) |
539 | { |
540 | if (auto* wrapper = jsDynamicCast<JSPaintWorkletGlobalScope*>(vm, value)) |
541 | return &wrapper->wrapped(); |
542 | return nullptr; |
543 | } |
544 | |
545 | } |
546 | |
547 | #endif // ENABLE(CSS_PAINTING_API) |
548 | |