1#![allow(non_camel_case_types,non_upper_case_globals,unsafe_op_in_unsafe_fn,unused_imports,unused_variables,unused_assignments,unused_mut,clippy::approx_constant,clippy::enum_variant_names,clippy::let_unit_value,clippy::needless_return,clippy::too_many_arguments,clippy::unnecessary_cast,clippy::upper_case_acronyms)]
4
5use crate::import::base::*;
6
7pub use self::StylePropertyMapReadOnly_Binding::{Wrap, StylePropertyMapReadOnlyMethods, GetProtoObject, DefineDOMInterface};
8pub mod StylePropertyMapReadOnly_Binding {
9use crate::import::module::*;
10
11unsafe extern "C" fn get<D: DomTypes>
12(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool{
13 let mut result = false;
14 wrap_panic(&mut || result = (|| {
15 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
16 let this = &*(this as *const D::StylePropertyMapReadOnly);
17 let args = &*args;
18 let argc = args.argc_;
19
20 if argc < 1 {
21 throw_type_error(cx.raw_cx(), "Not enough arguments to \"StylePropertyMapReadOnly.get\".");
22 return false;
23 }
24 let arg0: DOMString = match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(0)), StringificationBehavior::Default) {
25 Ok(ConversionResult::Success(value)) => value,
26 Ok(ConversionResult::Failure(error)) => {
27 throw_type_error(cx.raw_cx(), &error);
28 return false;
29
30 }
31 _ => {
32 return false;
33
34 },
35 }
36 ;
37 let result: Option<DomRoot<D::CSSStyleValue>> = this.Get(arg0);
38
39 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
40 return true;
41 })());
42 result
43}
44
45
46static get_methodinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
47
48pub(crate) fn init_get_methodinfo<D: DomTypes>() {
49 get_methodinfo.set(JSJitInfo {
50 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
51 method: Some(get::<D>)
52 },
53 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
54 protoID: PrototypeList::ID::StylePropertyMapReadOnly as u16,
55 },
56 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
57 _bitfield_align_1: [],
58 _bitfield_1: __BindgenBitfieldUnit::new(
59 new_jsjitinfo_bitfield_1!(
60 JSJitInfo_OpType::Method as u8,
61 JSJitInfo_AliasSet::AliasEverything as u8,
62 JSValueType::JSVAL_TYPE_UNKNOWN as u8,
63 false,
64 false,
65 false,
66 false,
67 false,
68 false,
69 0,
70 ).to_ne_bytes()
71 ),
72});
73}
74unsafe extern "C" fn has<D: DomTypes>
75(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool{
76 let mut result = false;
77 wrap_panic(&mut || result = (|| {
78 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
79 let this = &*(this as *const D::StylePropertyMapReadOnly);
80 let args = &*args;
81 let argc = args.argc_;
82
83 if argc < 1 {
84 throw_type_error(cx.raw_cx(), "Not enough arguments to \"StylePropertyMapReadOnly.has\".");
85 return false;
86 }
87 let arg0: DOMString = match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(0)), StringificationBehavior::Default) {
88 Ok(ConversionResult::Success(value)) => value,
89 Ok(ConversionResult::Failure(error)) => {
90 throw_type_error(cx.raw_cx(), &error);
91 return false;
92
93 }
94 _ => {
95 return false;
96
97 },
98 }
99 ;
100 let result: bool = this.Has(arg0);
101
102 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
103 return true;
104 })());
105 result
106}
107
108
109static has_methodinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
110
111pub(crate) fn init_has_methodinfo<D: DomTypes>() {
112 has_methodinfo.set(JSJitInfo {
113 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
114 method: Some(has::<D>)
115 },
116 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
117 protoID: PrototypeList::ID::StylePropertyMapReadOnly as u16,
118 },
119 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
120 _bitfield_align_1: [],
121 _bitfield_1: __BindgenBitfieldUnit::new(
122 new_jsjitinfo_bitfield_1!(
123 JSJitInfo_OpType::Method as u8,
124 JSJitInfo_AliasSet::AliasEverything as u8,
125 JSValueType::JSVAL_TYPE_BOOLEAN as u8,
126 false,
127 false,
128 false,
129 false,
130 false,
131 false,
132 0,
133 ).to_ne_bytes()
134 ),
135});
136}
137unsafe extern "C" fn getProperties<D: DomTypes>
138(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool{
139 let mut result = false;
140 wrap_panic(&mut || result = (|| {
141 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
142 let this = &*(this as *const D::StylePropertyMapReadOnly);
143 let args = &*args;
144 let argc = args.argc_;
145 let result: Vec<DOMString> = this.GetProperties();
146
147 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
148 return true;
149 })());
150 result
151}
152
153
154static getProperties_methodinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
155
156pub(crate) fn init_getProperties_methodinfo<D: DomTypes>() {
157 getProperties_methodinfo.set(JSJitInfo {
158 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
159 method: Some(getProperties::<D>)
160 },
161 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
162 protoID: PrototypeList::ID::StylePropertyMapReadOnly as u16,
163 },
164 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
165 _bitfield_align_1: [],
166 _bitfield_1: __BindgenBitfieldUnit::new(
167 new_jsjitinfo_bitfield_1!(
168 JSJitInfo_OpType::Method as u8,
169 JSJitInfo_AliasSet::AliasEverything as u8,
170 JSValueType::JSVAL_TYPE_OBJECT as u8,
171 true,
172 false,
173 false,
174 false,
175 false,
176 false,
177 0,
178 ).to_ne_bytes()
179 ),
180});
181}
182unsafe extern "C" fn _finalize<D: DomTypes>
183(_cx: *mut GCContext, obj: *mut JSObject){
184 wrap_panic(&mut || {
185
186 let this = native_from_object_static::<D::StylePropertyMapReadOnly>(obj).unwrap();
187 finalize_common(this);
188 })
189}
190
191unsafe extern "C" fn _trace<D: DomTypes>
192(trc: *mut JSTracer, obj: *mut JSObject){
193 wrap_panic(&mut || {
194
195 let this = native_from_object_static::<D::StylePropertyMapReadOnly>(obj).unwrap();
196 if this.is_null() { return; } (*this).trace(trc);
198 })
199}
200
201
202static CLASS_OPS: ThreadUnsafeOnceLock<JSClassOps> = ThreadUnsafeOnceLock::new();
203
204pub(crate) fn init_class_ops<D: DomTypes>() {
205 CLASS_OPS.set(JSClassOps {
206 addProperty: None,
207 delProperty: None,
208 enumerate: None,
209 newEnumerate: None,
210 resolve: None,
211 mayResolve: None,
212 finalize: Some(_finalize::<D>),
213 call: None,
214 construct: None,
215 trace: Some(_trace::<D>),
216 });
217}
218
219pub static Class: ThreadUnsafeOnceLock<DOMJSClass> = ThreadUnsafeOnceLock::new();
220
221pub(crate) fn init_domjs_class<D: DomTypes>() {
222 init_class_ops::<D>();
223 Class.set(DOMJSClass {
224 base: JSClass {
225 name: c"StylePropertyMapReadOnly".as_ptr(),
226 flags: JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE |
227 (((1) & JSCLASS_RESERVED_SLOTS_MASK) << JSCLASS_RESERVED_SLOTS_SHIFT)
228 ,
229 cOps: unsafe { CLASS_OPS.get() },
230 spec: ptr::null(),
231 ext: ptr::null(),
232 oOps: ptr::null(),
233 },
234 dom_class:
235DOMClass {
236 interface_chain: [ PrototypeList::ID::StylePropertyMapReadOnly, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last ],
237 depth: 0,
238 type_id: crate::codegen::InheritTypes::TopTypeId { alone: () },
239 malloc_size_of: malloc_size_of_including_raw_self::<D::StylePropertyMapReadOnly> as unsafe fn(&mut _, _) -> _,
240 global: Globals::EMPTY,
241},
242 });
243}
244
245#[cfg_attr(crown, allow(crown::unrooted_must_root))] pub unsafe fn Wrap<D: DomTypes>
246(cx: SafeJSContext, scope: &D::GlobalScope, given_proto: Option<HandleObject>, object: Box<D::StylePropertyMapReadOnly>, _can_gc: CanGc) -> DomRoot<D::StylePropertyMapReadOnly>{
247
248 let raw = Root::new(MaybeUnreflectedDom::from_box(object));
249
250 let scope = scope.reflector().get_jsobject();
251 assert!(!scope.get().is_null());
252 assert!(((*get_object_class(scope.get())).flags & JSCLASS_IS_GLOBAL) != 0);
253 let _ac = JSAutoRealm::new(cx.raw_cx(), scope.get());
254
255 rooted!(&in(cx) let mut canonical_proto = ptr::null_mut::<JSObject>());
256 GetProtoObject::<D>(cx, scope, canonical_proto.handle_mut());
257 assert!(!canonical_proto.is_null());
258
259
260 rooted!(&in(cx) let mut proto = ptr::null_mut::<JSObject>());
261 if let Some(given) = given_proto {
262 proto.set(*given);
263 if get_context_realm(cx.raw_cx()) != get_object_realm(*given) {
264 assert!(JS_WrapObject(cx.raw_cx(), proto.handle_mut()));
265 }
266 } else {
267 proto.set(*canonical_proto);
268 }
269 rooted!(&in(cx) let obj = JS_NewObjectWithGivenProto(
270 cx.raw_cx(),
271 &Class.get().base,
272 proto.handle(),
273 ));
274 assert!(!obj.is_null());
275 JS_SetReservedSlot(
276 obj.get(),
277 DOM_OBJECT_SLOT,
278 &PrivateValue(raw.as_ptr() as *const libc::c_void),
279 );
280
281 let root = raw.reflect_with(obj.get());
282
283
284
285 DomRoot::from_ref(&*root)
286}
287
288pub trait StylePropertyMapReadOnlyMethods<D: DomTypes> {
289 fn Get(&self, r#property: DOMString) -> Option<DomRoot<D::CSSStyleValue>>;
290 fn Has(&self, r#property: DOMString) -> bool;
291 fn GetProperties(&self, ) -> Vec<DOMString>;
292}
293static sMethods_specs: ThreadUnsafeOnceLock<&[&[JSFunctionSpec]]> = ThreadUnsafeOnceLock::new();
294
295pub(crate) fn init_sMethods_specs<D: DomTypes>() {
296 sMethods_specs.set(Box::leak(Box::new([&Box::leak(Box::new([
297 JSFunctionSpec {
298 name: JSPropertySpec_Name { string_: c"get".as_ptr() },
299 call: JSNativeWrapper { op: Some(generic_method::<false>), info: unsafe { get_methodinfo.get() } as *const _ as *const JSJitInfo },
300 nargs: 1,
301 flags: (JSPROP_ENUMERATE) as u16,
302 selfHostedName: ptr::null()
303 },
304 JSFunctionSpec {
305 name: JSPropertySpec_Name { string_: c"has".as_ptr() },
306 call: JSNativeWrapper { op: Some(generic_method::<false>), info: unsafe { has_methodinfo.get() } as *const _ as *const JSJitInfo },
307 nargs: 1,
308 flags: (JSPROP_ENUMERATE) as u16,
309 selfHostedName: ptr::null()
310 },
311 JSFunctionSpec {
312 name: JSPropertySpec_Name { string_: c"getProperties".as_ptr() },
313 call: JSNativeWrapper { op: Some(generic_method::<false>), info: unsafe { getProperties_methodinfo.get() } as *const _ as *const JSJitInfo },
314 nargs: 0,
315 flags: (JSPROP_ENUMERATE) as u16,
316 selfHostedName: ptr::null()
317 },
318 JSFunctionSpec {
319 name: JSPropertySpec_Name { string_: ptr::null() },
320 call: JSNativeWrapper { op: None, info: ptr::null() },
321 nargs: 0,
322 flags: 0,
323 selfHostedName: ptr::null()
324 }]))[..]
325])));
326}static sMethods: ThreadUnsafeOnceLock<&[Guard<&[JSFunctionSpec]>]> = ThreadUnsafeOnceLock::new();
327
328pub(crate) fn init_sMethods_prefs<D: DomTypes>() {
329 sMethods.set(Box::leak(Box::new([ Guard::new(&[Condition::Exposed(Globals::PAINT_WORKLET_GLOBAL_SCOPE),Condition::Exposed(Globals::TEST_WORKLET_GLOBAL_SCOPE)], (unsafe { sMethods_specs.get() })[0])])));
330}static sAttributes_specs: ThreadUnsafeOnceLock<&[&[JSPropertySpec]]> = ThreadUnsafeOnceLock::new();
331
332pub(crate) fn init_sAttributes_specs<D: DomTypes>() {
333 sAttributes_specs.set(Box::leak(Box::new([&Box::leak(Box::new([
334 JSPropertySpec {
335 name: JSPropertySpec_Name { symbol_: SymbolCode::toStringTag as usize + 1 },
336 attributes_: (JSPROP_READONLY),
337 kind_: (JSPropertySpec_Kind::Value),
338 u: JSPropertySpec_AccessorsOrValue {
339 value: JSPropertySpec_ValueWrapper {
340 type_: JSPropertySpec_ValueWrapper_Type::String,
341 __bindgen_anon_1: JSPropertySpec_ValueWrapper__bindgen_ty_1 {
342 string: c"StylePropertyMapReadOnly".as_ptr(),
343 }
344 }
345 }
346 }
347,
348 JSPropertySpec::ZERO]))[..]
349])));
350}static sAttributes: ThreadUnsafeOnceLock<&[Guard<&[JSPropertySpec]>]> = ThreadUnsafeOnceLock::new();
351
352pub(crate) fn init_sAttributes_prefs<D: DomTypes>() {
353 sAttributes.set(Box::leak(Box::new([ Guard::new(&[Condition::Satisfied], (unsafe { sAttributes_specs.get() })[0])])));
354}
355pub fn GetProtoObject<D: DomTypes>
356(cx: SafeJSContext, global: HandleObject, mut rval: MutableHandleObject){
357 get_per_interface_object_handle(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::StylePropertyMapReadOnly), CreateInterfaceObjects::<D>, rval)
359}
360
361
362static PrototypeClass: JSClass = JSClass {
363 name: c"StylePropertyMapReadOnlyPrototype".as_ptr(),
364 flags:
365 (0 ) << JSCLASS_RESERVED_SLOTS_SHIFT,
367 cOps: ptr::null(),
368 spec: ptr::null(),
369 ext: ptr::null(),
370 oOps: ptr::null(),
371};
372
373
374static INTERFACE_OBJECT_CLASS: ThreadUnsafeOnceLock<NonCallbackInterfaceObjectClass> = ThreadUnsafeOnceLock::new();
375
376pub(crate) fn init_interface_object<D: DomTypes>() {
377 INTERFACE_OBJECT_CLASS.set(NonCallbackInterfaceObjectClass::new(
378 Box::leak(Box::new(InterfaceConstructorBehavior::throw())),
379 b"function StylePropertyMapReadOnly() {\n [native code]\n}",
380 PrototypeList::ID::StylePropertyMapReadOnly,
381 0,
382 ));
383}
384
385pub fn DefineDOMInterface<D: DomTypes>
386(cx: SafeJSContext, global: HandleObject){
387 define_dom_interface(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::StylePropertyMapReadOnly),CreateInterfaceObjects::<D>, ConstructorEnabled::<D>)
388}
389
390pub fn ConstructorEnabled<D: DomTypes>
391(aCx: SafeJSContext, aObj: HandleObject) -> bool{
392 is_exposed_in(aObj, Globals::PAINT_WORKLET_GLOBAL_SCOPE | Globals::TEST_WORKLET_GLOBAL_SCOPE) &&
393 pref!(dom_worklet_enabled)
394}
395
396unsafe fn CreateInterfaceObjects<D: DomTypes>
397(cx: SafeJSContext, global: HandleObject, cache: *mut ProtoOrIfaceArray){
398
399 rooted!(&in(cx) let mut prototype_proto = ptr::null_mut::<JSObject>());
400 prototype_proto.set(GetRealmObjectPrototype(cx.raw_cx()));
401 assert!(!prototype_proto.is_null());
402
403 rooted!(&in(cx) let mut prototype = ptr::null_mut::<JSObject>());
404 create_interface_prototype_object::<D>(cx,
405 global,
406 prototype_proto.handle(),
407 &PrototypeClass,
408 sMethods.get(),
409 sAttributes.get(),
410 &[],
411 &[],
412 prototype.handle_mut());
413 assert!(!prototype.is_null());
414 assert!((*cache)[PrototypeList::ID::StylePropertyMapReadOnly as usize].is_null());
415 (*cache)[PrototypeList::ID::StylePropertyMapReadOnly as usize] = prototype.get();
416 <*mut JSObject>::post_barrier((*cache).as_mut_ptr().offset(PrototypeList::ID::StylePropertyMapReadOnly as isize),
417 ptr::null_mut(),
418 prototype.get());
419
420 rooted!(&in(cx) let mut interface_proto = ptr::null_mut::<JSObject>());
421 interface_proto.set(GetRealmFunctionPrototype(cx.raw_cx()));
422
423 assert!(!interface_proto.is_null());
424
425 rooted!(&in(cx) let mut interface = ptr::null_mut::<JSObject>());
426 create_noncallback_interface_object::<D>(cx,
427 global,
428 interface_proto.handle(),
429 INTERFACE_OBJECT_CLASS.get(),
430 &[],
431 &[],
432 &[],
433 prototype.handle(),
434 c"StylePropertyMapReadOnly",
435 0,
436 &[],
437 interface.handle_mut());
438 assert!(!interface.is_null());
439}
440
441
442 pub(crate) fn init_statics<D: DomTypes>() {
443 init_interface_object::<D>();
444 init_domjs_class::<D>();
445 crate::codegen::GenericBindings::StylePropertyMapReadOnlyBinding::StylePropertyMapReadOnly_Binding::init_get_methodinfo::<D>();
446crate::codegen::GenericBindings::StylePropertyMapReadOnlyBinding::StylePropertyMapReadOnly_Binding::init_has_methodinfo::<D>();
447crate::codegen::GenericBindings::StylePropertyMapReadOnlyBinding::StylePropertyMapReadOnly_Binding::init_getProperties_methodinfo::<D>();
448
449
450
451 init_sMethods_specs::<D>();
452init_sMethods_prefs::<D>();
453init_sAttributes_specs::<D>();
454init_sAttributes_prefs::<D>();
455 }
456 }