script_bindings/home/runner/work/servo/servo/target/debug/build/script_bindings-d55f55d5af1efaee/out/Bindings/
ShadowRootBinding.rs

1/* THIS FILE IS AUTOGENERATED - DO NOT EDIT */
2
3#![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::codegen::GenericBindings::DocumentFragmentBinding::DocumentFragment_Binding;
6use crate::codegen::GenericBindings::ElementBinding::GetHTMLOptions;
7use crate::codegen::GenericBindings::EventHandlerBinding::EventHandlerNonNull;
8use crate::codegen::GenericBindings::EventTargetBinding::EventTarget_Binding;
9use crate::codegen::GenericBindings::NodeBinding::Node_Binding;
10use crate::import::base::*;
11
12
13#[repr(usize)]
14#[derive(Copy, Clone, Debug, JSTraceable, MallocSizeOf, PartialEq)]
15pub enum ShadowRootMode {
16    Open,
17    Closed
18}
19pub mod ShadowRootModeValues {
20
21    use crate::utils::find_enum_value;
22    use js::conversions::ConversionResult;
23    use js::conversions::FromJSValConvertible;
24    use js::conversions::ToJSValConvertible;
25    use js::context::RawJSContext;
26    use js::rust::HandleValue;
27    use js::rust::MutableHandleValue;
28    use js::jsval::JSVal;
29
30    pub(crate) const pairs: &[(&str, super::ShadowRootMode)] = &[
31        ("open", super::ShadowRootMode::Open),
32        ("closed", super::ShadowRootMode::Closed),
33    ];
34
35    impl super::ShadowRootMode {
36        pub fn as_str(&self) -> &'static str {
37            pairs[*self as usize].0
38        }
39    }
40
41    impl Default for super::ShadowRootMode {
42        fn default() -> super::ShadowRootMode {
43            pairs[0].1
44        }
45    }
46
47    impl std::str::FromStr for super::ShadowRootMode {
48        type Err = ();
49
50        fn from_str(s: &str) -> Result<Self, Self::Err> {
51            pairs
52                .iter()
53                .find(|&&(key, _)| s == key)
54                .map(|&(_, ev)| ev)
55                .ok_or(())
56        }
57    }
58
59    impl ToJSValConvertible for super::ShadowRootMode {
60        unsafe fn to_jsval(&self, cx: *mut RawJSContext, rval: MutableHandleValue) {
61            pairs[*self as usize].0.to_jsval(cx, rval);
62        }
63    }
64
65    impl FromJSValConvertible for super::ShadowRootMode {
66        type Config = ();
67        unsafe fn from_jsval(cx: *mut RawJSContext, value: HandleValue, _option: ())
68                             -> Result<ConversionResult<super::ShadowRootMode>, ()> {
69            match find_enum_value(cx, value, pairs) {
70                Err(_) => Err(()),
71                Ok((None, search)) => {
72                    Ok(ConversionResult::Failure(
73                        format!("'{}' is not a valid enum value for enumeration 'ShadowRootMode'.", search).into()
74                    ))
75                }
76                Ok((Some(&value), _)) => Ok(ConversionResult::Success(value)),
77            }
78        }
79    }
80        } // mod ShadowRootModeValues
81
82
83#[repr(usize)]
84#[derive(Copy, Clone, Debug, JSTraceable, MallocSizeOf, PartialEq)]
85pub enum SlotAssignmentMode {
86    Manual,
87    Named
88}
89pub mod SlotAssignmentModeValues {
90
91    use crate::utils::find_enum_value;
92    use js::conversions::ConversionResult;
93    use js::conversions::FromJSValConvertible;
94    use js::conversions::ToJSValConvertible;
95    use js::context::RawJSContext;
96    use js::rust::HandleValue;
97    use js::rust::MutableHandleValue;
98    use js::jsval::JSVal;
99
100    pub(crate) const pairs: &[(&str, super::SlotAssignmentMode)] = &[
101        ("manual", super::SlotAssignmentMode::Manual),
102        ("named", super::SlotAssignmentMode::Named),
103    ];
104
105    impl super::SlotAssignmentMode {
106        pub fn as_str(&self) -> &'static str {
107            pairs[*self as usize].0
108        }
109    }
110
111    impl Default for super::SlotAssignmentMode {
112        fn default() -> super::SlotAssignmentMode {
113            pairs[0].1
114        }
115    }
116
117    impl std::str::FromStr for super::SlotAssignmentMode {
118        type Err = ();
119
120        fn from_str(s: &str) -> Result<Self, Self::Err> {
121            pairs
122                .iter()
123                .find(|&&(key, _)| s == key)
124                .map(|&(_, ev)| ev)
125                .ok_or(())
126        }
127    }
128
129    impl ToJSValConvertible for super::SlotAssignmentMode {
130        unsafe fn to_jsval(&self, cx: *mut RawJSContext, rval: MutableHandleValue) {
131            pairs[*self as usize].0.to_jsval(cx, rval);
132        }
133    }
134
135    impl FromJSValConvertible for super::SlotAssignmentMode {
136        type Config = ();
137        unsafe fn from_jsval(cx: *mut RawJSContext, value: HandleValue, _option: ())
138                             -> Result<ConversionResult<super::SlotAssignmentMode>, ()> {
139            match find_enum_value(cx, value, pairs) {
140                Err(_) => Err(()),
141                Ok((None, search)) => {
142                    Ok(ConversionResult::Failure(
143                        format!("'{}' is not a valid enum value for enumeration 'SlotAssignmentMode'.", search).into()
144                    ))
145                }
146                Ok((Some(&value), _)) => Ok(ConversionResult::Success(value)),
147            }
148        }
149    }
150        } // mod SlotAssignmentModeValues
151
152pub use self::ShadowRoot_Binding::{Wrap, ShadowRootMethods, GetProtoObject, DefineDOMInterface};
153pub mod ShadowRoot_Binding {
154use crate::codegen::GenericBindings::DocumentFragmentBinding::DocumentFragment_Binding;
155use crate::codegen::GenericBindings::ElementBinding::GetHTMLOptions;
156use crate::codegen::GenericBindings::EventHandlerBinding::EventHandlerNonNull;
157use crate::codegen::GenericBindings::EventTargetBinding::EventTarget_Binding;
158use crate::codegen::GenericBindings::NodeBinding::Node_Binding;
159use crate::codegen::GenericBindings::ShadowRootBinding::ShadowRootMode;
160use crate::codegen::GenericBindings::ShadowRootBinding::ShadowRootModeValues;
161use crate::codegen::GenericBindings::ShadowRootBinding::SlotAssignmentMode;
162use crate::codegen::GenericBindings::ShadowRootBinding::SlotAssignmentModeValues;
163use crate::import::module::*;
164
165unsafe extern "C" fn get_mode<D: DomTypes>
166(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
167    let mut result = false;
168    wrap_panic(&mut || result = (|| {
169        let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
170        let this = &*(this as *const D::ShadowRoot);
171        let result: ShadowRootMode = this.Mode();
172
173        (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
174        return true;
175    })());
176    result
177}
178
179
180static mode_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
181
182pub(crate) fn init_mode_getterinfo<D: DomTypes>() {
183    mode_getterinfo.set(JSJitInfo {
184    __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
185        getter: Some(get_mode::<D>)
186    },
187    __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
188        protoID: PrototypeList::ID::ShadowRoot as u16,
189    },
190    __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 3 },
191    _bitfield_align_1: [],
192    _bitfield_1: __BindgenBitfieldUnit::new(
193        new_jsjitinfo_bitfield_1!(
194            JSJitInfo_OpType::Getter as u8,
195            JSJitInfo_AliasSet::AliasEverything as u8,
196            JSValueType::JSVAL_TYPE_STRING as u8,
197            true,
198            false,
199            false,
200            false,
201            false,
202            false,
203            0,
204        ).to_ne_bytes()
205    ),
206});
207}
208unsafe extern "C" fn get_delegatesFocus<D: DomTypes>
209(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
210    let mut result = false;
211    wrap_panic(&mut || result = (|| {
212        let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
213        let this = &*(this as *const D::ShadowRoot);
214        let result: bool = this.DelegatesFocus();
215
216        (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
217        return true;
218    })());
219    result
220}
221
222
223static delegatesFocus_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
224
225pub(crate) fn init_delegatesFocus_getterinfo<D: DomTypes>() {
226    delegatesFocus_getterinfo.set(JSJitInfo {
227    __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
228        getter: Some(get_delegatesFocus::<D>)
229    },
230    __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
231        protoID: PrototypeList::ID::ShadowRoot as u16,
232    },
233    __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 3 },
234    _bitfield_align_1: [],
235    _bitfield_1: __BindgenBitfieldUnit::new(
236        new_jsjitinfo_bitfield_1!(
237            JSJitInfo_OpType::Getter as u8,
238            JSJitInfo_AliasSet::AliasEverything as u8,
239            JSValueType::JSVAL_TYPE_BOOLEAN as u8,
240            true,
241            false,
242            false,
243            false,
244            false,
245            false,
246            0,
247        ).to_ne_bytes()
248    ),
249});
250}
251unsafe extern "C" fn get_slotAssignment<D: DomTypes>
252(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
253    let mut result = false;
254    wrap_panic(&mut || result = (|| {
255        let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
256        let this = &*(this as *const D::ShadowRoot);
257        let result: SlotAssignmentMode = this.SlotAssignment();
258
259        (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
260        return true;
261    })());
262    result
263}
264
265
266static slotAssignment_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
267
268pub(crate) fn init_slotAssignment_getterinfo<D: DomTypes>() {
269    slotAssignment_getterinfo.set(JSJitInfo {
270    __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
271        getter: Some(get_slotAssignment::<D>)
272    },
273    __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
274        protoID: PrototypeList::ID::ShadowRoot as u16,
275    },
276    __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 3 },
277    _bitfield_align_1: [],
278    _bitfield_1: __BindgenBitfieldUnit::new(
279        new_jsjitinfo_bitfield_1!(
280            JSJitInfo_OpType::Getter as u8,
281            JSJitInfo_AliasSet::AliasEverything as u8,
282            JSValueType::JSVAL_TYPE_STRING as u8,
283            true,
284            false,
285            false,
286            false,
287            false,
288            false,
289            0,
290        ).to_ne_bytes()
291    ),
292});
293}
294unsafe extern "C" fn get_clonable<D: DomTypes>
295(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
296    let mut result = false;
297    wrap_panic(&mut || result = (|| {
298        let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
299        let this = &*(this as *const D::ShadowRoot);
300        let result: bool = this.Clonable();
301
302        (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
303        return true;
304    })());
305    result
306}
307
308
309static clonable_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
310
311pub(crate) fn init_clonable_getterinfo<D: DomTypes>() {
312    clonable_getterinfo.set(JSJitInfo {
313    __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
314        getter: Some(get_clonable::<D>)
315    },
316    __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
317        protoID: PrototypeList::ID::ShadowRoot as u16,
318    },
319    __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 3 },
320    _bitfield_align_1: [],
321    _bitfield_1: __BindgenBitfieldUnit::new(
322        new_jsjitinfo_bitfield_1!(
323            JSJitInfo_OpType::Getter as u8,
324            JSJitInfo_AliasSet::AliasEverything as u8,
325            JSValueType::JSVAL_TYPE_BOOLEAN as u8,
326            true,
327            false,
328            false,
329            false,
330            false,
331            false,
332            0,
333        ).to_ne_bytes()
334    ),
335});
336}
337unsafe extern "C" fn get_serializable<D: DomTypes>
338(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
339    let mut result = false;
340    wrap_panic(&mut || result = (|| {
341        let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
342        let this = &*(this as *const D::ShadowRoot);
343        let result: bool = this.Serializable();
344
345        (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
346        return true;
347    })());
348    result
349}
350
351
352static serializable_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
353
354pub(crate) fn init_serializable_getterinfo<D: DomTypes>() {
355    serializable_getterinfo.set(JSJitInfo {
356    __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
357        getter: Some(get_serializable::<D>)
358    },
359    __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
360        protoID: PrototypeList::ID::ShadowRoot as u16,
361    },
362    __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 3 },
363    _bitfield_align_1: [],
364    _bitfield_1: __BindgenBitfieldUnit::new(
365        new_jsjitinfo_bitfield_1!(
366            JSJitInfo_OpType::Getter as u8,
367            JSJitInfo_AliasSet::AliasEverything as u8,
368            JSValueType::JSVAL_TYPE_BOOLEAN as u8,
369            true,
370            false,
371            false,
372            false,
373            false,
374            false,
375            0,
376        ).to_ne_bytes()
377    ),
378});
379}
380unsafe extern "C" fn get_host<D: DomTypes>
381(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
382    let mut result = false;
383    wrap_panic(&mut || result = (|| {
384        let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
385        let this = &*(this as *const D::ShadowRoot);
386        let result: DomRoot<D::Element> = this.Host();
387
388        (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
389        return true;
390    })());
391    result
392}
393
394
395static host_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
396
397pub(crate) fn init_host_getterinfo<D: DomTypes>() {
398    host_getterinfo.set(JSJitInfo {
399    __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
400        getter: Some(get_host::<D>)
401    },
402    __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
403        protoID: PrototypeList::ID::ShadowRoot as u16,
404    },
405    __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 3 },
406    _bitfield_align_1: [],
407    _bitfield_1: __BindgenBitfieldUnit::new(
408        new_jsjitinfo_bitfield_1!(
409            JSJitInfo_OpType::Getter as u8,
410            JSJitInfo_AliasSet::AliasEverything as u8,
411            JSValueType::JSVAL_TYPE_OBJECT as u8,
412            true,
413            false,
414            false,
415            false,
416            false,
417            false,
418            0,
419        ).to_ne_bytes()
420    ),
421});
422}
423unsafe extern "C" fn get_onslotchange<D: DomTypes>
424(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
425    let mut result = false;
426    wrap_panic(&mut || result = (|| {
427        let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
428        let this = &*(this as *const D::ShadowRoot);
429        let result: Option<Rc<crate::codegen::GenericBindings::EventHandlerBinding::EventHandlerNonNull<D>>> = this.GetOnslotchange();
430
431        (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
432        return true;
433    })());
434    result
435}
436
437unsafe extern "C" fn set_onslotchange<D: DomTypes>
438(cx: *mut RawJSContext, obj: RawHandleObject, this: *mut libc::c_void, args: JSJitSetterCallArgs) -> bool{
439    let mut result = false;
440    wrap_panic(&mut || result = {
441        let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
442        let this = &*(this as *const D::ShadowRoot);
443        let arg0: Option<Rc<EventHandlerNonNull<D>>> = if HandleValue::from_raw(args.get(0)).get().is_object() {
444            Some(EventHandlerNonNull::<D>::new(SafeJSContext::from_ptr(cx.raw_cx()), HandleValue::from_raw(args.get(0)).get().to_object()))
445        } else {
446            None
447        };
448        let result: () = this.SetOnslotchange(arg0);
449
450        true
451    });
452    result
453}
454
455
456static onslotchange_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
457
458pub(crate) fn init_onslotchange_getterinfo<D: DomTypes>() {
459    onslotchange_getterinfo.set(JSJitInfo {
460    __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
461        getter: Some(get_onslotchange::<D>)
462    },
463    __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
464        protoID: PrototypeList::ID::ShadowRoot as u16,
465    },
466    __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 3 },
467    _bitfield_align_1: [],
468    _bitfield_1: __BindgenBitfieldUnit::new(
469        new_jsjitinfo_bitfield_1!(
470            JSJitInfo_OpType::Getter as u8,
471            JSJitInfo_AliasSet::AliasEverything as u8,
472            JSValueType::JSVAL_TYPE_UNKNOWN as u8,
473            true,
474            false,
475            false,
476            false,
477            false,
478            false,
479            0,
480        ).to_ne_bytes()
481    ),
482});
483}
484static onslotchange_setterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
485
486pub(crate) fn init_onslotchange_setterinfo<D: DomTypes>() {
487    onslotchange_setterinfo.set(JSJitInfo {
488    __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
489        setter: Some(set_onslotchange::<D>)
490    },
491    __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
492        protoID: PrototypeList::ID::ShadowRoot as u16,
493    },
494    __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 3 },
495    _bitfield_align_1: [],
496    _bitfield_1: __BindgenBitfieldUnit::new(
497        new_jsjitinfo_bitfield_1!(
498            JSJitInfo_OpType::Setter as u8,
499            JSJitInfo_AliasSet::AliasEverything as u8,
500            JSValueType::JSVAL_TYPE_UNDEFINED as u8,
501            false,
502            false,
503            false,
504            false,
505            false,
506            false,
507            0,
508        ).to_ne_bytes()
509    ),
510});
511}
512unsafe extern "C" fn setHTMLUnsafe<D: DomTypes>
513(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool{
514    let mut result = false;
515    wrap_panic(&mut || result = (|| {
516        let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
517        let this = &*(this as *const D::ShadowRoot);
518        let args = &*args;
519        let argc = args.argc_;
520
521        if argc < 1 {
522            throw_type_error(cx.raw_cx(), "Not enough arguments to \"ShadowRoot.setHTMLUnsafe\".");
523            return false;
524        }
525        let arg0: GenericUnionTypes::TrustedHTMLOrString::<D> = match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(0)), ()) {
526            Ok(ConversionResult::Success(value)) => value,
527            Ok(ConversionResult::Failure(error)) => {
528                throw_type_error(cx.raw_cx(), &error);
529        return false;
530
531            }
532            _ => {
533                return false;
534
535            },
536        }
537        ;
538        <D as DomHelpers<D>>::push_new_element_queue();
539
540        let result: Result<(), Error> = this.SetHTMLUnsafe(arg0, CanGc::note());
541        <D as DomHelpers<D>>::pop_current_element_queue(CanGc::note());
542
543        let result = match result {
544            Ok(result) => result,
545            Err(e) => {
546                <D as DomHelpers<D>>::throw_dom_exception(SafeJSContext::from_ptr(cx.raw_cx()), &this.global_(InRealm::already(&AlreadyInRealm::assert_for_cx(SafeJSContext::from_ptr(cx.raw_cx())))), e, CanGc::note());
547                return false;
548            },
549        };
550
551        (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
552        return true;
553    })());
554    result
555}
556
557
558static setHTMLUnsafe_methodinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
559
560pub(crate) fn init_setHTMLUnsafe_methodinfo<D: DomTypes>() {
561    setHTMLUnsafe_methodinfo.set(JSJitInfo {
562    __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
563        method: Some(setHTMLUnsafe::<D>)
564    },
565    __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
566        protoID: PrototypeList::ID::ShadowRoot as u16,
567    },
568    __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 3 },
569    _bitfield_align_1: [],
570    _bitfield_1: __BindgenBitfieldUnit::new(
571        new_jsjitinfo_bitfield_1!(
572            JSJitInfo_OpType::Method as u8,
573            JSJitInfo_AliasSet::AliasEverything as u8,
574            JSValueType::JSVAL_TYPE_UNDEFINED as u8,
575            false,
576            false,
577            false,
578            false,
579            false,
580            false,
581            0,
582        ).to_ne_bytes()
583    ),
584});
585}
586unsafe extern "C" fn getHTML<D: DomTypes>
587(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool{
588    let mut result = false;
589    wrap_panic(&mut || result = (|| {
590        let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
591        let this = &*(this as *const D::ShadowRoot);
592        let args = &*args;
593        let argc = args.argc_;
594        let arg0: crate::codegen::GenericBindings::ElementBinding::GetHTMLOptions<D> = if args.get(0).is_undefined() {
595            crate::codegen::GenericBindings::ElementBinding::GetHTMLOptions::empty()
596        } else {
597            match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(0)), ()) {
598                Ok(ConversionResult::Success(value)) => value,
599                Ok(ConversionResult::Failure(error)) => {
600                    throw_type_error(cx.raw_cx(), &error);
601            return false;
602
603                }
604                _ => {
605                    return false;
606
607                },
608            }
609
610        };
611        let result: DOMString = this.GetHTML(&arg0, CanGc::note());
612
613        (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
614        return true;
615    })());
616    result
617}
618
619
620static getHTML_methodinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
621
622pub(crate) fn init_getHTML_methodinfo<D: DomTypes>() {
623    getHTML_methodinfo.set(JSJitInfo {
624    __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
625        method: Some(getHTML::<D>)
626    },
627    __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
628        protoID: PrototypeList::ID::ShadowRoot as u16,
629    },
630    __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 3 },
631    _bitfield_align_1: [],
632    _bitfield_1: __BindgenBitfieldUnit::new(
633        new_jsjitinfo_bitfield_1!(
634            JSJitInfo_OpType::Method as u8,
635            JSJitInfo_AliasSet::AliasEverything as u8,
636            JSValueType::JSVAL_TYPE_STRING as u8,
637            false,
638            false,
639            false,
640            false,
641            false,
642            false,
643            0,
644        ).to_ne_bytes()
645    ),
646});
647}
648unsafe extern "C" fn get_innerHTML<D: DomTypes>
649(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
650    let mut result = false;
651    wrap_panic(&mut || result = (|| {
652        let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
653        let this = &*(this as *const D::ShadowRoot);
654        <D as DomHelpers<D>>::push_new_element_queue();
655
656        let result: Result<GenericUnionTypes::TrustedHTMLOrNullIsEmptyString::<D>, Error> = this.GetInnerHTML(CanGc::note());
657        <D as DomHelpers<D>>::pop_current_element_queue(CanGc::note());
658
659        let result = match result {
660            Ok(result) => result,
661            Err(e) => {
662                <D as DomHelpers<D>>::throw_dom_exception(SafeJSContext::from_ptr(cx.raw_cx()), &this.global_(InRealm::already(&AlreadyInRealm::assert_for_cx(SafeJSContext::from_ptr(cx.raw_cx())))), e, CanGc::note());
663                return false;
664            },
665        };
666
667        (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
668        return true;
669    })());
670    result
671}
672
673unsafe extern "C" fn set_innerHTML<D: DomTypes>
674(cx: *mut RawJSContext, obj: RawHandleObject, this: *mut libc::c_void, args: JSJitSetterCallArgs) -> bool{
675    let mut result = false;
676    wrap_panic(&mut || result = (|| {
677        let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
678        let this = &*(this as *const D::ShadowRoot);
679        let arg0: GenericUnionTypes::TrustedHTMLOrNullIsEmptyString::<D> = match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(0)), ()) {
680            Ok(ConversionResult::Success(value)) => value,
681            Ok(ConversionResult::Failure(error)) => {
682                throw_type_error(cx.raw_cx(), &error);
683        return false;
684
685            }
686            _ => {
687                return false;
688
689            },
690        }
691        ;
692        <D as DomHelpers<D>>::push_new_element_queue();
693
694        let result: Result<(), Error> = this.SetInnerHTML(arg0, CanGc::note());
695        <D as DomHelpers<D>>::pop_current_element_queue(CanGc::note());
696
697        let result = match result {
698            Ok(result) => result,
699            Err(e) => {
700                <D as DomHelpers<D>>::throw_dom_exception(SafeJSContext::from_ptr(cx.raw_cx()), &this.global_(InRealm::already(&AlreadyInRealm::assert_for_cx(SafeJSContext::from_ptr(cx.raw_cx())))), e, CanGc::note());
701                return false;
702            },
703        };
704
705        true
706    })());
707    result
708}
709
710
711static innerHTML_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
712
713pub(crate) fn init_innerHTML_getterinfo<D: DomTypes>() {
714    innerHTML_getterinfo.set(JSJitInfo {
715    __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
716        getter: Some(get_innerHTML::<D>)
717    },
718    __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
719        protoID: PrototypeList::ID::ShadowRoot as u16,
720    },
721    __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 3 },
722    _bitfield_align_1: [],
723    _bitfield_1: __BindgenBitfieldUnit::new(
724        new_jsjitinfo_bitfield_1!(
725            JSJitInfo_OpType::Getter as u8,
726            JSJitInfo_AliasSet::AliasEverything as u8,
727            JSValueType::JSVAL_TYPE_UNKNOWN as u8,
728            false,
729            false,
730            false,
731            false,
732            false,
733            false,
734            0,
735        ).to_ne_bytes()
736    ),
737});
738}
739static innerHTML_setterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
740
741pub(crate) fn init_innerHTML_setterinfo<D: DomTypes>() {
742    innerHTML_setterinfo.set(JSJitInfo {
743    __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
744        setter: Some(set_innerHTML::<D>)
745    },
746    __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
747        protoID: PrototypeList::ID::ShadowRoot as u16,
748    },
749    __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 3 },
750    _bitfield_align_1: [],
751    _bitfield_1: __BindgenBitfieldUnit::new(
752        new_jsjitinfo_bitfield_1!(
753            JSJitInfo_OpType::Setter as u8,
754            JSJitInfo_AliasSet::AliasEverything as u8,
755            JSValueType::JSVAL_TYPE_UNDEFINED as u8,
756            false,
757            false,
758            false,
759            false,
760            false,
761            false,
762            0,
763        ).to_ne_bytes()
764    ),
765});
766}
767unsafe extern "C" fn elementFromPoint<D: DomTypes>
768(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool{
769    let mut result = false;
770    wrap_panic(&mut || result = (|| {
771        let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
772        let this = &*(this as *const D::ShadowRoot);
773        let args = &*args;
774        let argc = args.argc_;
775
776        if argc < 2 {
777            throw_type_error(cx.raw_cx(), "Not enough arguments to \"ShadowRoot.elementFromPoint\".");
778            return false;
779        }
780        let arg0: Finite<f64> = match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(0)), ()) {
781            Ok(ConversionResult::Success(value)) => value,
782            Ok(ConversionResult::Failure(error)) => {
783                throw_type_error(cx.raw_cx(), &error);
784        return false;
785
786            }
787            _ => {
788                return false;
789
790            },
791        }
792        ;
793        let arg1: Finite<f64> = match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(1)), ()) {
794            Ok(ConversionResult::Success(value)) => value,
795            Ok(ConversionResult::Failure(error)) => {
796                throw_type_error(cx.raw_cx(), &error);
797        return false;
798
799            }
800            _ => {
801                return false;
802
803            },
804        }
805        ;
806        let result: Option<DomRoot<D::Element>> = this.ElementFromPoint(arg0, arg1);
807
808        (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
809        return true;
810    })());
811    result
812}
813
814
815static elementFromPoint_methodinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
816
817pub(crate) fn init_elementFromPoint_methodinfo<D: DomTypes>() {
818    elementFromPoint_methodinfo.set(JSJitInfo {
819    __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
820        method: Some(elementFromPoint::<D>)
821    },
822    __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
823        protoID: PrototypeList::ID::ShadowRoot as u16,
824    },
825    __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 3 },
826    _bitfield_align_1: [],
827    _bitfield_1: __BindgenBitfieldUnit::new(
828        new_jsjitinfo_bitfield_1!(
829            JSJitInfo_OpType::Method as u8,
830            JSJitInfo_AliasSet::AliasEverything as u8,
831            JSValueType::JSVAL_TYPE_UNKNOWN as u8,
832            false,
833            false,
834            false,
835            false,
836            false,
837            false,
838            0,
839        ).to_ne_bytes()
840    ),
841});
842}
843unsafe extern "C" fn elementsFromPoint<D: DomTypes>
844(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool{
845    let mut result = false;
846    wrap_panic(&mut || result = (|| {
847        let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
848        let this = &*(this as *const D::ShadowRoot);
849        let args = &*args;
850        let argc = args.argc_;
851
852        if argc < 2 {
853            throw_type_error(cx.raw_cx(), "Not enough arguments to \"ShadowRoot.elementsFromPoint\".");
854            return false;
855        }
856        let arg0: Finite<f64> = match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(0)), ()) {
857            Ok(ConversionResult::Success(value)) => value,
858            Ok(ConversionResult::Failure(error)) => {
859                throw_type_error(cx.raw_cx(), &error);
860        return false;
861
862            }
863            _ => {
864                return false;
865
866            },
867        }
868        ;
869        let arg1: Finite<f64> = match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(1)), ()) {
870            Ok(ConversionResult::Success(value)) => value,
871            Ok(ConversionResult::Failure(error)) => {
872                throw_type_error(cx.raw_cx(), &error);
873        return false;
874
875            }
876            _ => {
877                return false;
878
879            },
880        }
881        ;
882        let result: Vec<DomRoot<D::Element>> = this.ElementsFromPoint(arg0, arg1);
883
884        (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
885        return true;
886    })());
887    result
888}
889
890
891static elementsFromPoint_methodinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
892
893pub(crate) fn init_elementsFromPoint_methodinfo<D: DomTypes>() {
894    elementsFromPoint_methodinfo.set(JSJitInfo {
895    __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
896        method: Some(elementsFromPoint::<D>)
897    },
898    __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
899        protoID: PrototypeList::ID::ShadowRoot as u16,
900    },
901    __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 3 },
902    _bitfield_align_1: [],
903    _bitfield_1: __BindgenBitfieldUnit::new(
904        new_jsjitinfo_bitfield_1!(
905            JSJitInfo_OpType::Method as u8,
906            JSJitInfo_AliasSet::AliasEverything as u8,
907            JSValueType::JSVAL_TYPE_OBJECT as u8,
908            false,
909            false,
910            false,
911            false,
912            false,
913            false,
914            0,
915        ).to_ne_bytes()
916    ),
917});
918}
919unsafe extern "C" fn get_activeElement<D: DomTypes>
920(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
921    let mut result = false;
922    wrap_panic(&mut || result = (|| {
923        let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
924        let this = &*(this as *const D::ShadowRoot);
925        let result: Option<DomRoot<D::Element>> = this.GetActiveElement();
926
927        (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
928        return true;
929    })());
930    result
931}
932
933
934static activeElement_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
935
936pub(crate) fn init_activeElement_getterinfo<D: DomTypes>() {
937    activeElement_getterinfo.set(JSJitInfo {
938    __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
939        getter: Some(get_activeElement::<D>)
940    },
941    __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
942        protoID: PrototypeList::ID::ShadowRoot as u16,
943    },
944    __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 3 },
945    _bitfield_align_1: [],
946    _bitfield_1: __BindgenBitfieldUnit::new(
947        new_jsjitinfo_bitfield_1!(
948            JSJitInfo_OpType::Getter as u8,
949            JSJitInfo_AliasSet::AliasEverything as u8,
950            JSValueType::JSVAL_TYPE_UNKNOWN as u8,
951            true,
952            false,
953            false,
954            false,
955            false,
956            false,
957            0,
958        ).to_ne_bytes()
959    ),
960});
961}
962unsafe extern "C" fn get_styleSheets<D: DomTypes>
963(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
964    let mut result = false;
965    wrap_panic(&mut || result = (|| {
966        let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
967        let this = &*(this as *const D::ShadowRoot);
968        let result: DomRoot<D::StyleSheetList> = this.StyleSheets();
969
970        (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
971        return true;
972    })());
973    result
974}
975
976
977static styleSheets_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
978
979pub(crate) fn init_styleSheets_getterinfo<D: DomTypes>() {
980    styleSheets_getterinfo.set(JSJitInfo {
981    __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
982        getter: Some(get_styleSheets::<D>)
983    },
984    __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
985        protoID: PrototypeList::ID::ShadowRoot as u16,
986    },
987    __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 3 },
988    _bitfield_align_1: [],
989    _bitfield_1: __BindgenBitfieldUnit::new(
990        new_jsjitinfo_bitfield_1!(
991            JSJitInfo_OpType::Getter as u8,
992            JSJitInfo_AliasSet::AliasEverything as u8,
993            JSValueType::JSVAL_TYPE_OBJECT as u8,
994            true,
995            false,
996            false,
997            false,
998            false,
999            false,
1000            0,
1001        ).to_ne_bytes()
1002    ),
1003});
1004}
1005unsafe extern "C" fn get_adoptedStyleSheets<D: DomTypes>
1006(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
1007    let mut result = false;
1008    wrap_panic(&mut || result = (|| {
1009        let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
1010        let this = &*(this as *const D::ShadowRoot);
1011        rooted!(&in(cx) let mut retval: JSVal);
1012        let result: () = this.AdoptedStyleSheets(SafeJSContext::from_ptr(cx.raw_cx()), CanGc::note(), retval.handle_mut());
1013
1014        (retval).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
1015        return true;
1016    })());
1017    result
1018}
1019
1020unsafe extern "C" fn set_adoptedStyleSheets<D: DomTypes>
1021(cx: *mut RawJSContext, obj: RawHandleObject, this: *mut libc::c_void, args: JSJitSetterCallArgs) -> bool{
1022    let mut result = false;
1023    wrap_panic(&mut || result = (|| {
1024        let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
1025        let this = &*(this as *const D::ShadowRoot);
1026        let arg0: HandleValue = HandleValue::from_raw(args.get(0));
1027        let result: Result<(), Error> = this.SetAdoptedStyleSheets(SafeJSContext::from_ptr(cx.raw_cx()), arg0, CanGc::note());
1028        let result = match result {
1029            Ok(result) => result,
1030            Err(e) => {
1031                <D as DomHelpers<D>>::throw_dom_exception(SafeJSContext::from_ptr(cx.raw_cx()), &this.global_(InRealm::already(&AlreadyInRealm::assert_for_cx(SafeJSContext::from_ptr(cx.raw_cx())))), e, CanGc::note());
1032                return false;
1033            },
1034        };
1035
1036        true
1037    })());
1038    result
1039}
1040
1041
1042static adoptedStyleSheets_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
1043
1044pub(crate) fn init_adoptedStyleSheets_getterinfo<D: DomTypes>() {
1045    adoptedStyleSheets_getterinfo.set(JSJitInfo {
1046    __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
1047        getter: Some(get_adoptedStyleSheets::<D>)
1048    },
1049    __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
1050        protoID: PrototypeList::ID::ShadowRoot as u16,
1051    },
1052    __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 3 },
1053    _bitfield_align_1: [],
1054    _bitfield_1: __BindgenBitfieldUnit::new(
1055        new_jsjitinfo_bitfield_1!(
1056            JSJitInfo_OpType::Getter as u8,
1057            JSJitInfo_AliasSet::AliasEverything as u8,
1058            JSValueType::JSVAL_TYPE_UNKNOWN as u8,
1059            true,
1060            false,
1061            false,
1062            false,
1063            false,
1064            false,
1065            0,
1066        ).to_ne_bytes()
1067    ),
1068});
1069}
1070static adoptedStyleSheets_setterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
1071
1072pub(crate) fn init_adoptedStyleSheets_setterinfo<D: DomTypes>() {
1073    adoptedStyleSheets_setterinfo.set(JSJitInfo {
1074    __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
1075        setter: Some(set_adoptedStyleSheets::<D>)
1076    },
1077    __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
1078        protoID: PrototypeList::ID::ShadowRoot as u16,
1079    },
1080    __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 3 },
1081    _bitfield_align_1: [],
1082    _bitfield_1: __BindgenBitfieldUnit::new(
1083        new_jsjitinfo_bitfield_1!(
1084            JSJitInfo_OpType::Setter as u8,
1085            JSJitInfo_AliasSet::AliasEverything as u8,
1086            JSValueType::JSVAL_TYPE_UNDEFINED as u8,
1087            false,
1088            false,
1089            false,
1090            false,
1091            false,
1092            false,
1093            0,
1094        ).to_ne_bytes()
1095    ),
1096});
1097}
1098unsafe extern "C" fn _finalize<D: DomTypes>
1099(_cx: *mut GCContext, obj: *mut JSObject){
1100    wrap_panic(&mut || {
1101
1102        let this = native_from_object_static::<D::ShadowRoot>(obj).unwrap();
1103        finalize_common(this);
1104    })
1105}
1106
1107unsafe extern "C" fn _trace<D: DomTypes>
1108(trc: *mut JSTracer, obj: *mut JSObject){
1109    wrap_panic(&mut || {
1110
1111        let this = native_from_object_static::<D::ShadowRoot>(obj).unwrap();
1112        if this.is_null() { return; } // GC during obj creation
1113        (*this).trace(trc);
1114    })
1115}
1116
1117
1118static CLASS_OPS: ThreadUnsafeOnceLock<JSClassOps> = ThreadUnsafeOnceLock::new();
1119
1120pub(crate) fn init_class_ops<D: DomTypes>() {
1121    CLASS_OPS.set(JSClassOps {
1122        addProperty: None,
1123        delProperty: None,
1124        enumerate: None,
1125        newEnumerate: None,
1126        resolve: None,
1127        mayResolve: None,
1128        finalize: Some(_finalize::<D>),
1129        call: None,
1130        construct: None,
1131        trace: Some(_trace::<D>),
1132    });
1133}
1134
1135pub static Class: ThreadUnsafeOnceLock<DOMJSClass> = ThreadUnsafeOnceLock::new();
1136
1137pub(crate) fn init_domjs_class<D: DomTypes>() {
1138    init_class_ops::<D>();
1139    Class.set(DOMJSClass {
1140        base: JSClass {
1141            name: c"ShadowRoot".as_ptr(),
1142            flags: JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE |
1143                   (((1) & JSCLASS_RESERVED_SLOTS_MASK) << JSCLASS_RESERVED_SLOTS_SHIFT)
1144                   /* JSCLASS_HAS_RESERVED_SLOTS(1) */,
1145            cOps: unsafe { CLASS_OPS.get() },
1146            spec: ptr::null(),
1147            ext: ptr::null(),
1148            oOps: ptr::null(),
1149        },
1150        dom_class:
1151DOMClass {
1152    interface_chain: [ PrototypeList::ID::EventTarget, PrototypeList::ID::Node, PrototypeList::ID::DocumentFragment, PrototypeList::ID::ShadowRoot, PrototypeList::ID::Last, PrototypeList::ID::Last ],
1153    depth: 3,
1154    type_id: crate::codegen::InheritTypes::TopTypeId { eventtarget: (crate::codegen::InheritTypes::EventTargetTypeId::Node(crate::codegen::InheritTypes::NodeTypeId::DocumentFragment(crate::codegen::InheritTypes::DocumentFragmentTypeId::ShadowRoot))) },
1155    malloc_size_of: malloc_size_of_including_raw_self::<D::ShadowRoot> as unsafe fn(&mut _, _) -> _,
1156    global: Globals::EMPTY,
1157},
1158    });
1159}
1160
1161#[cfg_attr(crown, allow(crown::unrooted_must_root))] pub unsafe fn Wrap<D: DomTypes>
1162(cx: SafeJSContext, scope: &D::GlobalScope, given_proto: Option<HandleObject>, object: Box<D::ShadowRoot>, _can_gc: CanGc) -> DomRoot<D::ShadowRoot>{
1163
1164    let raw = Root::new(MaybeUnreflectedDom::from_box(object));
1165
1166    let scope = scope.reflector().get_jsobject();
1167    assert!(!scope.get().is_null());
1168    assert!(((*get_object_class(scope.get())).flags & JSCLASS_IS_GLOBAL) != 0);
1169    let _ac = JSAutoRealm::new(cx.raw_cx(), scope.get());
1170
1171    rooted!(&in(cx) let mut canonical_proto = ptr::null_mut::<JSObject>());
1172    GetProtoObject::<D>(cx, scope, canonical_proto.handle_mut());
1173    assert!(!canonical_proto.is_null());
1174
1175
1176    rooted!(&in(cx) let mut proto = ptr::null_mut::<JSObject>());
1177    if let Some(given) = given_proto {
1178        proto.set(*given);
1179        if get_context_realm(cx.raw_cx()) != get_object_realm(*given) {
1180            assert!(JS_WrapObject(cx.raw_cx(), proto.handle_mut()));
1181        }
1182    } else {
1183        proto.set(*canonical_proto);
1184    }
1185    rooted!(&in(cx) let obj = JS_NewObjectWithGivenProto(
1186        cx.raw_cx(),
1187        &Class.get().base,
1188        proto.handle(),
1189    ));
1190    assert!(!obj.is_null());
1191    JS_SetReservedSlot(
1192        obj.get(),
1193        DOM_OBJECT_SLOT,
1194        &PrivateValue(raw.as_ptr() as *const libc::c_void),
1195    );
1196
1197    let root = raw.reflect_with(obj.get());
1198
1199
1200
1201    DomRoot::from_ref(&*root)
1202}
1203
1204pub trait ShadowRootMethods<D: DomTypes> {
1205    fn Mode(&self, ) -> ShadowRootMode;
1206    fn DelegatesFocus(&self, ) -> bool;
1207    fn SlotAssignment(&self, ) -> SlotAssignmentMode;
1208    fn Clonable(&self, ) -> bool;
1209    fn Serializable(&self, ) -> bool;
1210    fn Host(&self, ) -> DomRoot<D::Element>;
1211    fn GetOnslotchange(&self, ) -> Option<Rc<crate::codegen::GenericBindings::EventHandlerBinding::EventHandlerNonNull<D>>>;
1212    fn SetOnslotchange(&self, r#value: Option<Rc<EventHandlerNonNull<D>>>);
1213    fn SetHTMLUnsafe(&self, r#html: GenericUnionTypes::TrustedHTMLOrString::<D>, r#_can_gc: CanGc) -> Fallible<()>;
1214    fn GetHTML(&self, r#options: &crate::codegen::GenericBindings::ElementBinding::GetHTMLOptions<D>, r#_can_gc: CanGc) -> DOMString;
1215    fn GetInnerHTML(&self, r#_can_gc: CanGc) -> Fallible<GenericUnionTypes::TrustedHTMLOrNullIsEmptyString::<D>>;
1216    fn SetInnerHTML(&self, r#value: GenericUnionTypes::TrustedHTMLOrNullIsEmptyString::<D>, r#_can_gc: CanGc) -> ErrorResult;
1217    fn ElementFromPoint(&self, r#x: Finite<f64>, r#y: Finite<f64>) -> Option<DomRoot<D::Element>>;
1218    fn ElementsFromPoint(&self, r#x: Finite<f64>, r#y: Finite<f64>) -> Vec<DomRoot<D::Element>>;
1219    fn GetActiveElement(&self, ) -> Option<DomRoot<D::Element>>;
1220    fn StyleSheets(&self, ) -> DomRoot<D::StyleSheetList>;
1221    fn AdoptedStyleSheets(&self, r#cx: SafeJSContext, r#_can_gc: CanGc, r#retval: MutableHandleValue);
1222    fn SetAdoptedStyleSheets(&self, r#cx: SafeJSContext, r#value: HandleValue, r#_can_gc: CanGc) -> ErrorResult;
1223}
1224static sMethods_specs: ThreadUnsafeOnceLock<&[&[JSFunctionSpec]]> = ThreadUnsafeOnceLock::new();
1225
1226pub(crate) fn init_sMethods_specs<D: DomTypes>() {
1227    sMethods_specs.set(Box::leak(Box::new([&Box::leak(Box::new([
1228    JSFunctionSpec {
1229        name: JSPropertySpec_Name { string_: c"setHTMLUnsafe".as_ptr() },
1230        call: JSNativeWrapper { op: Some(generic_method::<false>), info: unsafe { setHTMLUnsafe_methodinfo.get() } as *const _ as *const JSJitInfo },
1231        nargs: 1,
1232        flags: (JSPROP_ENUMERATE) as u16,
1233        selfHostedName: ptr::null()
1234    },
1235    JSFunctionSpec {
1236        name: JSPropertySpec_Name { string_: c"getHTML".as_ptr() },
1237        call: JSNativeWrapper { op: Some(generic_method::<false>), info: unsafe { getHTML_methodinfo.get() } as *const _ as *const JSJitInfo },
1238        nargs: 0,
1239        flags: (JSPROP_ENUMERATE) as u16,
1240        selfHostedName: ptr::null()
1241    },
1242    JSFunctionSpec {
1243        name: JSPropertySpec_Name { string_: c"elementFromPoint".as_ptr() },
1244        call: JSNativeWrapper { op: Some(generic_method::<false>), info: unsafe { elementFromPoint_methodinfo.get() } as *const _ as *const JSJitInfo },
1245        nargs: 2,
1246        flags: (JSPROP_ENUMERATE) as u16,
1247        selfHostedName: ptr::null()
1248    },
1249    JSFunctionSpec {
1250        name: JSPropertySpec_Name { string_: c"elementsFromPoint".as_ptr() },
1251        call: JSNativeWrapper { op: Some(generic_method::<false>), info: unsafe { elementsFromPoint_methodinfo.get() } as *const _ as *const JSJitInfo },
1252        nargs: 2,
1253        flags: (JSPROP_ENUMERATE) as u16,
1254        selfHostedName: ptr::null()
1255    },
1256    JSFunctionSpec {
1257        name: JSPropertySpec_Name { string_: ptr::null() },
1258        call: JSNativeWrapper { op: None, info: ptr::null() },
1259        nargs: 0,
1260        flags: 0,
1261        selfHostedName: ptr::null()
1262    }]))[..]
1263])));
1264}static sMethods: ThreadUnsafeOnceLock<&[Guard<&[JSFunctionSpec]>]> = ThreadUnsafeOnceLock::new();
1265
1266pub(crate) fn init_sMethods_prefs<D: DomTypes>() {
1267    sMethods.set(Box::leak(Box::new([    Guard::new(&[Condition::Exposed(Globals::WINDOW)], (unsafe { sMethods_specs.get() })[0])])));
1268}static sAttributes_specs: ThreadUnsafeOnceLock<&[&[JSPropertySpec]]> = ThreadUnsafeOnceLock::new();
1269
1270pub(crate) fn init_sAttributes_specs<D: DomTypes>() {
1271    sAttributes_specs.set(Box::leak(Box::new([&Box::leak(Box::new([
1272    JSPropertySpec {
1273                    name: JSPropertySpec_Name { string_: c"mode".as_ptr() },
1274                    attributes_: (JSPROP_ENUMERATE),
1275                    kind_: (JSPropertySpec_Kind::NativeAccessor),
1276                    u: JSPropertySpec_AccessorsOrValue {
1277                        accessors: JSPropertySpec_AccessorsOrValue_Accessors {
1278                            getter: JSPropertySpec_Accessor {
1279                                native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { mode_getterinfo.get() } },
1280                            },
1281                            setter: JSPropertySpec_Accessor {
1282                                native: JSNativeWrapper { op: None, info: ptr::null() },
1283                            }
1284                        }
1285                    }
1286                }
1287,
1288    JSPropertySpec {
1289                    name: JSPropertySpec_Name { string_: c"delegatesFocus".as_ptr() },
1290                    attributes_: (JSPROP_ENUMERATE),
1291                    kind_: (JSPropertySpec_Kind::NativeAccessor),
1292                    u: JSPropertySpec_AccessorsOrValue {
1293                        accessors: JSPropertySpec_AccessorsOrValue_Accessors {
1294                            getter: JSPropertySpec_Accessor {
1295                                native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { delegatesFocus_getterinfo.get() } },
1296                            },
1297                            setter: JSPropertySpec_Accessor {
1298                                native: JSNativeWrapper { op: None, info: ptr::null() },
1299                            }
1300                        }
1301                    }
1302                }
1303,
1304    JSPropertySpec {
1305                    name: JSPropertySpec_Name { string_: c"slotAssignment".as_ptr() },
1306                    attributes_: (JSPROP_ENUMERATE),
1307                    kind_: (JSPropertySpec_Kind::NativeAccessor),
1308                    u: JSPropertySpec_AccessorsOrValue {
1309                        accessors: JSPropertySpec_AccessorsOrValue_Accessors {
1310                            getter: JSPropertySpec_Accessor {
1311                                native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { slotAssignment_getterinfo.get() } },
1312                            },
1313                            setter: JSPropertySpec_Accessor {
1314                                native: JSNativeWrapper { op: None, info: ptr::null() },
1315                            }
1316                        }
1317                    }
1318                }
1319,
1320    JSPropertySpec {
1321                    name: JSPropertySpec_Name { string_: c"clonable".as_ptr() },
1322                    attributes_: (JSPROP_ENUMERATE),
1323                    kind_: (JSPropertySpec_Kind::NativeAccessor),
1324                    u: JSPropertySpec_AccessorsOrValue {
1325                        accessors: JSPropertySpec_AccessorsOrValue_Accessors {
1326                            getter: JSPropertySpec_Accessor {
1327                                native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { clonable_getterinfo.get() } },
1328                            },
1329                            setter: JSPropertySpec_Accessor {
1330                                native: JSNativeWrapper { op: None, info: ptr::null() },
1331                            }
1332                        }
1333                    }
1334                }
1335,
1336    JSPropertySpec {
1337                    name: JSPropertySpec_Name { string_: c"serializable".as_ptr() },
1338                    attributes_: (JSPROP_ENUMERATE),
1339                    kind_: (JSPropertySpec_Kind::NativeAccessor),
1340                    u: JSPropertySpec_AccessorsOrValue {
1341                        accessors: JSPropertySpec_AccessorsOrValue_Accessors {
1342                            getter: JSPropertySpec_Accessor {
1343                                native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { serializable_getterinfo.get() } },
1344                            },
1345                            setter: JSPropertySpec_Accessor {
1346                                native: JSNativeWrapper { op: None, info: ptr::null() },
1347                            }
1348                        }
1349                    }
1350                }
1351,
1352    JSPropertySpec {
1353                    name: JSPropertySpec_Name { string_: c"host".as_ptr() },
1354                    attributes_: (JSPROP_ENUMERATE),
1355                    kind_: (JSPropertySpec_Kind::NativeAccessor),
1356                    u: JSPropertySpec_AccessorsOrValue {
1357                        accessors: JSPropertySpec_AccessorsOrValue_Accessors {
1358                            getter: JSPropertySpec_Accessor {
1359                                native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { host_getterinfo.get() } },
1360                            },
1361                            setter: JSPropertySpec_Accessor {
1362                                native: JSNativeWrapper { op: None, info: ptr::null() },
1363                            }
1364                        }
1365                    }
1366                }
1367,
1368    JSPropertySpec {
1369                    name: JSPropertySpec_Name { string_: c"onslotchange".as_ptr() },
1370                    attributes_: (JSPROP_ENUMERATE),
1371                    kind_: (JSPropertySpec_Kind::NativeAccessor),
1372                    u: JSPropertySpec_AccessorsOrValue {
1373                        accessors: JSPropertySpec_AccessorsOrValue_Accessors {
1374                            getter: JSPropertySpec_Accessor {
1375                                native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { onslotchange_getterinfo.get() } },
1376                            },
1377                            setter: JSPropertySpec_Accessor {
1378                                native: JSNativeWrapper { op: Some(generic_setter), info: unsafe { onslotchange_setterinfo.get() } },
1379                            }
1380                        }
1381                    }
1382                }
1383,
1384    JSPropertySpec {
1385                    name: JSPropertySpec_Name { string_: c"innerHTML".as_ptr() },
1386                    attributes_: (JSPROP_ENUMERATE),
1387                    kind_: (JSPropertySpec_Kind::NativeAccessor),
1388                    u: JSPropertySpec_AccessorsOrValue {
1389                        accessors: JSPropertySpec_AccessorsOrValue_Accessors {
1390                            getter: JSPropertySpec_Accessor {
1391                                native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { innerHTML_getterinfo.get() } },
1392                            },
1393                            setter: JSPropertySpec_Accessor {
1394                                native: JSNativeWrapper { op: Some(generic_setter), info: unsafe { innerHTML_setterinfo.get() } },
1395                            }
1396                        }
1397                    }
1398                }
1399,
1400    JSPropertySpec {
1401                    name: JSPropertySpec_Name { string_: c"activeElement".as_ptr() },
1402                    attributes_: (JSPROP_ENUMERATE),
1403                    kind_: (JSPropertySpec_Kind::NativeAccessor),
1404                    u: JSPropertySpec_AccessorsOrValue {
1405                        accessors: JSPropertySpec_AccessorsOrValue_Accessors {
1406                            getter: JSPropertySpec_Accessor {
1407                                native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { activeElement_getterinfo.get() } },
1408                            },
1409                            setter: JSPropertySpec_Accessor {
1410                                native: JSNativeWrapper { op: None, info: ptr::null() },
1411                            }
1412                        }
1413                    }
1414                }
1415,
1416    JSPropertySpec {
1417                    name: JSPropertySpec_Name { string_: c"styleSheets".as_ptr() },
1418                    attributes_: (JSPROP_ENUMERATE),
1419                    kind_: (JSPropertySpec_Kind::NativeAccessor),
1420                    u: JSPropertySpec_AccessorsOrValue {
1421                        accessors: JSPropertySpec_AccessorsOrValue_Accessors {
1422                            getter: JSPropertySpec_Accessor {
1423                                native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { styleSheets_getterinfo.get() } },
1424                            },
1425                            setter: JSPropertySpec_Accessor {
1426                                native: JSNativeWrapper { op: None, info: ptr::null() },
1427                            }
1428                        }
1429                    }
1430                }
1431,
1432    JSPropertySpec::ZERO]))[..]
1433,
1434&Box::leak(Box::new([
1435    JSPropertySpec {
1436                    name: JSPropertySpec_Name { string_: c"adoptedStyleSheets".as_ptr() },
1437                    attributes_: (JSPROP_ENUMERATE),
1438                    kind_: (JSPropertySpec_Kind::NativeAccessor),
1439                    u: JSPropertySpec_AccessorsOrValue {
1440                        accessors: JSPropertySpec_AccessorsOrValue_Accessors {
1441                            getter: JSPropertySpec_Accessor {
1442                                native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { adoptedStyleSheets_getterinfo.get() } },
1443                            },
1444                            setter: JSPropertySpec_Accessor {
1445                                native: JSNativeWrapper { op: Some(generic_setter), info: unsafe { adoptedStyleSheets_setterinfo.get() } },
1446                            }
1447                        }
1448                    }
1449                }
1450,
1451    JSPropertySpec::ZERO]))[..]
1452,
1453&Box::leak(Box::new([
1454    JSPropertySpec {
1455                    name: JSPropertySpec_Name { symbol_: SymbolCode::toStringTag as usize + 1 },
1456                    attributes_: (JSPROP_READONLY),
1457                    kind_: (JSPropertySpec_Kind::Value),
1458                    u: JSPropertySpec_AccessorsOrValue {
1459                        value: JSPropertySpec_ValueWrapper {
1460                            type_: JSPropertySpec_ValueWrapper_Type::String,
1461                            __bindgen_anon_1: JSPropertySpec_ValueWrapper__bindgen_ty_1 {
1462                                string: c"ShadowRoot".as_ptr(),
1463                            }
1464                        }
1465                    }
1466                }
1467,
1468    JSPropertySpec::ZERO]))[..]
1469])));
1470}static sAttributes: ThreadUnsafeOnceLock<&[Guard<&[JSPropertySpec]>]> = ThreadUnsafeOnceLock::new();
1471
1472pub(crate) fn init_sAttributes_prefs<D: DomTypes>() {
1473    sAttributes.set(Box::leak(Box::new([    Guard::new(&[Condition::Exposed(Globals::WINDOW)], (unsafe { sAttributes_specs.get() })[0]),
1474    Guard::new(&[Condition::Pref("dom_adoptedstylesheet_enabled"),Condition::Exposed(Globals::WINDOW)], (unsafe { sAttributes_specs.get() })[1]),
1475    Guard::new(&[Condition::Satisfied], (unsafe { sAttributes_specs.get() })[2])])));
1476}
1477pub fn GetProtoObject<D: DomTypes>
1478(cx: SafeJSContext, global: HandleObject, mut rval: MutableHandleObject){
1479    /* Get the interface prototype object for this class.  This will create the
1480       object as needed. */get_per_interface_object_handle(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::ShadowRoot), CreateInterfaceObjects::<D>, rval)
1481}
1482
1483
1484static PrototypeClass: JSClass = JSClass {
1485    name: c"ShadowRootPrototype".as_ptr(),
1486    flags:
1487        // JSCLASS_HAS_RESERVED_SLOTS()
1488        (0 ) << JSCLASS_RESERVED_SLOTS_SHIFT,
1489    cOps: ptr::null(),
1490    spec: ptr::null(),
1491    ext: ptr::null(),
1492    oOps: ptr::null(),
1493};
1494
1495
1496static INTERFACE_OBJECT_CLASS: ThreadUnsafeOnceLock<NonCallbackInterfaceObjectClass> = ThreadUnsafeOnceLock::new();
1497
1498pub(crate) fn init_interface_object<D: DomTypes>() {
1499    INTERFACE_OBJECT_CLASS.set(NonCallbackInterfaceObjectClass::new(
1500        Box::leak(Box::new(InterfaceConstructorBehavior::throw())),
1501        b"function ShadowRoot() {\n    [native code]\n}",
1502        PrototypeList::ID::ShadowRoot,
1503        3,
1504    ));
1505}
1506
1507pub fn DefineDOMInterface<D: DomTypes>
1508(cx: SafeJSContext, global: HandleObject){
1509    define_dom_interface(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::ShadowRoot),CreateInterfaceObjects::<D>, ConstructorEnabled::<D>)
1510}
1511
1512pub fn ConstructorEnabled<D: DomTypes>
1513(aCx: SafeJSContext, aObj: HandleObject) -> bool{
1514    is_exposed_in(aObj, Globals::WINDOW)
1515}
1516
1517unsafe fn CreateInterfaceObjects<D: DomTypes>
1518(cx: SafeJSContext, global: HandleObject, cache: *mut ProtoOrIfaceArray){
1519
1520    rooted!(&in(cx) let mut prototype_proto = ptr::null_mut::<JSObject>());
1521    DocumentFragment_Binding::GetProtoObject::<D>(cx, global, prototype_proto.handle_mut());
1522    assert!(!prototype_proto.is_null());
1523
1524    rooted!(&in(cx) let mut prototype = ptr::null_mut::<JSObject>());
1525    create_interface_prototype_object::<D>(cx,
1526                                      global,
1527                                      prototype_proto.handle(),
1528                                      &PrototypeClass,
1529                                      sMethods.get(),
1530                                      sAttributes.get(),
1531                                      &[],
1532                                      &[],
1533                                      prototype.handle_mut());
1534    assert!(!prototype.is_null());
1535    assert!((*cache)[PrototypeList::ID::ShadowRoot as usize].is_null());
1536    (*cache)[PrototypeList::ID::ShadowRoot as usize] = prototype.get();
1537    <*mut JSObject>::post_barrier((*cache).as_mut_ptr().offset(PrototypeList::ID::ShadowRoot as isize),
1538                                  ptr::null_mut(),
1539                                  prototype.get());
1540
1541    rooted!(&in(cx) let mut interface_proto = ptr::null_mut::<JSObject>());
1542
1543    DocumentFragment_Binding::GetConstructorObject::<D>(cx, global, interface_proto.handle_mut());
1544
1545    assert!(!interface_proto.is_null());
1546
1547    rooted!(&in(cx) let mut interface = ptr::null_mut::<JSObject>());
1548    create_noncallback_interface_object::<D>(cx,
1549                                        global,
1550                                        interface_proto.handle(),
1551                                        INTERFACE_OBJECT_CLASS.get(),
1552                                        &[],
1553                                        &[],
1554                                        &[],
1555                                        prototype.handle(),
1556                                        c"ShadowRoot",
1557                                        0,
1558                                        &[],
1559                                        interface.handle_mut());
1560    assert!(!interface.is_null());
1561}
1562
1563
1564        pub(crate) fn init_statics<D: DomTypes>() {
1565            init_interface_object::<D>();
1566            init_domjs_class::<D>();
1567            crate::codegen::GenericBindings::ShadowRootBinding::ShadowRoot_Binding::init_setHTMLUnsafe_methodinfo::<D>();
1568crate::codegen::GenericBindings::ShadowRootBinding::ShadowRoot_Binding::init_getHTML_methodinfo::<D>();
1569crate::codegen::GenericBindings::ShadowRootBinding::ShadowRoot_Binding::init_elementFromPoint_methodinfo::<D>();
1570crate::codegen::GenericBindings::ShadowRootBinding::ShadowRoot_Binding::init_elementsFromPoint_methodinfo::<D>();
1571            init_mode_getterinfo::<D>();
1572init_delegatesFocus_getterinfo::<D>();
1573init_slotAssignment_getterinfo::<D>();
1574init_clonable_getterinfo::<D>();
1575init_serializable_getterinfo::<D>();
1576init_host_getterinfo::<D>();
1577init_onslotchange_getterinfo::<D>();
1578init_innerHTML_getterinfo::<D>();
1579init_activeElement_getterinfo::<D>();
1580init_styleSheets_getterinfo::<D>();
1581init_adoptedStyleSheets_getterinfo::<D>();
1582            init_onslotchange_setterinfo::<D>();
1583init_innerHTML_setterinfo::<D>();
1584init_adoptedStyleSheets_setterinfo::<D>();
1585
1586            init_sMethods_specs::<D>();
1587init_sMethods_prefs::<D>();
1588init_sAttributes_specs::<D>();
1589init_sAttributes_prefs::<D>();
1590        }
1591        } // mod ShadowRoot_Binding
1592
1593