diff --git a/ports/geckolib/binding_tools/regen.py b/ports/geckolib/binding_tools/regen.py index ba041fc9200..49b2557b91b 100755 --- a/ports/geckolib/binding_tools/regen.py +++ b/ports/geckolib/binding_tools/regen.py @@ -106,8 +106,6 @@ COMPILATION_TARGETS = { "Maybe", # <- AlignedStorage, which means templated union, which # means impossible to represent in stable rust as of # right now. - # Union handling falls over for templated types. - "StyleShapeSource", "StyleClipPath", "StyleShapeOutside", ], }, # Generation of the ffi bindings. diff --git a/ports/geckolib/gecko_bindings/structs_debug.rs b/ports/geckolib/gecko_bindings/structs_debug.rs index f726e9ee3ff..432fc55e86d 100644 --- a/ports/geckolib/gecko_bindings/structs_debug.rs +++ b/ports/geckolib/gecko_bindings/structs_debug.rs @@ -6389,25 +6389,33 @@ fn bindgen_test_layout_StyleBasicShape() { assert_eq!(::std::mem::align_of::() , 8usize); } #[repr(C)] -pub struct StyleShapeSource; -#[repr(C)] -pub struct StyleClipPath { - pub _bindgen_opaque_blob: [u64; 2usize], -} -#[test] -fn bindgen_test_layout_StyleClipPath() { - assert_eq!(::std::mem::size_of::() , 16usize); - assert_eq!(::std::mem::align_of::() , 8usize); +#[derive(Debug)] +pub struct StyleShapeSource { + pub StyleShapeSource_nsStyleStruct_h_unnamed_26: StyleShapeSource_nsStyleStruct_h_unnamed_26, + pub mType: StyleShapeSourceType, + pub mReferenceBox: ReferenceBox, } #[repr(C)] -pub struct StyleShapeOutside { - pub _bindgen_opaque_blob: [u64; 2usize], +#[derive(Debug, Copy, Clone)] +pub struct StyleShapeSource_nsStyleStruct_h_unnamed_26 { + pub mBasicShape: __BindgenUnionField<*mut StyleBasicShape>, + pub mURL: __BindgenUnionField<*mut FragmentOrURL>, + pub _bindgen_data_: u64, + pub _phantom0: ::std::marker::PhantomData, } -#[test] -fn bindgen_test_layout_StyleShapeOutside() { - assert_eq!(::std::mem::size_of::() , 16usize); - assert_eq!(::std::mem::align_of::() , 8usize); +impl StyleShapeSource_nsStyleStruct_h_unnamed_26 + { + pub unsafe fn mBasicShape(&mut self) -> *mut *mut StyleBasicShape { + let raw: *mut u8 = ::std::mem::transmute(&self._bindgen_data_); + ::std::mem::transmute(raw.offset(0)) + } + pub unsafe fn mURL(&mut self) -> *mut *mut FragmentOrURL { + let raw: *mut u8 = ::std::mem::transmute(&self._bindgen_data_); + ::std::mem::transmute(raw.offset(0)) + } } +pub type StyleClipPath = StyleShapeSource; +pub type StyleShapeOutside = StyleShapeSource; #[repr(C)] pub struct nsStyleDisplay { pub mBinding: RefPtr, @@ -6461,7 +6469,7 @@ pub struct nsStyleDisplay { pub mAnimationFillModeCount: u32, pub mAnimationPlayStateCount: u32, pub mAnimationIterationCountCount: u32, - pub mShapeOutside: [u64; 2usize], + pub mShapeOutside: StyleShapeOutside, } #[test] fn bindgen_test_layout_nsStyleDisplay() { @@ -6794,7 +6802,7 @@ fn bindgen_test_layout_nsStyleFilter() { #[repr(C)] pub struct nsStyleSVGReset { pub mMask: nsStyleImageLayers, - pub mClipPath: [u64; 2usize], + pub mClipPath: StyleClipPath, pub mStopColor: nscolor, pub mFloodColor: nscolor, pub mLightingColor: nscolor, diff --git a/ports/geckolib/gecko_bindings/structs_release.rs b/ports/geckolib/gecko_bindings/structs_release.rs index 3f4a833acd7..30ae855567d 100644 --- a/ports/geckolib/gecko_bindings/structs_release.rs +++ b/ports/geckolib/gecko_bindings/structs_release.rs @@ -6367,25 +6367,33 @@ fn bindgen_test_layout_StyleBasicShape() { assert_eq!(::std::mem::align_of::() , 8usize); } #[repr(C)] -pub struct StyleShapeSource; -#[repr(C)] -pub struct StyleClipPath { - pub _bindgen_opaque_blob: [u64; 2usize], -} -#[test] -fn bindgen_test_layout_StyleClipPath() { - assert_eq!(::std::mem::size_of::() , 16usize); - assert_eq!(::std::mem::align_of::() , 8usize); +#[derive(Debug)] +pub struct StyleShapeSource { + pub StyleShapeSource_nsStyleStruct_h_unnamed_26: StyleShapeSource_nsStyleStruct_h_unnamed_26, + pub mType: StyleShapeSourceType, + pub mReferenceBox: ReferenceBox, } #[repr(C)] -pub struct StyleShapeOutside { - pub _bindgen_opaque_blob: [u64; 2usize], +#[derive(Debug, Copy, Clone)] +pub struct StyleShapeSource_nsStyleStruct_h_unnamed_26 { + pub mBasicShape: __BindgenUnionField<*mut StyleBasicShape>, + pub mURL: __BindgenUnionField<*mut FragmentOrURL>, + pub _bindgen_data_: u64, + pub _phantom0: ::std::marker::PhantomData, } -#[test] -fn bindgen_test_layout_StyleShapeOutside() { - assert_eq!(::std::mem::size_of::() , 16usize); - assert_eq!(::std::mem::align_of::() , 8usize); +impl StyleShapeSource_nsStyleStruct_h_unnamed_26 + { + pub unsafe fn mBasicShape(&mut self) -> *mut *mut StyleBasicShape { + let raw: *mut u8 = ::std::mem::transmute(&self._bindgen_data_); + ::std::mem::transmute(raw.offset(0)) + } + pub unsafe fn mURL(&mut self) -> *mut *mut FragmentOrURL { + let raw: *mut u8 = ::std::mem::transmute(&self._bindgen_data_); + ::std::mem::transmute(raw.offset(0)) + } } +pub type StyleClipPath = StyleShapeSource; +pub type StyleShapeOutside = StyleShapeSource; #[repr(C)] pub struct nsStyleDisplay { pub mBinding: RefPtr, @@ -6439,7 +6447,7 @@ pub struct nsStyleDisplay { pub mAnimationFillModeCount: u32, pub mAnimationPlayStateCount: u32, pub mAnimationIterationCountCount: u32, - pub mShapeOutside: [u64; 2usize], + pub mShapeOutside: StyleShapeOutside, } #[test] fn bindgen_test_layout_nsStyleDisplay() { @@ -6771,7 +6779,7 @@ fn bindgen_test_layout_nsStyleFilter() { #[repr(C)] pub struct nsStyleSVGReset { pub mMask: nsStyleImageLayers, - pub mClipPath: [u64; 2usize], + pub mClipPath: StyleClipPath, pub mStopColor: nscolor, pub mFloodColor: nscolor, pub mLightingColor: nscolor,