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 "JSCSSRule.h" |
23 | |
24 | #include "JSCSSRule.h" |
25 | #include "JSCSSStyleSheet.h" |
26 | #include "JSDOMAttribute.h" |
27 | #include "JSDOMBinding.h" |
28 | #include "JSDOMConstructorNotConstructable.h" |
29 | #include "JSDOMConvertInterface.h" |
30 | #include "JSDOMConvertNullable.h" |
31 | #include "JSDOMConvertNumbers.h" |
32 | #include "JSDOMConvertStrings.h" |
33 | #include "JSDOMExceptionHandling.h" |
34 | #include "JSDOMGlobalObject.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 <wtf/GetPtr.h> |
41 | #include <wtf/PointerPreparations.h> |
42 | #include <wtf/URL.h> |
43 | |
44 | |
45 | namespace WebCore { |
46 | using namespace JSC; |
47 | |
48 | // Attributes |
49 | |
50 | JSC::EncodedJSValue jsCSSRuleConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
51 | bool setJSCSSRuleConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
52 | JSC::EncodedJSValue jsCSSRuleType(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
53 | JSC::EncodedJSValue jsCSSRuleCssText(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
54 | bool setJSCSSRuleCssText(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
55 | JSC::EncodedJSValue jsCSSRuleParentStyleSheet(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
56 | JSC::EncodedJSValue jsCSSRuleParentRule(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
57 | |
58 | class JSCSSRulePrototype : public JSC::JSNonFinalObject { |
59 | public: |
60 | using Base = JSC::JSNonFinalObject; |
61 | static JSCSSRulePrototype* create(JSC::VM& vm, JSDOMGlobalObject* globalObject, JSC::Structure* structure) |
62 | { |
63 | JSCSSRulePrototype* ptr = new (NotNull, JSC::allocateCell<JSCSSRulePrototype>(vm.heap)) JSCSSRulePrototype(vm, globalObject, structure); |
64 | ptr->finishCreation(vm); |
65 | return ptr; |
66 | } |
67 | |
68 | DECLARE_INFO; |
69 | static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) |
70 | { |
71 | return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); |
72 | } |
73 | |
74 | private: |
75 | JSCSSRulePrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure) |
76 | : JSC::JSNonFinalObject(vm, structure) |
77 | { |
78 | } |
79 | |
80 | void finishCreation(JSC::VM&); |
81 | }; |
82 | |
83 | using JSCSSRuleConstructor = JSDOMConstructorNotConstructable<JSCSSRule>; |
84 | |
85 | /* Hash table for constructor */ |
86 | |
87 | static const HashTableValue JSCSSRuleConstructorTableValues[] = |
88 | { |
89 | { "UNKNOWN_RULE" , JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(0) } }, |
90 | { "STYLE_RULE" , JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(1) } }, |
91 | { "CHARSET_RULE" , JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(2) } }, |
92 | { "IMPORT_RULE" , JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(3) } }, |
93 | { "MEDIA_RULE" , JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(4) } }, |
94 | { "FONT_FACE_RULE" , JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(5) } }, |
95 | { "PAGE_RULE" , JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(6) } }, |
96 | { "KEYFRAMES_RULE" , JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(7) } }, |
97 | { "KEYFRAME_RULE" , JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(8) } }, |
98 | { "NAMESPACE_RULE" , JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(10) } }, |
99 | { "SUPPORTS_RULE" , JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(12) } }, |
100 | #if ENABLE(CSS_DEVICE_ADAPTATION) |
101 | { "WEBKIT_VIEWPORT_RULE" , JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(15) } }, |
102 | #else |
103 | { 0, 0, NoIntrinsic, { 0, 0 } }, |
104 | #endif |
105 | { "WEBKIT_KEYFRAMES_RULE" , JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(7) } }, |
106 | { "WEBKIT_KEYFRAME_RULE" , JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(8) } }, |
107 | }; |
108 | |
109 | static_assert(CSSRule::UNKNOWN_RULE == 0, "UNKNOWN_RULE in CSSRule does not match value from IDL" ); |
110 | static_assert(CSSRule::STYLE_RULE == 1, "STYLE_RULE in CSSRule does not match value from IDL" ); |
111 | static_assert(CSSRule::CHARSET_RULE == 2, "CHARSET_RULE in CSSRule does not match value from IDL" ); |
112 | static_assert(CSSRule::IMPORT_RULE == 3, "IMPORT_RULE in CSSRule does not match value from IDL" ); |
113 | static_assert(CSSRule::MEDIA_RULE == 4, "MEDIA_RULE in CSSRule does not match value from IDL" ); |
114 | static_assert(CSSRule::FONT_FACE_RULE == 5, "FONT_FACE_RULE in CSSRule does not match value from IDL" ); |
115 | static_assert(CSSRule::PAGE_RULE == 6, "PAGE_RULE in CSSRule does not match value from IDL" ); |
116 | static_assert(CSSRule::KEYFRAMES_RULE == 7, "KEYFRAMES_RULE in CSSRule does not match value from IDL" ); |
117 | static_assert(CSSRule::KEYFRAME_RULE == 8, "KEYFRAME_RULE in CSSRule does not match value from IDL" ); |
118 | static_assert(CSSRule::NAMESPACE_RULE == 10, "NAMESPACE_RULE in CSSRule does not match value from IDL" ); |
119 | static_assert(CSSRule::SUPPORTS_RULE == 12, "SUPPORTS_RULE in CSSRule does not match value from IDL" ); |
120 | #if ENABLE(CSS_DEVICE_ADAPTATION) |
121 | static_assert(CSSRule::WEBKIT_VIEWPORT_RULE == 15, "WEBKIT_VIEWPORT_RULE in CSSRule does not match value from IDL" ); |
122 | #endif |
123 | static_assert(CSSRule::WEBKIT_KEYFRAMES_RULE == 7, "WEBKIT_KEYFRAMES_RULE in CSSRule does not match value from IDL" ); |
124 | static_assert(CSSRule::WEBKIT_KEYFRAME_RULE == 8, "WEBKIT_KEYFRAME_RULE in CSSRule does not match value from IDL" ); |
125 | |
126 | template<> JSValue JSCSSRuleConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject) |
127 | { |
128 | UNUSED_PARAM(vm); |
129 | return globalObject.functionPrototype(); |
130 | } |
131 | |
132 | template<> void JSCSSRuleConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject) |
133 | { |
134 | putDirect(vm, vm.propertyNames->prototype, JSCSSRule::prototype(vm, globalObject), JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
135 | putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String("CSSRule"_s )), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
136 | putDirect(vm, vm.propertyNames->length, jsNumber(0), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
137 | reifyStaticProperties(vm, JSCSSRule::info(), JSCSSRuleConstructorTableValues, *this); |
138 | } |
139 | |
140 | template<> const ClassInfo JSCSSRuleConstructor::s_info = { "CSSRule" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSCSSRuleConstructor) }; |
141 | |
142 | /* Hash table for prototype */ |
143 | |
144 | static const HashTableValue JSCSSRulePrototypeTableValues[] = |
145 | { |
146 | { "constructor" , static_cast<unsigned>(JSC::PropertyAttribute::DontEnum), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsCSSRuleConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSCSSRuleConstructor) } }, |
147 | { "type" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsCSSRuleType), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
148 | { "cssText" , static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsCSSRuleCssText), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSCSSRuleCssText) } }, |
149 | { "parentStyleSheet" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsCSSRuleParentStyleSheet), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
150 | { "parentRule" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsCSSRuleParentRule), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
151 | { "UNKNOWN_RULE" , JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(0) } }, |
152 | { "STYLE_RULE" , JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(1) } }, |
153 | { "CHARSET_RULE" , JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(2) } }, |
154 | { "IMPORT_RULE" , JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(3) } }, |
155 | { "MEDIA_RULE" , JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(4) } }, |
156 | { "FONT_FACE_RULE" , JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(5) } }, |
157 | { "PAGE_RULE" , JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(6) } }, |
158 | { "KEYFRAMES_RULE" , JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(7) } }, |
159 | { "KEYFRAME_RULE" , JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(8) } }, |
160 | { "NAMESPACE_RULE" , JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(10) } }, |
161 | { "SUPPORTS_RULE" , JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(12) } }, |
162 | #if ENABLE(CSS_DEVICE_ADAPTATION) |
163 | { "WEBKIT_VIEWPORT_RULE" , JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(15) } }, |
164 | #else |
165 | { 0, 0, NoIntrinsic, { 0, 0 } }, |
166 | #endif |
167 | { "WEBKIT_KEYFRAMES_RULE" , JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(7) } }, |
168 | { "WEBKIT_KEYFRAME_RULE" , JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(8) } }, |
169 | }; |
170 | |
171 | const ClassInfo JSCSSRulePrototype::s_info = { "CSSRulePrototype" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSCSSRulePrototype) }; |
172 | |
173 | void JSCSSRulePrototype::finishCreation(VM& vm) |
174 | { |
175 | Base::finishCreation(vm); |
176 | reifyStaticProperties(vm, JSCSSRule::info(), JSCSSRulePrototypeTableValues, *this); |
177 | } |
178 | |
179 | const ClassInfo JSCSSRule::s_info = { "CSSRule" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSCSSRule) }; |
180 | |
181 | JSCSSRule::JSCSSRule(Structure* structure, JSDOMGlobalObject& globalObject, Ref<CSSRule>&& impl) |
182 | : JSDOMWrapper<CSSRule>(structure, globalObject, WTFMove(impl)) |
183 | { |
184 | } |
185 | |
186 | void JSCSSRule::finishCreation(VM& vm) |
187 | { |
188 | Base::finishCreation(vm); |
189 | ASSERT(inherits(vm, info())); |
190 | |
191 | } |
192 | |
193 | JSObject* JSCSSRule::createPrototype(VM& vm, JSDOMGlobalObject& globalObject) |
194 | { |
195 | return JSCSSRulePrototype::create(vm, &globalObject, JSCSSRulePrototype::createStructure(vm, &globalObject, globalObject.objectPrototype())); |
196 | } |
197 | |
198 | JSObject* JSCSSRule::prototype(VM& vm, JSDOMGlobalObject& globalObject) |
199 | { |
200 | return getDOMPrototype<JSCSSRule>(vm, globalObject); |
201 | } |
202 | |
203 | JSValue JSCSSRule::getConstructor(VM& vm, const JSGlobalObject* globalObject) |
204 | { |
205 | return getDOMConstructor<JSCSSRuleConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject)); |
206 | } |
207 | |
208 | void JSCSSRule::destroy(JSC::JSCell* cell) |
209 | { |
210 | JSCSSRule* thisObject = static_cast<JSCSSRule*>(cell); |
211 | thisObject->JSCSSRule::~JSCSSRule(); |
212 | } |
213 | |
214 | template<> inline JSCSSRule* IDLAttribute<JSCSSRule>::cast(ExecState& state, EncodedJSValue thisValue) |
215 | { |
216 | return jsDynamicCast<JSCSSRule*>(state.vm(), JSValue::decode(thisValue)); |
217 | } |
218 | |
219 | EncodedJSValue jsCSSRuleConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName) |
220 | { |
221 | VM& vm = state->vm(); |
222 | auto throwScope = DECLARE_THROW_SCOPE(vm); |
223 | auto* prototype = jsDynamicCast<JSCSSRulePrototype*>(vm, JSValue::decode(thisValue)); |
224 | if (UNLIKELY(!prototype)) |
225 | return throwVMTypeError(state, throwScope); |
226 | return JSValue::encode(JSCSSRule::getConstructor(state->vm(), prototype->globalObject())); |
227 | } |
228 | |
229 | bool setJSCSSRuleConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
230 | { |
231 | VM& vm = state->vm(); |
232 | auto throwScope = DECLARE_THROW_SCOPE(vm); |
233 | auto* prototype = jsDynamicCast<JSCSSRulePrototype*>(vm, JSValue::decode(thisValue)); |
234 | if (UNLIKELY(!prototype)) { |
235 | throwVMTypeError(state, throwScope); |
236 | return false; |
237 | } |
238 | // Shadowing a built-in constructor |
239 | return prototype->putDirect(vm, vm.propertyNames->constructor, JSValue::decode(encodedValue)); |
240 | } |
241 | |
242 | static inline JSValue jsCSSRuleTypeGetter(ExecState& state, JSCSSRule& thisObject, ThrowScope& throwScope) |
243 | { |
244 | UNUSED_PARAM(throwScope); |
245 | UNUSED_PARAM(state); |
246 | auto& impl = thisObject.wrapped(); |
247 | JSValue result = toJS<IDLUnsignedShort>(state, throwScope, impl.type()); |
248 | return result; |
249 | } |
250 | |
251 | EncodedJSValue jsCSSRuleType(ExecState* state, EncodedJSValue thisValue, PropertyName) |
252 | { |
253 | return IDLAttribute<JSCSSRule>::get<jsCSSRuleTypeGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "type" ); |
254 | } |
255 | |
256 | static inline JSValue jsCSSRuleCssTextGetter(ExecState& state, JSCSSRule& thisObject, ThrowScope& throwScope) |
257 | { |
258 | UNUSED_PARAM(throwScope); |
259 | UNUSED_PARAM(state); |
260 | auto& impl = thisObject.wrapped(); |
261 | JSValue result = toJS<IDLNullable<IDLDOMString>>(state, throwScope, impl.cssText()); |
262 | return result; |
263 | } |
264 | |
265 | EncodedJSValue jsCSSRuleCssText(ExecState* state, EncodedJSValue thisValue, PropertyName) |
266 | { |
267 | return IDLAttribute<JSCSSRule>::get<jsCSSRuleCssTextGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "cssText" ); |
268 | } |
269 | |
270 | static inline bool setJSCSSRuleCssTextSetter(ExecState& state, JSCSSRule& thisObject, JSValue value, ThrowScope& throwScope) |
271 | { |
272 | UNUSED_PARAM(throwScope); |
273 | auto& impl = thisObject.wrapped(); |
274 | auto nativeValue = convert<IDLNullable<IDLDOMString>>(state, value); |
275 | RETURN_IF_EXCEPTION(throwScope, false); |
276 | AttributeSetter::call(state, throwScope, [&] { |
277 | return impl.setCssText(WTFMove(nativeValue)); |
278 | }); |
279 | return true; |
280 | } |
281 | |
282 | bool setJSCSSRuleCssText(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
283 | { |
284 | return IDLAttribute<JSCSSRule>::set<setJSCSSRuleCssTextSetter>(*state, thisValue, encodedValue, "cssText" ); |
285 | } |
286 | |
287 | static inline JSValue jsCSSRuleParentStyleSheetGetter(ExecState& state, JSCSSRule& thisObject, ThrowScope& throwScope) |
288 | { |
289 | UNUSED_PARAM(throwScope); |
290 | UNUSED_PARAM(state); |
291 | auto& impl = thisObject.wrapped(); |
292 | JSValue result = toJS<IDLNullable<IDLInterface<CSSStyleSheet>>>(state, *thisObject.globalObject(), throwScope, impl.parentStyleSheet()); |
293 | return result; |
294 | } |
295 | |
296 | EncodedJSValue jsCSSRuleParentStyleSheet(ExecState* state, EncodedJSValue thisValue, PropertyName) |
297 | { |
298 | return IDLAttribute<JSCSSRule>::get<jsCSSRuleParentStyleSheetGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "parentStyleSheet" ); |
299 | } |
300 | |
301 | static inline JSValue jsCSSRuleParentRuleGetter(ExecState& state, JSCSSRule& thisObject, ThrowScope& throwScope) |
302 | { |
303 | UNUSED_PARAM(throwScope); |
304 | UNUSED_PARAM(state); |
305 | auto& impl = thisObject.wrapped(); |
306 | JSValue result = toJS<IDLNullable<IDLInterface<CSSRule>>>(state, *thisObject.globalObject(), throwScope, impl.parentRule()); |
307 | return result; |
308 | } |
309 | |
310 | EncodedJSValue jsCSSRuleParentRule(ExecState* state, EncodedJSValue thisValue, PropertyName) |
311 | { |
312 | return IDLAttribute<JSCSSRule>::get<jsCSSRuleParentRuleGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "parentRule" ); |
313 | } |
314 | |
315 | void JSCSSRule::visitChildren(JSCell* cell, SlotVisitor& visitor) |
316 | { |
317 | auto* thisObject = jsCast<JSCSSRule*>(cell); |
318 | ASSERT_GC_OBJECT_INHERITS(thisObject, info()); |
319 | Base::visitChildren(thisObject, visitor); |
320 | thisObject->visitAdditionalChildren(visitor); |
321 | } |
322 | |
323 | void JSCSSRule::visitOutputConstraints(JSCell* cell, SlotVisitor& visitor) |
324 | { |
325 | auto* thisObject = jsCast<JSCSSRule*>(cell); |
326 | ASSERT_GC_OBJECT_INHERITS(thisObject, info()); |
327 | Base::visitOutputConstraints(thisObject, visitor); |
328 | thisObject->visitAdditionalChildren(visitor); |
329 | } |
330 | |
331 | void JSCSSRule::heapSnapshot(JSCell* cell, HeapSnapshotBuilder& builder) |
332 | { |
333 | auto* thisObject = jsCast<JSCSSRule*>(cell); |
334 | builder.setWrappedObjectForCell(cell, &thisObject->wrapped()); |
335 | if (thisObject->scriptExecutionContext()) |
336 | builder.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); |
337 | Base::heapSnapshot(cell, builder); |
338 | } |
339 | |
340 | bool JSCSSRuleOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor, const char** reason) |
341 | { |
342 | auto* jsCSSRule = jsCast<JSCSSRule*>(handle.slot()->asCell()); |
343 | void* root = WebCore::root(&jsCSSRule->wrapped()); |
344 | if (UNLIKELY(reason)) |
345 | *reason = "Reachable from jsCSSRule" ; |
346 | return visitor.containsOpaqueRoot(root); |
347 | } |
348 | |
349 | void JSCSSRuleOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context) |
350 | { |
351 | auto* jsCSSRule = static_cast<JSCSSRule*>(handle.slot()->asCell()); |
352 | auto& world = *static_cast<DOMWrapperWorld*>(context); |
353 | uncacheWrapper(world, &jsCSSRule->wrapped(), jsCSSRule); |
354 | } |
355 | |
356 | CSSRule* JSCSSRule::toWrapped(JSC::VM& vm, JSC::JSValue value) |
357 | { |
358 | if (auto* wrapper = jsDynamicCast<JSCSSRule*>(vm, value)) |
359 | return &wrapper->wrapped(); |
360 | return nullptr; |
361 | } |
362 | |
363 | } |
364 | |