script_bindings/home/runner/work/servo/servo/target/debug/build/script_bindings-d55f55d5af1efaee/out/Bindings/
TextMetricsBinding.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::import::base::*;
6
7pub use self::TextMetrics_Binding::{Wrap, TextMetricsMethods, GetProtoObject, DefineDOMInterface};
8pub mod TextMetrics_Binding {
9use crate::import::module::*;
10
11unsafe extern "C" fn get_width<D: DomTypes>
12(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> 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::TextMetrics);
17        let result: Finite<f64> = this.Width();
18
19        (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
20        return true;
21    })());
22    result
23}
24
25
26static width_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
27
28pub(crate) fn init_width_getterinfo<D: DomTypes>() {
29    width_getterinfo.set(JSJitInfo {
30    __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
31        getter: Some(get_width::<D>)
32    },
33    __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
34        protoID: PrototypeList::ID::TextMetrics as u16,
35    },
36    __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
37    _bitfield_align_1: [],
38    _bitfield_1: __BindgenBitfieldUnit::new(
39        new_jsjitinfo_bitfield_1!(
40            JSJitInfo_OpType::Getter as u8,
41            JSJitInfo_AliasSet::AliasEverything as u8,
42            JSValueType::JSVAL_TYPE_DOUBLE as u8,
43            true,
44            false,
45            false,
46            false,
47            false,
48            false,
49            0,
50        ).to_ne_bytes()
51    ),
52});
53}
54unsafe extern "C" fn get_actualBoundingBoxLeft<D: DomTypes>
55(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
56    let mut result = false;
57    wrap_panic(&mut || result = (|| {
58        let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
59        let this = &*(this as *const D::TextMetrics);
60        let result: Finite<f64> = this.ActualBoundingBoxLeft();
61
62        (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
63        return true;
64    })());
65    result
66}
67
68
69static actualBoundingBoxLeft_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
70
71pub(crate) fn init_actualBoundingBoxLeft_getterinfo<D: DomTypes>() {
72    actualBoundingBoxLeft_getterinfo.set(JSJitInfo {
73    __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
74        getter: Some(get_actualBoundingBoxLeft::<D>)
75    },
76    __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
77        protoID: PrototypeList::ID::TextMetrics as u16,
78    },
79    __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
80    _bitfield_align_1: [],
81    _bitfield_1: __BindgenBitfieldUnit::new(
82        new_jsjitinfo_bitfield_1!(
83            JSJitInfo_OpType::Getter as u8,
84            JSJitInfo_AliasSet::AliasEverything as u8,
85            JSValueType::JSVAL_TYPE_DOUBLE as u8,
86            true,
87            false,
88            false,
89            false,
90            false,
91            false,
92            0,
93        ).to_ne_bytes()
94    ),
95});
96}
97unsafe extern "C" fn get_actualBoundingBoxRight<D: DomTypes>
98(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
99    let mut result = false;
100    wrap_panic(&mut || result = (|| {
101        let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
102        let this = &*(this as *const D::TextMetrics);
103        let result: Finite<f64> = this.ActualBoundingBoxRight();
104
105        (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
106        return true;
107    })());
108    result
109}
110
111
112static actualBoundingBoxRight_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
113
114pub(crate) fn init_actualBoundingBoxRight_getterinfo<D: DomTypes>() {
115    actualBoundingBoxRight_getterinfo.set(JSJitInfo {
116    __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
117        getter: Some(get_actualBoundingBoxRight::<D>)
118    },
119    __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
120        protoID: PrototypeList::ID::TextMetrics as u16,
121    },
122    __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
123    _bitfield_align_1: [],
124    _bitfield_1: __BindgenBitfieldUnit::new(
125        new_jsjitinfo_bitfield_1!(
126            JSJitInfo_OpType::Getter as u8,
127            JSJitInfo_AliasSet::AliasEverything as u8,
128            JSValueType::JSVAL_TYPE_DOUBLE as u8,
129            true,
130            false,
131            false,
132            false,
133            false,
134            false,
135            0,
136        ).to_ne_bytes()
137    ),
138});
139}
140unsafe extern "C" fn get_fontBoundingBoxAscent<D: DomTypes>
141(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
142    let mut result = false;
143    wrap_panic(&mut || result = (|| {
144        let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
145        let this = &*(this as *const D::TextMetrics);
146        let result: Finite<f64> = this.FontBoundingBoxAscent();
147
148        (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
149        return true;
150    })());
151    result
152}
153
154
155static fontBoundingBoxAscent_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
156
157pub(crate) fn init_fontBoundingBoxAscent_getterinfo<D: DomTypes>() {
158    fontBoundingBoxAscent_getterinfo.set(JSJitInfo {
159    __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
160        getter: Some(get_fontBoundingBoxAscent::<D>)
161    },
162    __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
163        protoID: PrototypeList::ID::TextMetrics as u16,
164    },
165    __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
166    _bitfield_align_1: [],
167    _bitfield_1: __BindgenBitfieldUnit::new(
168        new_jsjitinfo_bitfield_1!(
169            JSJitInfo_OpType::Getter as u8,
170            JSJitInfo_AliasSet::AliasEverything as u8,
171            JSValueType::JSVAL_TYPE_DOUBLE as u8,
172            true,
173            false,
174            false,
175            false,
176            false,
177            false,
178            0,
179        ).to_ne_bytes()
180    ),
181});
182}
183unsafe extern "C" fn get_fontBoundingBoxDescent<D: DomTypes>
184(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
185    let mut result = false;
186    wrap_panic(&mut || result = (|| {
187        let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
188        let this = &*(this as *const D::TextMetrics);
189        let result: Finite<f64> = this.FontBoundingBoxDescent();
190
191        (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
192        return true;
193    })());
194    result
195}
196
197
198static fontBoundingBoxDescent_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
199
200pub(crate) fn init_fontBoundingBoxDescent_getterinfo<D: DomTypes>() {
201    fontBoundingBoxDescent_getterinfo.set(JSJitInfo {
202    __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
203        getter: Some(get_fontBoundingBoxDescent::<D>)
204    },
205    __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
206        protoID: PrototypeList::ID::TextMetrics as u16,
207    },
208    __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
209    _bitfield_align_1: [],
210    _bitfield_1: __BindgenBitfieldUnit::new(
211        new_jsjitinfo_bitfield_1!(
212            JSJitInfo_OpType::Getter as u8,
213            JSJitInfo_AliasSet::AliasEverything as u8,
214            JSValueType::JSVAL_TYPE_DOUBLE as u8,
215            true,
216            false,
217            false,
218            false,
219            false,
220            false,
221            0,
222        ).to_ne_bytes()
223    ),
224});
225}
226unsafe extern "C" fn get_actualBoundingBoxAscent<D: DomTypes>
227(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
228    let mut result = false;
229    wrap_panic(&mut || result = (|| {
230        let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
231        let this = &*(this as *const D::TextMetrics);
232        let result: Finite<f64> = this.ActualBoundingBoxAscent();
233
234        (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
235        return true;
236    })());
237    result
238}
239
240
241static actualBoundingBoxAscent_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
242
243pub(crate) fn init_actualBoundingBoxAscent_getterinfo<D: DomTypes>() {
244    actualBoundingBoxAscent_getterinfo.set(JSJitInfo {
245    __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
246        getter: Some(get_actualBoundingBoxAscent::<D>)
247    },
248    __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
249        protoID: PrototypeList::ID::TextMetrics as u16,
250    },
251    __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
252    _bitfield_align_1: [],
253    _bitfield_1: __BindgenBitfieldUnit::new(
254        new_jsjitinfo_bitfield_1!(
255            JSJitInfo_OpType::Getter as u8,
256            JSJitInfo_AliasSet::AliasEverything as u8,
257            JSValueType::JSVAL_TYPE_DOUBLE as u8,
258            true,
259            false,
260            false,
261            false,
262            false,
263            false,
264            0,
265        ).to_ne_bytes()
266    ),
267});
268}
269unsafe extern "C" fn get_actualBoundingBoxDescent<D: DomTypes>
270(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
271    let mut result = false;
272    wrap_panic(&mut || result = (|| {
273        let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
274        let this = &*(this as *const D::TextMetrics);
275        let result: Finite<f64> = this.ActualBoundingBoxDescent();
276
277        (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
278        return true;
279    })());
280    result
281}
282
283
284static actualBoundingBoxDescent_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
285
286pub(crate) fn init_actualBoundingBoxDescent_getterinfo<D: DomTypes>() {
287    actualBoundingBoxDescent_getterinfo.set(JSJitInfo {
288    __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
289        getter: Some(get_actualBoundingBoxDescent::<D>)
290    },
291    __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
292        protoID: PrototypeList::ID::TextMetrics as u16,
293    },
294    __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
295    _bitfield_align_1: [],
296    _bitfield_1: __BindgenBitfieldUnit::new(
297        new_jsjitinfo_bitfield_1!(
298            JSJitInfo_OpType::Getter as u8,
299            JSJitInfo_AliasSet::AliasEverything as u8,
300            JSValueType::JSVAL_TYPE_DOUBLE as u8,
301            true,
302            false,
303            false,
304            false,
305            false,
306            false,
307            0,
308        ).to_ne_bytes()
309    ),
310});
311}
312unsafe extern "C" fn get_emHeightAscent<D: DomTypes>
313(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
314    let mut result = false;
315    wrap_panic(&mut || result = (|| {
316        let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
317        let this = &*(this as *const D::TextMetrics);
318        let result: Finite<f64> = this.EmHeightAscent();
319
320        (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
321        return true;
322    })());
323    result
324}
325
326
327static emHeightAscent_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
328
329pub(crate) fn init_emHeightAscent_getterinfo<D: DomTypes>() {
330    emHeightAscent_getterinfo.set(JSJitInfo {
331    __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
332        getter: Some(get_emHeightAscent::<D>)
333    },
334    __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
335        protoID: PrototypeList::ID::TextMetrics as u16,
336    },
337    __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
338    _bitfield_align_1: [],
339    _bitfield_1: __BindgenBitfieldUnit::new(
340        new_jsjitinfo_bitfield_1!(
341            JSJitInfo_OpType::Getter as u8,
342            JSJitInfo_AliasSet::AliasEverything as u8,
343            JSValueType::JSVAL_TYPE_DOUBLE as u8,
344            true,
345            false,
346            false,
347            false,
348            false,
349            false,
350            0,
351        ).to_ne_bytes()
352    ),
353});
354}
355unsafe extern "C" fn get_emHeightDescent<D: DomTypes>
356(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
357    let mut result = false;
358    wrap_panic(&mut || result = (|| {
359        let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
360        let this = &*(this as *const D::TextMetrics);
361        let result: Finite<f64> = this.EmHeightDescent();
362
363        (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
364        return true;
365    })());
366    result
367}
368
369
370static emHeightDescent_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
371
372pub(crate) fn init_emHeightDescent_getterinfo<D: DomTypes>() {
373    emHeightDescent_getterinfo.set(JSJitInfo {
374    __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
375        getter: Some(get_emHeightDescent::<D>)
376    },
377    __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
378        protoID: PrototypeList::ID::TextMetrics as u16,
379    },
380    __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
381    _bitfield_align_1: [],
382    _bitfield_1: __BindgenBitfieldUnit::new(
383        new_jsjitinfo_bitfield_1!(
384            JSJitInfo_OpType::Getter as u8,
385            JSJitInfo_AliasSet::AliasEverything as u8,
386            JSValueType::JSVAL_TYPE_DOUBLE as u8,
387            true,
388            false,
389            false,
390            false,
391            false,
392            false,
393            0,
394        ).to_ne_bytes()
395    ),
396});
397}
398unsafe extern "C" fn get_hangingBaseline<D: DomTypes>
399(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
400    let mut result = false;
401    wrap_panic(&mut || result = (|| {
402        let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
403        let this = &*(this as *const D::TextMetrics);
404        let result: Finite<f64> = this.HangingBaseline();
405
406        (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
407        return true;
408    })());
409    result
410}
411
412
413static hangingBaseline_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
414
415pub(crate) fn init_hangingBaseline_getterinfo<D: DomTypes>() {
416    hangingBaseline_getterinfo.set(JSJitInfo {
417    __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
418        getter: Some(get_hangingBaseline::<D>)
419    },
420    __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
421        protoID: PrototypeList::ID::TextMetrics as u16,
422    },
423    __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
424    _bitfield_align_1: [],
425    _bitfield_1: __BindgenBitfieldUnit::new(
426        new_jsjitinfo_bitfield_1!(
427            JSJitInfo_OpType::Getter as u8,
428            JSJitInfo_AliasSet::AliasEverything as u8,
429            JSValueType::JSVAL_TYPE_DOUBLE as u8,
430            true,
431            false,
432            false,
433            false,
434            false,
435            false,
436            0,
437        ).to_ne_bytes()
438    ),
439});
440}
441unsafe extern "C" fn get_alphabeticBaseline<D: DomTypes>
442(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
443    let mut result = false;
444    wrap_panic(&mut || result = (|| {
445        let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
446        let this = &*(this as *const D::TextMetrics);
447        let result: Finite<f64> = this.AlphabeticBaseline();
448
449        (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
450        return true;
451    })());
452    result
453}
454
455
456static alphabeticBaseline_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
457
458pub(crate) fn init_alphabeticBaseline_getterinfo<D: DomTypes>() {
459    alphabeticBaseline_getterinfo.set(JSJitInfo {
460    __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
461        getter: Some(get_alphabeticBaseline::<D>)
462    },
463    __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
464        protoID: PrototypeList::ID::TextMetrics as u16,
465    },
466    __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
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_DOUBLE as u8,
473            true,
474            false,
475            false,
476            false,
477            false,
478            false,
479            0,
480        ).to_ne_bytes()
481    ),
482});
483}
484unsafe extern "C" fn get_ideographicBaseline<D: DomTypes>
485(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
486    let mut result = false;
487    wrap_panic(&mut || result = (|| {
488        let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
489        let this = &*(this as *const D::TextMetrics);
490        let result: Finite<f64> = this.IdeographicBaseline();
491
492        (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
493        return true;
494    })());
495    result
496}
497
498
499static ideographicBaseline_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
500
501pub(crate) fn init_ideographicBaseline_getterinfo<D: DomTypes>() {
502    ideographicBaseline_getterinfo.set(JSJitInfo {
503    __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
504        getter: Some(get_ideographicBaseline::<D>)
505    },
506    __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
507        protoID: PrototypeList::ID::TextMetrics as u16,
508    },
509    __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
510    _bitfield_align_1: [],
511    _bitfield_1: __BindgenBitfieldUnit::new(
512        new_jsjitinfo_bitfield_1!(
513            JSJitInfo_OpType::Getter as u8,
514            JSJitInfo_AliasSet::AliasEverything as u8,
515            JSValueType::JSVAL_TYPE_DOUBLE as u8,
516            true,
517            false,
518            false,
519            false,
520            false,
521            false,
522            0,
523        ).to_ne_bytes()
524    ),
525});
526}
527unsafe extern "C" fn _finalize<D: DomTypes>
528(_cx: *mut GCContext, obj: *mut JSObject){
529    wrap_panic(&mut || {
530
531        let this = native_from_object_static::<D::TextMetrics>(obj).unwrap();
532        finalize_common(this);
533    })
534}
535
536unsafe extern "C" fn _trace<D: DomTypes>
537(trc: *mut JSTracer, obj: *mut JSObject){
538    wrap_panic(&mut || {
539
540        let this = native_from_object_static::<D::TextMetrics>(obj).unwrap();
541        if this.is_null() { return; } // GC during obj creation
542        (*this).trace(trc);
543    })
544}
545
546
547static CLASS_OPS: ThreadUnsafeOnceLock<JSClassOps> = ThreadUnsafeOnceLock::new();
548
549pub(crate) fn init_class_ops<D: DomTypes>() {
550    CLASS_OPS.set(JSClassOps {
551        addProperty: None,
552        delProperty: None,
553        enumerate: None,
554        newEnumerate: None,
555        resolve: None,
556        mayResolve: None,
557        finalize: Some(_finalize::<D>),
558        call: None,
559        construct: None,
560        trace: Some(_trace::<D>),
561    });
562}
563
564pub static Class: ThreadUnsafeOnceLock<DOMJSClass> = ThreadUnsafeOnceLock::new();
565
566pub(crate) fn init_domjs_class<D: DomTypes>() {
567    init_class_ops::<D>();
568    Class.set(DOMJSClass {
569        base: JSClass {
570            name: c"TextMetrics".as_ptr(),
571            flags: JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE |
572                   (((1) & JSCLASS_RESERVED_SLOTS_MASK) << JSCLASS_RESERVED_SLOTS_SHIFT)
573                   /* JSCLASS_HAS_RESERVED_SLOTS(1) */,
574            cOps: unsafe { CLASS_OPS.get() },
575            spec: ptr::null(),
576            ext: ptr::null(),
577            oOps: ptr::null(),
578        },
579        dom_class:
580DOMClass {
581    interface_chain: [ PrototypeList::ID::TextMetrics, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last ],
582    depth: 0,
583    type_id: crate::codegen::InheritTypes::TopTypeId { alone: () },
584    malloc_size_of: malloc_size_of_including_raw_self::<D::TextMetrics> as unsafe fn(&mut _, _) -> _,
585    global: Globals::EMPTY,
586},
587    });
588}
589
590#[cfg_attr(crown, allow(crown::unrooted_must_root))] pub unsafe fn Wrap<D: DomTypes>
591(cx: SafeJSContext, scope: &D::GlobalScope, given_proto: Option<HandleObject>, object: Box<D::TextMetrics>, _can_gc: CanGc) -> DomRoot<D::TextMetrics>{
592
593    let raw = Root::new(MaybeUnreflectedDom::from_box(object));
594
595    let scope = scope.reflector().get_jsobject();
596    assert!(!scope.get().is_null());
597    assert!(((*get_object_class(scope.get())).flags & JSCLASS_IS_GLOBAL) != 0);
598    let _ac = JSAutoRealm::new(cx.raw_cx(), scope.get());
599
600    rooted!(&in(cx) let mut canonical_proto = ptr::null_mut::<JSObject>());
601    GetProtoObject::<D>(cx, scope, canonical_proto.handle_mut());
602    assert!(!canonical_proto.is_null());
603
604
605    rooted!(&in(cx) let mut proto = ptr::null_mut::<JSObject>());
606    if let Some(given) = given_proto {
607        proto.set(*given);
608        if get_context_realm(cx.raw_cx()) != get_object_realm(*given) {
609            assert!(JS_WrapObject(cx.raw_cx(), proto.handle_mut()));
610        }
611    } else {
612        proto.set(*canonical_proto);
613    }
614    rooted!(&in(cx) let obj = JS_NewObjectWithGivenProto(
615        cx.raw_cx(),
616        &Class.get().base,
617        proto.handle(),
618    ));
619    assert!(!obj.is_null());
620    JS_SetReservedSlot(
621        obj.get(),
622        DOM_OBJECT_SLOT,
623        &PrivateValue(raw.as_ptr() as *const libc::c_void),
624    );
625
626    let root = raw.reflect_with(obj.get());
627
628
629
630    DomRoot::from_ref(&*root)
631}
632
633pub trait TextMetricsMethods<D: DomTypes> {
634    fn Width(&self, ) -> Finite<f64>;
635    fn ActualBoundingBoxLeft(&self, ) -> Finite<f64>;
636    fn ActualBoundingBoxRight(&self, ) -> Finite<f64>;
637    fn FontBoundingBoxAscent(&self, ) -> Finite<f64>;
638    fn FontBoundingBoxDescent(&self, ) -> Finite<f64>;
639    fn ActualBoundingBoxAscent(&self, ) -> Finite<f64>;
640    fn ActualBoundingBoxDescent(&self, ) -> Finite<f64>;
641    fn EmHeightAscent(&self, ) -> Finite<f64>;
642    fn EmHeightDescent(&self, ) -> Finite<f64>;
643    fn HangingBaseline(&self, ) -> Finite<f64>;
644    fn AlphabeticBaseline(&self, ) -> Finite<f64>;
645    fn IdeographicBaseline(&self, ) -> Finite<f64>;
646}
647static sAttributes_specs: ThreadUnsafeOnceLock<&[&[JSPropertySpec]]> = ThreadUnsafeOnceLock::new();
648
649pub(crate) fn init_sAttributes_specs<D: DomTypes>() {
650    sAttributes_specs.set(Box::leak(Box::new([&Box::leak(Box::new([
651    JSPropertySpec {
652                    name: JSPropertySpec_Name { string_: c"width".as_ptr() },
653                    attributes_: (JSPROP_ENUMERATE),
654                    kind_: (JSPropertySpec_Kind::NativeAccessor),
655                    u: JSPropertySpec_AccessorsOrValue {
656                        accessors: JSPropertySpec_AccessorsOrValue_Accessors {
657                            getter: JSPropertySpec_Accessor {
658                                native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { width_getterinfo.get() } },
659                            },
660                            setter: JSPropertySpec_Accessor {
661                                native: JSNativeWrapper { op: None, info: ptr::null() },
662                            }
663                        }
664                    }
665                }
666,
667    JSPropertySpec {
668                    name: JSPropertySpec_Name { string_: c"actualBoundingBoxLeft".as_ptr() },
669                    attributes_: (JSPROP_ENUMERATE),
670                    kind_: (JSPropertySpec_Kind::NativeAccessor),
671                    u: JSPropertySpec_AccessorsOrValue {
672                        accessors: JSPropertySpec_AccessorsOrValue_Accessors {
673                            getter: JSPropertySpec_Accessor {
674                                native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { actualBoundingBoxLeft_getterinfo.get() } },
675                            },
676                            setter: JSPropertySpec_Accessor {
677                                native: JSNativeWrapper { op: None, info: ptr::null() },
678                            }
679                        }
680                    }
681                }
682,
683    JSPropertySpec {
684                    name: JSPropertySpec_Name { string_: c"actualBoundingBoxRight".as_ptr() },
685                    attributes_: (JSPROP_ENUMERATE),
686                    kind_: (JSPropertySpec_Kind::NativeAccessor),
687                    u: JSPropertySpec_AccessorsOrValue {
688                        accessors: JSPropertySpec_AccessorsOrValue_Accessors {
689                            getter: JSPropertySpec_Accessor {
690                                native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { actualBoundingBoxRight_getterinfo.get() } },
691                            },
692                            setter: JSPropertySpec_Accessor {
693                                native: JSNativeWrapper { op: None, info: ptr::null() },
694                            }
695                        }
696                    }
697                }
698,
699    JSPropertySpec {
700                    name: JSPropertySpec_Name { string_: c"fontBoundingBoxAscent".as_ptr() },
701                    attributes_: (JSPROP_ENUMERATE),
702                    kind_: (JSPropertySpec_Kind::NativeAccessor),
703                    u: JSPropertySpec_AccessorsOrValue {
704                        accessors: JSPropertySpec_AccessorsOrValue_Accessors {
705                            getter: JSPropertySpec_Accessor {
706                                native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { fontBoundingBoxAscent_getterinfo.get() } },
707                            },
708                            setter: JSPropertySpec_Accessor {
709                                native: JSNativeWrapper { op: None, info: ptr::null() },
710                            }
711                        }
712                    }
713                }
714,
715    JSPropertySpec {
716                    name: JSPropertySpec_Name { string_: c"fontBoundingBoxDescent".as_ptr() },
717                    attributes_: (JSPROP_ENUMERATE),
718                    kind_: (JSPropertySpec_Kind::NativeAccessor),
719                    u: JSPropertySpec_AccessorsOrValue {
720                        accessors: JSPropertySpec_AccessorsOrValue_Accessors {
721                            getter: JSPropertySpec_Accessor {
722                                native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { fontBoundingBoxDescent_getterinfo.get() } },
723                            },
724                            setter: JSPropertySpec_Accessor {
725                                native: JSNativeWrapper { op: None, info: ptr::null() },
726                            }
727                        }
728                    }
729                }
730,
731    JSPropertySpec {
732                    name: JSPropertySpec_Name { string_: c"actualBoundingBoxAscent".as_ptr() },
733                    attributes_: (JSPROP_ENUMERATE),
734                    kind_: (JSPropertySpec_Kind::NativeAccessor),
735                    u: JSPropertySpec_AccessorsOrValue {
736                        accessors: JSPropertySpec_AccessorsOrValue_Accessors {
737                            getter: JSPropertySpec_Accessor {
738                                native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { actualBoundingBoxAscent_getterinfo.get() } },
739                            },
740                            setter: JSPropertySpec_Accessor {
741                                native: JSNativeWrapper { op: None, info: ptr::null() },
742                            }
743                        }
744                    }
745                }
746,
747    JSPropertySpec {
748                    name: JSPropertySpec_Name { string_: c"actualBoundingBoxDescent".as_ptr() },
749                    attributes_: (JSPROP_ENUMERATE),
750                    kind_: (JSPropertySpec_Kind::NativeAccessor),
751                    u: JSPropertySpec_AccessorsOrValue {
752                        accessors: JSPropertySpec_AccessorsOrValue_Accessors {
753                            getter: JSPropertySpec_Accessor {
754                                native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { actualBoundingBoxDescent_getterinfo.get() } },
755                            },
756                            setter: JSPropertySpec_Accessor {
757                                native: JSNativeWrapper { op: None, info: ptr::null() },
758                            }
759                        }
760                    }
761                }
762,
763    JSPropertySpec {
764                    name: JSPropertySpec_Name { string_: c"emHeightAscent".as_ptr() },
765                    attributes_: (JSPROP_ENUMERATE),
766                    kind_: (JSPropertySpec_Kind::NativeAccessor),
767                    u: JSPropertySpec_AccessorsOrValue {
768                        accessors: JSPropertySpec_AccessorsOrValue_Accessors {
769                            getter: JSPropertySpec_Accessor {
770                                native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { emHeightAscent_getterinfo.get() } },
771                            },
772                            setter: JSPropertySpec_Accessor {
773                                native: JSNativeWrapper { op: None, info: ptr::null() },
774                            }
775                        }
776                    }
777                }
778,
779    JSPropertySpec {
780                    name: JSPropertySpec_Name { string_: c"emHeightDescent".as_ptr() },
781                    attributes_: (JSPROP_ENUMERATE),
782                    kind_: (JSPropertySpec_Kind::NativeAccessor),
783                    u: JSPropertySpec_AccessorsOrValue {
784                        accessors: JSPropertySpec_AccessorsOrValue_Accessors {
785                            getter: JSPropertySpec_Accessor {
786                                native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { emHeightDescent_getterinfo.get() } },
787                            },
788                            setter: JSPropertySpec_Accessor {
789                                native: JSNativeWrapper { op: None, info: ptr::null() },
790                            }
791                        }
792                    }
793                }
794,
795    JSPropertySpec {
796                    name: JSPropertySpec_Name { string_: c"hangingBaseline".as_ptr() },
797                    attributes_: (JSPROP_ENUMERATE),
798                    kind_: (JSPropertySpec_Kind::NativeAccessor),
799                    u: JSPropertySpec_AccessorsOrValue {
800                        accessors: JSPropertySpec_AccessorsOrValue_Accessors {
801                            getter: JSPropertySpec_Accessor {
802                                native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { hangingBaseline_getterinfo.get() } },
803                            },
804                            setter: JSPropertySpec_Accessor {
805                                native: JSNativeWrapper { op: None, info: ptr::null() },
806                            }
807                        }
808                    }
809                }
810,
811    JSPropertySpec {
812                    name: JSPropertySpec_Name { string_: c"alphabeticBaseline".as_ptr() },
813                    attributes_: (JSPROP_ENUMERATE),
814                    kind_: (JSPropertySpec_Kind::NativeAccessor),
815                    u: JSPropertySpec_AccessorsOrValue {
816                        accessors: JSPropertySpec_AccessorsOrValue_Accessors {
817                            getter: JSPropertySpec_Accessor {
818                                native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { alphabeticBaseline_getterinfo.get() } },
819                            },
820                            setter: JSPropertySpec_Accessor {
821                                native: JSNativeWrapper { op: None, info: ptr::null() },
822                            }
823                        }
824                    }
825                }
826,
827    JSPropertySpec {
828                    name: JSPropertySpec_Name { string_: c"ideographicBaseline".as_ptr() },
829                    attributes_: (JSPROP_ENUMERATE),
830                    kind_: (JSPropertySpec_Kind::NativeAccessor),
831                    u: JSPropertySpec_AccessorsOrValue {
832                        accessors: JSPropertySpec_AccessorsOrValue_Accessors {
833                            getter: JSPropertySpec_Accessor {
834                                native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { ideographicBaseline_getterinfo.get() } },
835                            },
836                            setter: JSPropertySpec_Accessor {
837                                native: JSNativeWrapper { op: None, info: ptr::null() },
838                            }
839                        }
840                    }
841                }
842,
843    JSPropertySpec::ZERO]))[..]
844,
845&Box::leak(Box::new([
846    JSPropertySpec {
847                    name: JSPropertySpec_Name { symbol_: SymbolCode::toStringTag as usize + 1 },
848                    attributes_: (JSPROP_READONLY),
849                    kind_: (JSPropertySpec_Kind::Value),
850                    u: JSPropertySpec_AccessorsOrValue {
851                        value: JSPropertySpec_ValueWrapper {
852                            type_: JSPropertySpec_ValueWrapper_Type::String,
853                            __bindgen_anon_1: JSPropertySpec_ValueWrapper__bindgen_ty_1 {
854                                string: c"TextMetrics".as_ptr(),
855                            }
856                        }
857                    }
858                }
859,
860    JSPropertySpec::ZERO]))[..]
861])));
862}static sAttributes: ThreadUnsafeOnceLock<&[Guard<&[JSPropertySpec]>]> = ThreadUnsafeOnceLock::new();
863
864pub(crate) fn init_sAttributes_prefs<D: DomTypes>() {
865    sAttributes.set(Box::leak(Box::new([    Guard::new(&[Condition::Exposed(Globals::WINDOW),Condition::Exposed(Globals::SERVICE_WORKER_GLOBAL_SCOPE),Condition::Exposed(Globals::PAINT_WORKLET_GLOBAL_SCOPE),Condition::Exposed(Globals::DEDICATED_WORKER_GLOBAL_SCOPE)], (unsafe { sAttributes_specs.get() })[0]),
866    Guard::new(&[Condition::Satisfied], (unsafe { sAttributes_specs.get() })[1])])));
867}
868pub fn GetProtoObject<D: DomTypes>
869(cx: SafeJSContext, global: HandleObject, mut rval: MutableHandleObject){
870    /* Get the interface prototype object for this class.  This will create the
871       object as needed. */get_per_interface_object_handle(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::TextMetrics), CreateInterfaceObjects::<D>, rval)
872}
873
874
875static PrototypeClass: JSClass = JSClass {
876    name: c"TextMetricsPrototype".as_ptr(),
877    flags:
878        // JSCLASS_HAS_RESERVED_SLOTS()
879        (0 ) << JSCLASS_RESERVED_SLOTS_SHIFT,
880    cOps: ptr::null(),
881    spec: ptr::null(),
882    ext: ptr::null(),
883    oOps: ptr::null(),
884};
885
886
887static INTERFACE_OBJECT_CLASS: ThreadUnsafeOnceLock<NonCallbackInterfaceObjectClass> = ThreadUnsafeOnceLock::new();
888
889pub(crate) fn init_interface_object<D: DomTypes>() {
890    INTERFACE_OBJECT_CLASS.set(NonCallbackInterfaceObjectClass::new(
891        Box::leak(Box::new(InterfaceConstructorBehavior::throw())),
892        b"function TextMetrics() {\n    [native code]\n}",
893        PrototypeList::ID::TextMetrics,
894        0,
895    ));
896}
897
898pub fn DefineDOMInterface<D: DomTypes>
899(cx: SafeJSContext, global: HandleObject){
900    define_dom_interface(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::TextMetrics),CreateInterfaceObjects::<D>, ConstructorEnabled::<D>)
901}
902
903pub fn ConstructorEnabled<D: DomTypes>
904(aCx: SafeJSContext, aObj: HandleObject) -> bool{
905    is_exposed_in(aObj, Globals::DEDICATED_WORKER_GLOBAL_SCOPE | Globals::PAINT_WORKLET_GLOBAL_SCOPE | Globals::SERVICE_WORKER_GLOBAL_SCOPE | Globals::WINDOW) &&
906    pref!(dom_canvas_text_enabled)
907}
908
909unsafe fn CreateInterfaceObjects<D: DomTypes>
910(cx: SafeJSContext, global: HandleObject, cache: *mut ProtoOrIfaceArray){
911
912    rooted!(&in(cx) let mut prototype_proto = ptr::null_mut::<JSObject>());
913    prototype_proto.set(GetRealmObjectPrototype(cx.raw_cx()));
914    assert!(!prototype_proto.is_null());
915
916    rooted!(&in(cx) let mut prototype = ptr::null_mut::<JSObject>());
917    create_interface_prototype_object::<D>(cx,
918                                      global,
919                                      prototype_proto.handle(),
920                                      &PrototypeClass,
921                                      &[],
922                                      sAttributes.get(),
923                                      &[],
924                                      &[],
925                                      prototype.handle_mut());
926    assert!(!prototype.is_null());
927    assert!((*cache)[PrototypeList::ID::TextMetrics as usize].is_null());
928    (*cache)[PrototypeList::ID::TextMetrics as usize] = prototype.get();
929    <*mut JSObject>::post_barrier((*cache).as_mut_ptr().offset(PrototypeList::ID::TextMetrics as isize),
930                                  ptr::null_mut(),
931                                  prototype.get());
932
933    rooted!(&in(cx) let mut interface_proto = ptr::null_mut::<JSObject>());
934    interface_proto.set(GetRealmFunctionPrototype(cx.raw_cx()));
935
936    assert!(!interface_proto.is_null());
937
938    rooted!(&in(cx) let mut interface = ptr::null_mut::<JSObject>());
939    create_noncallback_interface_object::<D>(cx,
940                                        global,
941                                        interface_proto.handle(),
942                                        INTERFACE_OBJECT_CLASS.get(),
943                                        &[],
944                                        &[],
945                                        &[],
946                                        prototype.handle(),
947                                        c"TextMetrics",
948                                        0,
949                                        &[],
950                                        interface.handle_mut());
951    assert!(!interface.is_null());
952}
953
954
955        pub(crate) fn init_statics<D: DomTypes>() {
956            init_interface_object::<D>();
957            init_domjs_class::<D>();
958
959            init_width_getterinfo::<D>();
960init_actualBoundingBoxLeft_getterinfo::<D>();
961init_actualBoundingBoxRight_getterinfo::<D>();
962init_fontBoundingBoxAscent_getterinfo::<D>();
963init_fontBoundingBoxDescent_getterinfo::<D>();
964init_actualBoundingBoxAscent_getterinfo::<D>();
965init_actualBoundingBoxDescent_getterinfo::<D>();
966init_emHeightAscent_getterinfo::<D>();
967init_emHeightDescent_getterinfo::<D>();
968init_hangingBaseline_getterinfo::<D>();
969init_alphabeticBaseline_getterinfo::<D>();
970init_ideographicBaseline_getterinfo::<D>();
971
972
973            init_sAttributes_specs::<D>();
974init_sAttributes_prefs::<D>();
975        }
976        } // mod TextMetrics_Binding
977
978