1#![allow(non_camel_case_types,non_upper_case_globals,unsafe_op_in_unsafe_fn,unused_imports,unused_variables,unused_assignments,unused_mut,clippy::approx_constant,clippy::enum_variant_names,clippy::let_unit_value,clippy::needless_return,clippy::too_many_arguments,clippy::unnecessary_cast,clippy::upper_case_acronyms)]
4
5use crate::codegen::GenericBindings::ElementBinding::Element_Binding;
6use crate::codegen::GenericBindings::EventTargetBinding::EventTarget_Binding;
7use crate::codegen::GenericBindings::HTMLElementBinding::HTMLElement_Binding;
8use crate::codegen::GenericBindings::NodeBinding::Node_Binding;
9use crate::import::base::*;
10
11pub use self::HTMLTableColElement_Binding::{Wrap, HTMLTableColElementMethods, GetProtoObject, GetConstructorObject, DefineDOMInterface};
12pub mod HTMLTableColElement_Binding {
13use crate::codegen::GenericBindings::ElementBinding::Element_Binding;
14use crate::codegen::GenericBindings::EventTargetBinding::EventTarget_Binding;
15use crate::codegen::GenericBindings::HTMLElementBinding::HTMLElement_Binding;
16use crate::codegen::GenericBindings::NodeBinding::Node_Binding;
17use crate::import::module::*;
18
19unsafe extern "C" fn get_span<D: DomTypes>
20(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
21 let mut result = false;
22 wrap_panic(&mut || result = (|| {
23 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
24 let this = &*(this as *const D::HTMLTableColElement);
25 <D as DomHelpers<D>>::push_new_element_queue();
26
27 let result: u32 = this.Span();
28 <D as DomHelpers<D>>::pop_current_element_queue(CanGc::note());
29
30
31 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
32 return true;
33 })());
34 result
35}
36
37unsafe extern "C" fn set_span<D: DomTypes>
38(cx: *mut RawJSContext, obj: RawHandleObject, this: *mut libc::c_void, args: JSJitSetterCallArgs) -> bool{
39 let mut result = false;
40 wrap_panic(&mut || result = (|| {
41 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
42 let this = &*(this as *const D::HTMLTableColElement);
43 let arg0: u32 = match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(0)), ConversionBehavior::Default) {
44 Ok(ConversionResult::Success(value)) => value,
45 Ok(ConversionResult::Failure(error)) => {
46 throw_type_error(cx.raw_cx(), &error);
47 return false;
48
49 }
50 _ => {
51 return false;
52
53 },
54 }
55 ;
56 <D as DomHelpers<D>>::push_new_element_queue();
57
58 let result: () = this.SetSpan(arg0);
59 <D as DomHelpers<D>>::pop_current_element_queue(CanGc::note());
60
61
62 true
63 })());
64 result
65}
66
67
68static span_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
69
70pub(crate) fn init_span_getterinfo<D: DomTypes>() {
71 span_getterinfo.set(JSJitInfo {
72 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
73 getter: Some(get_span::<D>)
74 },
75 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
76 protoID: PrototypeList::ID::HTMLTableColElement as u16,
77 },
78 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 4 },
79 _bitfield_align_1: [],
80 _bitfield_1: __BindgenBitfieldUnit::new(
81 new_jsjitinfo_bitfield_1!(
82 JSJitInfo_OpType::Getter as u8,
83 JSJitInfo_AliasSet::AliasEverything as u8,
84 JSValueType::JSVAL_TYPE_DOUBLE as u8,
85 true,
86 false,
87 false,
88 false,
89 false,
90 false,
91 0,
92 ).to_ne_bytes()
93 ),
94});
95}
96static span_setterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
97
98pub(crate) fn init_span_setterinfo<D: DomTypes>() {
99 span_setterinfo.set(JSJitInfo {
100 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
101 setter: Some(set_span::<D>)
102 },
103 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
104 protoID: PrototypeList::ID::HTMLTableColElement as u16,
105 },
106 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 4 },
107 _bitfield_align_1: [],
108 _bitfield_1: __BindgenBitfieldUnit::new(
109 new_jsjitinfo_bitfield_1!(
110 JSJitInfo_OpType::Setter as u8,
111 JSJitInfo_AliasSet::AliasEverything as u8,
112 JSValueType::JSVAL_TYPE_UNDEFINED as u8,
113 false,
114 false,
115 false,
116 false,
117 false,
118 false,
119 0,
120 ).to_ne_bytes()
121 ),
122});
123}
124unsafe extern "C" fn get_width<D: DomTypes>
125(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
126 let mut result = false;
127 wrap_panic(&mut || result = (|| {
128 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
129 let this = &*(this as *const D::HTMLTableColElement);
130 <D as DomHelpers<D>>::push_new_element_queue();
131
132 let result: DOMString = this.Width();
133 <D as DomHelpers<D>>::pop_current_element_queue(CanGc::note());
134
135
136 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
137 return true;
138 })());
139 result
140}
141
142unsafe extern "C" fn set_width<D: DomTypes>
143(cx: *mut RawJSContext, obj: RawHandleObject, this: *mut libc::c_void, args: JSJitSetterCallArgs) -> bool{
144 let mut result = false;
145 wrap_panic(&mut || result = (|| {
146 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
147 let this = &*(this as *const D::HTMLTableColElement);
148 let arg0: DOMString = match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(0)), StringificationBehavior::Default) {
149 Ok(ConversionResult::Success(value)) => value,
150 Ok(ConversionResult::Failure(error)) => {
151 throw_type_error(cx.raw_cx(), &error);
152 return false;
153
154 }
155 _ => {
156 return false;
157
158 },
159 }
160 ;
161 <D as DomHelpers<D>>::push_new_element_queue();
162
163 let result: () = this.SetWidth(arg0);
164 <D as DomHelpers<D>>::pop_current_element_queue(CanGc::note());
165
166
167 true
168 })());
169 result
170}
171
172
173static width_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
174
175pub(crate) fn init_width_getterinfo<D: DomTypes>() {
176 width_getterinfo.set(JSJitInfo {
177 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
178 getter: Some(get_width::<D>)
179 },
180 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
181 protoID: PrototypeList::ID::HTMLTableColElement as u16,
182 },
183 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 4 },
184 _bitfield_align_1: [],
185 _bitfield_1: __BindgenBitfieldUnit::new(
186 new_jsjitinfo_bitfield_1!(
187 JSJitInfo_OpType::Getter as u8,
188 JSJitInfo_AliasSet::AliasEverything as u8,
189 JSValueType::JSVAL_TYPE_STRING as u8,
190 true,
191 false,
192 false,
193 false,
194 false,
195 false,
196 0,
197 ).to_ne_bytes()
198 ),
199});
200}
201static width_setterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
202
203pub(crate) fn init_width_setterinfo<D: DomTypes>() {
204 width_setterinfo.set(JSJitInfo {
205 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
206 setter: Some(set_width::<D>)
207 },
208 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
209 protoID: PrototypeList::ID::HTMLTableColElement as u16,
210 },
211 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 4 },
212 _bitfield_align_1: [],
213 _bitfield_1: __BindgenBitfieldUnit::new(
214 new_jsjitinfo_bitfield_1!(
215 JSJitInfo_OpType::Setter as u8,
216 JSJitInfo_AliasSet::AliasEverything as u8,
217 JSValueType::JSVAL_TYPE_UNDEFINED as u8,
218 false,
219 false,
220 false,
221 false,
222 false,
223 false,
224 0,
225 ).to_ne_bytes()
226 ),
227});
228}
229unsafe extern "C" fn _finalize<D: DomTypes>
230(_cx: *mut GCContext, obj: *mut JSObject){
231 wrap_panic(&mut || {
232
233 let this = native_from_object_static::<D::HTMLTableColElement>(obj).unwrap();
234 finalize_common(this);
235 })
236}
237
238unsafe extern "C" fn _trace<D: DomTypes>
239(trc: *mut JSTracer, obj: *mut JSObject){
240 wrap_panic(&mut || {
241
242 let this = native_from_object_static::<D::HTMLTableColElement>(obj).unwrap();
243 if this.is_null() { return; } (*this).trace(trc);
245 })
246}
247
248
249static CLASS_OPS: ThreadUnsafeOnceLock<JSClassOps> = ThreadUnsafeOnceLock::new();
250
251pub(crate) fn init_class_ops<D: DomTypes>() {
252 CLASS_OPS.set(JSClassOps {
253 addProperty: None,
254 delProperty: None,
255 enumerate: None,
256 newEnumerate: None,
257 resolve: None,
258 mayResolve: None,
259 finalize: Some(_finalize::<D>),
260 call: None,
261 construct: None,
262 trace: Some(_trace::<D>),
263 });
264}
265
266pub static Class: ThreadUnsafeOnceLock<DOMJSClass> = ThreadUnsafeOnceLock::new();
267
268pub(crate) fn init_domjs_class<D: DomTypes>() {
269 init_class_ops::<D>();
270 Class.set(DOMJSClass {
271 base: JSClass {
272 name: c"HTMLTableColElement".as_ptr(),
273 flags: JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE |
274 (((1) & JSCLASS_RESERVED_SLOTS_MASK) << JSCLASS_RESERVED_SLOTS_SHIFT)
275 ,
276 cOps: unsafe { CLASS_OPS.get() },
277 spec: ptr::null(),
278 ext: ptr::null(),
279 oOps: ptr::null(),
280 },
281 dom_class:
282DOMClass {
283 interface_chain: [ PrototypeList::ID::EventTarget, PrototypeList::ID::Node, PrototypeList::ID::Element, PrototypeList::ID::HTMLElement, PrototypeList::ID::HTMLTableColElement, PrototypeList::ID::Last ],
284 depth: 4,
285 type_id: crate::codegen::InheritTypes::TopTypeId { eventtarget: (crate::codegen::InheritTypes::EventTargetTypeId::Node(crate::codegen::InheritTypes::NodeTypeId::Element(crate::codegen::InheritTypes::ElementTypeId::HTMLElement(crate::codegen::InheritTypes::HTMLElementTypeId::HTMLTableColElement)))) },
286 malloc_size_of: malloc_size_of_including_raw_self::<D::HTMLTableColElement> as unsafe fn(&mut _, _) -> _,
287 global: Globals::EMPTY,
288},
289 });
290}
291
292#[cfg_attr(crown, allow(crown::unrooted_must_root))] pub unsafe fn Wrap<D: DomTypes>
293(cx: SafeJSContext, scope: &D::GlobalScope, given_proto: Option<HandleObject>, object: Box<D::HTMLTableColElement>, _can_gc: CanGc) -> DomRoot<D::HTMLTableColElement>{
294
295 let raw = Root::new(MaybeUnreflectedDom::from_box(object));
296
297 let scope = scope.reflector().get_jsobject();
298 assert!(!scope.get().is_null());
299 assert!(((*get_object_class(scope.get())).flags & JSCLASS_IS_GLOBAL) != 0);
300 let _ac = JSAutoRealm::new(cx.raw_cx(), scope.get());
301
302 rooted!(&in(cx) let mut canonical_proto = ptr::null_mut::<JSObject>());
303 GetProtoObject::<D>(cx, scope, canonical_proto.handle_mut());
304 assert!(!canonical_proto.is_null());
305
306
307 rooted!(&in(cx) let mut proto = ptr::null_mut::<JSObject>());
308 if let Some(given) = given_proto {
309 proto.set(*given);
310 if get_context_realm(cx.raw_cx()) != get_object_realm(*given) {
311 assert!(JS_WrapObject(cx.raw_cx(), proto.handle_mut()));
312 }
313 } else {
314 proto.set(*canonical_proto);
315 }
316 rooted!(&in(cx) let obj = JS_NewObjectWithGivenProto(
317 cx.raw_cx(),
318 &Class.get().base,
319 proto.handle(),
320 ));
321 assert!(!obj.is_null());
322 JS_SetReservedSlot(
323 obj.get(),
324 DOM_OBJECT_SLOT,
325 &PrivateValue(raw.as_ptr() as *const libc::c_void),
326 );
327
328 let root = raw.reflect_with(obj.get());
329
330
331
332 DomRoot::from_ref(&*root)
333}
334
335pub trait HTMLTableColElementMethods<D: DomTypes> {
336 fn Span(&self, ) -> u32;
337 fn SetSpan(&self, r#value: u32);
338 fn Width(&self, ) -> DOMString;
339 fn SetWidth(&self, r#value: DOMString);
340}
341static sAttributes_specs: ThreadUnsafeOnceLock<&[&[JSPropertySpec]]> = ThreadUnsafeOnceLock::new();
342
343pub(crate) fn init_sAttributes_specs<D: DomTypes>() {
344 sAttributes_specs.set(Box::leak(Box::new([&Box::leak(Box::new([
345 JSPropertySpec {
346 name: JSPropertySpec_Name { string_: c"span".as_ptr() },
347 attributes_: (JSPROP_ENUMERATE),
348 kind_: (JSPropertySpec_Kind::NativeAccessor),
349 u: JSPropertySpec_AccessorsOrValue {
350 accessors: JSPropertySpec_AccessorsOrValue_Accessors {
351 getter: JSPropertySpec_Accessor {
352 native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { span_getterinfo.get() } },
353 },
354 setter: JSPropertySpec_Accessor {
355 native: JSNativeWrapper { op: Some(generic_setter), info: unsafe { span_setterinfo.get() } },
356 }
357 }
358 }
359 }
360,
361 JSPropertySpec {
362 name: JSPropertySpec_Name { string_: c"width".as_ptr() },
363 attributes_: (JSPROP_ENUMERATE),
364 kind_: (JSPropertySpec_Kind::NativeAccessor),
365 u: JSPropertySpec_AccessorsOrValue {
366 accessors: JSPropertySpec_AccessorsOrValue_Accessors {
367 getter: JSPropertySpec_Accessor {
368 native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { width_getterinfo.get() } },
369 },
370 setter: JSPropertySpec_Accessor {
371 native: JSNativeWrapper { op: Some(generic_setter), info: unsafe { width_setterinfo.get() } },
372 }
373 }
374 }
375 }
376,
377 JSPropertySpec::ZERO]))[..]
378,
379&Box::leak(Box::new([
380 JSPropertySpec {
381 name: JSPropertySpec_Name { symbol_: SymbolCode::toStringTag as usize + 1 },
382 attributes_: (JSPROP_READONLY),
383 kind_: (JSPropertySpec_Kind::Value),
384 u: JSPropertySpec_AccessorsOrValue {
385 value: JSPropertySpec_ValueWrapper {
386 type_: JSPropertySpec_ValueWrapper_Type::String,
387 __bindgen_anon_1: JSPropertySpec_ValueWrapper__bindgen_ty_1 {
388 string: c"HTMLTableColElement".as_ptr(),
389 }
390 }
391 }
392 }
393,
394 JSPropertySpec::ZERO]))[..]
395])));
396}static sAttributes: ThreadUnsafeOnceLock<&[Guard<&[JSPropertySpec]>]> = ThreadUnsafeOnceLock::new();
397
398pub(crate) fn init_sAttributes_prefs<D: DomTypes>() {
399 sAttributes.set(Box::leak(Box::new([ Guard::new(&[Condition::Exposed(Globals::WINDOW)], (unsafe { sAttributes_specs.get() })[0]),
400 Guard::new(&[Condition::Satisfied], (unsafe { sAttributes_specs.get() })[1])])));
401}
402pub fn GetProtoObject<D: DomTypes>
403(cx: SafeJSContext, global: HandleObject, mut rval: MutableHandleObject){
404 get_per_interface_object_handle(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::HTMLTableColElement), CreateInterfaceObjects::<D>, rval)
406}
407
408
409static PrototypeClass: JSClass = JSClass {
410 name: c"HTMLTableColElementPrototype".as_ptr(),
411 flags:
412 (0 ) << JSCLASS_RESERVED_SLOTS_SHIFT,
414 cOps: ptr::null(),
415 spec: ptr::null(),
416 ext: ptr::null(),
417 oOps: ptr::null(),
418};
419
420unsafe extern "C" fn _constructor<D: DomTypes>
421(cx: *mut RawJSContext, argc: u32, vp: *mut JSVal) -> bool{
422 let mut result = false;
423 wrap_panic(&mut || result = {
424 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
425 let args = CallArgs::from_vp(vp, argc);
426 let global = D::GlobalScope::from_object(JS_CALLEE(cx.raw_cx(), vp).to_object());
427
428 <D as DomHelpers<D>>::call_html_constructor::<D::HTMLTableColElement>(
429 SafeJSContext::from_ptr(cx.raw_cx()),
430 &args,
431 &global,
432 PrototypeList::ID::HTMLTableColElement,
433 CreateInterfaceObjects::<D>,
434 CanGc::note()
435 )
436
437 });
438 result
439}
440
441
442static INTERFACE_OBJECT_CLASS: ThreadUnsafeOnceLock<NonCallbackInterfaceObjectClass> = ThreadUnsafeOnceLock::new();
443
444pub(crate) fn init_interface_object<D: DomTypes>() {
445 INTERFACE_OBJECT_CLASS.set(NonCallbackInterfaceObjectClass::new(
446 Box::leak(Box::new(InterfaceConstructorBehavior::call(_constructor::<D>))),
447 b"function HTMLTableColElement() {\n [native code]\n}",
448 PrototypeList::ID::HTMLTableColElement,
449 4,
450 ));
451}
452
453pub fn GetConstructorObject<D: DomTypes>
454(cx: SafeJSContext, global: HandleObject, mut rval: MutableHandleObject){
455 get_per_interface_object_handle(cx, global, ProtoOrIfaceIndex::Constructor(PrototypeList::Constructor::HTMLTableColElement), CreateInterfaceObjects::<D>, rval)
457}
458
459pub fn DefineDOMInterface<D: DomTypes>
460(cx: SafeJSContext, global: HandleObject){
461 define_dom_interface(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::HTMLTableColElement),CreateInterfaceObjects::<D>, ConstructorEnabled::<D>)
462}
463
464pub fn ConstructorEnabled<D: DomTypes>
465(aCx: SafeJSContext, aObj: HandleObject) -> bool{
466 is_exposed_in(aObj, Globals::WINDOW)
467}
468
469unsafe fn CreateInterfaceObjects<D: DomTypes>
470(cx: SafeJSContext, global: HandleObject, cache: *mut ProtoOrIfaceArray){
471
472 rooted!(&in(cx) let mut prototype_proto = ptr::null_mut::<JSObject>());
473 HTMLElement_Binding::GetProtoObject::<D>(cx, global, prototype_proto.handle_mut());
474 assert!(!prototype_proto.is_null());
475
476 rooted!(&in(cx) let mut prototype = ptr::null_mut::<JSObject>());
477 create_interface_prototype_object::<D>(cx,
478 global,
479 prototype_proto.handle(),
480 &PrototypeClass,
481 &[],
482 sAttributes.get(),
483 &[],
484 &[],
485 prototype.handle_mut());
486 assert!(!prototype.is_null());
487 assert!((*cache)[PrototypeList::ID::HTMLTableColElement as usize].is_null());
488 (*cache)[PrototypeList::ID::HTMLTableColElement as usize] = prototype.get();
489 <*mut JSObject>::post_barrier((*cache).as_mut_ptr().offset(PrototypeList::ID::HTMLTableColElement as isize),
490 ptr::null_mut(),
491 prototype.get());
492
493 rooted!(&in(cx) let mut interface_proto = ptr::null_mut::<JSObject>());
494
495 HTMLElement_Binding::GetConstructorObject::<D>(cx, global, interface_proto.handle_mut());
496
497 assert!(!interface_proto.is_null());
498
499 rooted!(&in(cx) let mut interface = ptr::null_mut::<JSObject>());
500 create_noncallback_interface_object::<D>(cx,
501 global,
502 interface_proto.handle(),
503 INTERFACE_OBJECT_CLASS.get(),
504 &[],
505 &[],
506 &[],
507 prototype.handle(),
508 c"HTMLTableColElement",
509 0,
510 &[],
511 interface.handle_mut());
512 assert!(!interface.is_null());
513
514 assert!((*cache)[PrototypeList::Constructor::HTMLTableColElement as usize].is_null());
515 (*cache)[PrototypeList::Constructor::HTMLTableColElement as usize] = interface.get();
516 <*mut JSObject>::post_barrier((*cache).as_mut_ptr().offset(PrototypeList::Constructor::HTMLTableColElement as isize),
517 ptr::null_mut(),
518 interface.get());
519
520}
521
522
523 pub(crate) fn init_statics<D: DomTypes>() {
524 init_interface_object::<D>();
525 init_domjs_class::<D>();
526
527 init_span_getterinfo::<D>();
528init_width_getterinfo::<D>();
529 init_span_setterinfo::<D>();
530init_width_setterinfo::<D>();
531
532 init_sAttributes_specs::<D>();
533init_sAttributes_prefs::<D>();
534 }
535 }