geckolib: Get nsMargin and nsCoord working

I had to make them opaque types since there were so many template
parameters and inheritance when including gfx that... I got scared.
This commit is contained in:
Emilio Cobos Álvarez 2016-03-23 22:42:59 +01:00
parent 247ac2542a
commit ef59da51d5
2 changed files with 75 additions and 3 deletions

View file

@ -3,6 +3,8 @@
pub use root::*; pub use root::*;
pub mod root { pub mod root {
pub const MOZ_STRING_WITH_OBSOLETE_API: ::std::os::raw::c_uint = 1; pub const MOZ_STRING_WITH_OBSOLETE_API: ::std::os::raw::c_uint = 1;
pub const TWIPS_PER_POINT_INT: ::std::os::raw::c_uint = 20;
pub const POINTS_PER_INCH_INT: ::std::os::raw::c_uint = 72;
/** /**
* typedefs for backwards compatibility * typedefs for backwards compatibility
*/ */
@ -316,4 +318,60 @@ pub mod root {
160usize); 160usize);
} }
pub type nsVoidableString = nsAutoString; pub type nsVoidableString = nsAutoString;
pub type nscolor = u32;
pub type nscoord = i32;
#[repr(C)]
#[derive(Copy, Clone, Debug)]
struct nsIntPoint {
_bindgen_opaque_blob: [u8; 8usize],
}
#[test]
fn bindgen_test_layout_nsIntPoint() {
assert_eq!(:: std:: mem:: size_of:: < nsIntPoint > ( ) , 8usize);
}
#[repr(C)]
#[derive(Copy, Clone, Debug)]
struct nsPoint {
_bindgen_opaque_blob: [u8; 8usize],
}
#[test]
fn bindgen_test_layout_nsPoint() {
assert_eq!(:: std:: mem:: size_of:: < nsPoint > ( ) , 8usize);
}
#[repr(C)]
#[derive(Copy, Clone, Debug)]
struct nsMargin {
_bindgen_opaque_blob: [u8; 16usize],
}
#[test]
fn bindgen_test_layout_nsMargin() {
assert_eq!(:: std:: mem:: size_of:: < nsMargin > ( ) , 16usize);
}
#[repr(C)]
#[derive(Copy, Clone, Debug)]
struct nsIntMargin {
_bindgen_opaque_blob: [u8; 16usize],
}
#[test]
fn bindgen_test_layout_nsIntMargin() {
assert_eq!(:: std:: mem:: size_of:: < nsIntMargin > ( ) , 16usize);
}
/**
* This structure precedes the string buffers "we" allocate. It may be the
* case that nsTAString::mData does not point to one of these special
* buffers. The mFlags member variable distinguishes the buffer type.
*
* When this header is in use, it enables reference counting, and capacity
* tracking. NOTE: A string buffer can be modified only if its reference
* count is 1.
*/
#[repr(C)]
pub struct nsStringBuffer {
pub mRefCount: [u8; 4usize],
pub mStorageSize: u32,
}
#[test]
fn bindgen_test_layout_nsStringBuffer() {
assert_eq!(:: std:: mem:: size_of:: < nsStringBuffer > ( ) , 8usize);
}
} }

View file

@ -52,10 +52,12 @@ fi
# /Applications/Xcode.app/Contents/Developer/usr/bin/lldb -- # /Applications/Xcode.app/Contents/Developer/usr/bin/lldb --
# gdb -ex "break rust_panic" -ex run --args \ # gdb -ex "break rust_panic" -ex run --args \
./rust-bindgen/target/debug/bindgen \ ./rust-bindgen/target/debug/bindgen \
-o ../gecko_style_structs.rs \
-x c++ -std=gnu++0x \ -x c++ -std=gnu++0x \
-allow-unknown-types \ -allow-unknown-types \
$CLANG_SEARCH_DIRS \ $CLANG_SEARCH_DIRS \
"-I$DIST_INCLUDE" "-I$DIST_INCLUDE/nspr" \ "-I$DIST_INCLUDE" "-I$DIST_INCLUDE/nspr" \
"-I$1/../nsprpub/pr/include" \
$PLATFORM_DEPENDENT_DEFINES \ $PLATFORM_DEPENDENT_DEFINES \
-ignore-functions \ -ignore-functions \
-enable-cxx-namespaces \ -enable-cxx-namespaces \
@ -69,10 +71,22 @@ fi
-match "nsSubstring" \ -match "nsSubstring" \
-match "nsTSubstring" \ -match "nsTSubstring" \
-match "nsTString" \ -match "nsTString" \
-match "nsColor.h" \
-match "nsCoord.h" \
-match "nsPoint.h" \
-match "nsMargin.h" \
-opaque-type "nsIntMargin" \
-opaque-type "nsMargin" \
-opaque-type "nsIntPoint" \
-opaque-type "nsPoint" \
-include "$1/mozilla-config.h" \ -include "$1/mozilla-config.h" \
-o ../gecko_style_structs.rs \ "$DIST_INCLUDE/nsStyleStruct.h"
"$DIST_INCLUDE/nsString.h"
yes \ yes \
-match "nsMargin.h" \
-match "Rect.h" \
-match "Point.h" \
-match "BaseMargin.h" \
-match "nsMargin.h" \
-match "nsStyleStruct" \ -match "nsStyleStruct" \
-match "stdint" \ -match "stdint" \
-match "nsColor" \ -match "nsColor" \
@ -84,4 +98,4 @@ yes \
-match "nsTArray" \ -match "nsTArray" \
-match "nsString" \ -match "nsString" \
-match "imgIRequest" \ -match "imgIRequest" \
# "$DIST_INCLUDE/nsStyleStruct.h" "$DIST_INCLUDE/nsString.h"