diff options
author | bors-servo <lbergstrom+bors@mozilla.com> | 2016-07-06 00:12:58 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-07-06 00:12:58 -0700 |
commit | e78459e6670b218970dfebb189a0c8ef7614951f (patch) | |
tree | aa04772f96f6451e6fe91024da015cb1fd26d0e5 | |
parent | 0d76cf8e5c5feef3bd9c5a8c1e1e653467f6fac4 (diff) | |
parent | 28a5bb7d63500b28182765e74ab5327e02ac222b (diff) | |
download | servo-e78459e6670b218970dfebb189a0c8ef7614951f.tar.gz servo-e78459e6670b218970dfebb189a0c8ef7614951f.zip |
Auto merge of #12212 - emilio:stylo-regen-script, r=bholley
stylo: Move all binding-generator logic code to a python script.
<!-- Please describe your changes on the following line: -->
---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
<!-- Either: -->
- [x] These changes do not require tests because tooling
<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
---
This not only makes us more consistent with the rest of the codebase but also:
* Makes us repeat less code like common flags and all that stuff.
* Reduces the noise of the build: You only get the output of the commands on
failure or when you pass the -v flag.
* Makes you able to select a single kind of build or multiple in the same
place.
I've basically kept the regen.sh script because of the LIBCLANG_PATH checks, but
at least from Linux I don't need them anymore. Also, that logic could be moved
to the new script.
The whole point of this isn't only making it prettier and easier to use, but
also allowing me to write more complex logic in the binding generator scripts,
that I will probably need to integrate the DOM enum types we need for animations
and such easily (can't be just an include, because that pulls in another header
with the same name bringing a lot of DOM and IDL churn).
For reference, here's a successful regen round with the script:
```
./regen.py --target all /home/emilio/projects/moz/stylo/gecko/obj-x86_64-pc-linux-gnu/
[BINDGEN] structs::release in "/home/emilio/projects/moz/stylo/gecko/obj-x86_64-pc-linux-gnu/"... OK
[RUSTC]... OK
[RUSTC_TEST]... OK
test result: ok. 168 passed; 0 failed; 0 ignored; 0 measured
[BINDGEN] structs::debug in "/home/emilio/projects/moz/stylo/gecko/obj-x86_64-pc-linux-gnu/"... OK
[RUSTC]... OK
[RUSTC_TEST]... OK
test result: ok. 169 passed; 0 failed; 0 ignored; 0 measured
[BINDGEN] bindings::None in "/home/emilio/projects/moz/stylo/gecko/obj-x86_64-pc-linux-gnu/"... OK
```
---
r? @bholley
Maybe @jgraham and/or @Wafflespeanut want to take a look to criticize my (lack of) pythonism ;-)
<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/12212)
<!-- Reviewable:end -->
-rw-r--r-- | ports/geckolib/gecko_bindings/bindings.rs | 72 | ||||
-rw-r--r-- | ports/geckolib/gecko_bindings/structs_debug.rs | 1203 | ||||
-rw-r--r-- | ports/geckolib/gecko_bindings/structs_release.rs | 1203 | ||||
-rwxr-xr-x | ports/geckolib/gecko_bindings/tools/regen.py | 385 | ||||
-rwxr-xr-x | ports/geckolib/gecko_bindings/tools/regen.sh | 26 | ||||
-rwxr-xr-x | ports/geckolib/gecko_bindings/tools/regen_bindings.sh | 94 | ||||
-rwxr-xr-x | ports/geckolib/gecko_bindings/tools/regen_style_structs.sh | 148 | ||||
-rw-r--r-- | python/tidy/servo_tidy/tidy.py | 2 |
8 files changed, 1579 insertions, 1554 deletions
diff --git a/ports/geckolib/gecko_bindings/bindings.rs b/ports/geckolib/gecko_bindings/bindings.rs index 5014e701cf4..50ef0775bf8 100644 --- a/ports/geckolib/gecko_bindings/bindings.rs +++ b/ports/geckolib/gecko_bindings/bindings.rs @@ -1,126 +1,126 @@ /* automatically generated by rust-bindgen */ -use structs::nsStyleFont; -use structs::nsStyleColor; -use structs::nsStyleList; -use structs::nsStyleText; -use structs::nsStyleVisibility; -use structs::nsStyleUserInterface; -use structs::nsStyleTableBorder; -use structs::nsStyleSVG; -use structs::nsStyleVariables; -use structs::nsStyleBackground; -use structs::nsStylePosition; -use structs::nsStyleTextReset; -use structs::nsStyleDisplay; -use structs::nsStyleContent; -use structs::nsStyleUIReset; -use structs::nsStyleTable; -use structs::nsStyleMargin; -use structs::nsStylePadding; -use structs::nsStyleBorder; -use structs::nsStyleOutline; -use structs::nsStyleXUL; -use structs::nsStyleSVGReset; -use structs::nsStyleColumn; -use structs::nsStyleEffects; -use structs::nsStyleImage; -use structs::nsStyleGradient; -use structs::nsStyleCoord; -use structs::nsStyleGradientStop; -use structs::SheetParsingMode; -use structs::nsMainThreadPtrHandle; -use structs::nsMainThreadPtrHolder; -use structs::nscolor; -use structs::nsFont; -use structs::FontFamilyList; -use structs::FontFamilyType; -use structs::nsIAtom; use heapsize::HeapSizeOf; +use structs::nsStyleFont; unsafe impl Send for nsStyleFont {} unsafe impl Sync for nsStyleFont {} impl HeapSizeOf for nsStyleFont { fn heap_size_of_children(&self) -> usize { 0 } } +use structs::nsStyleColor; unsafe impl Send for nsStyleColor {} unsafe impl Sync for nsStyleColor {} impl HeapSizeOf for nsStyleColor { fn heap_size_of_children(&self) -> usize { 0 } } +use structs::nsStyleList; unsafe impl Send for nsStyleList {} unsafe impl Sync for nsStyleList {} impl HeapSizeOf for nsStyleList { fn heap_size_of_children(&self) -> usize { 0 } } +use structs::nsStyleText; unsafe impl Send for nsStyleText {} unsafe impl Sync for nsStyleText {} impl HeapSizeOf for nsStyleText { fn heap_size_of_children(&self) -> usize { 0 } } +use structs::nsStyleVisibility; unsafe impl Send for nsStyleVisibility {} unsafe impl Sync for nsStyleVisibility {} impl HeapSizeOf for nsStyleVisibility { fn heap_size_of_children(&self) -> usize { 0 } } +use structs::nsStyleUserInterface; unsafe impl Send for nsStyleUserInterface {} unsafe impl Sync for nsStyleUserInterface {} impl HeapSizeOf for nsStyleUserInterface { fn heap_size_of_children(&self) -> usize { 0 } } +use structs::nsStyleTableBorder; unsafe impl Send for nsStyleTableBorder {} unsafe impl Sync for nsStyleTableBorder {} impl HeapSizeOf for nsStyleTableBorder { fn heap_size_of_children(&self) -> usize { 0 } } +use structs::nsStyleSVG; unsafe impl Send for nsStyleSVG {} unsafe impl Sync for nsStyleSVG {} impl HeapSizeOf for nsStyleSVG { fn heap_size_of_children(&self) -> usize { 0 } } +use structs::nsStyleVariables; unsafe impl Send for nsStyleVariables {} unsafe impl Sync for nsStyleVariables {} impl HeapSizeOf for nsStyleVariables { fn heap_size_of_children(&self) -> usize { 0 } } +use structs::nsStyleBackground; unsafe impl Send for nsStyleBackground {} unsafe impl Sync for nsStyleBackground {} impl HeapSizeOf for nsStyleBackground { fn heap_size_of_children(&self) -> usize { 0 } } +use structs::nsStylePosition; unsafe impl Send for nsStylePosition {} unsafe impl Sync for nsStylePosition {} impl HeapSizeOf for nsStylePosition { fn heap_size_of_children(&self) -> usize { 0 } } +use structs::nsStyleTextReset; unsafe impl Send for nsStyleTextReset {} unsafe impl Sync for nsStyleTextReset {} impl HeapSizeOf for nsStyleTextReset { fn heap_size_of_children(&self) -> usize { 0 } } +use structs::nsStyleDisplay; unsafe impl Send for nsStyleDisplay {} unsafe impl Sync for nsStyleDisplay {} impl HeapSizeOf for nsStyleDisplay { fn heap_size_of_children(&self) -> usize { 0 } } +use structs::nsStyleContent; unsafe impl Send for nsStyleContent {} unsafe impl Sync for nsStyleContent {} impl HeapSizeOf for nsStyleContent { fn heap_size_of_children(&self) -> usize { 0 } } +use structs::nsStyleUIReset; unsafe impl Send for nsStyleUIReset {} unsafe impl Sync for nsStyleUIReset {} impl HeapSizeOf for nsStyleUIReset { fn heap_size_of_children(&self) -> usize { 0 } } +use structs::nsStyleTable; unsafe impl Send for nsStyleTable {} unsafe impl Sync for nsStyleTable {} impl HeapSizeOf for nsStyleTable { fn heap_size_of_children(&self) -> usize { 0 } } +use structs::nsStyleMargin; unsafe impl Send for nsStyleMargin {} unsafe impl Sync for nsStyleMargin {} impl HeapSizeOf for nsStyleMargin { fn heap_size_of_children(&self) -> usize { 0 } } +use structs::nsStylePadding; unsafe impl Send for nsStylePadding {} unsafe impl Sync for nsStylePadding {} impl HeapSizeOf for nsStylePadding { fn heap_size_of_children(&self) -> usize { 0 } } +use structs::nsStyleBorder; unsafe impl Send for nsStyleBorder {} unsafe impl Sync for nsStyleBorder {} impl HeapSizeOf for nsStyleBorder { fn heap_size_of_children(&self) -> usize { 0 } } +use structs::nsStyleOutline; unsafe impl Send for nsStyleOutline {} unsafe impl Sync for nsStyleOutline {} impl HeapSizeOf for nsStyleOutline { fn heap_size_of_children(&self) -> usize { 0 } } +use structs::nsStyleXUL; unsafe impl Send for nsStyleXUL {} unsafe impl Sync for nsStyleXUL {} impl HeapSizeOf for nsStyleXUL { fn heap_size_of_children(&self) -> usize { 0 } } +use structs::nsStyleSVGReset; unsafe impl Send for nsStyleSVGReset {} unsafe impl Sync for nsStyleSVGReset {} impl HeapSizeOf for nsStyleSVGReset { fn heap_size_of_children(&self) -> usize { 0 } } +use structs::nsStyleColumn; unsafe impl Send for nsStyleColumn {} unsafe impl Sync for nsStyleColumn {} impl HeapSizeOf for nsStyleColumn { fn heap_size_of_children(&self) -> usize { 0 } } +use structs::nsStyleEffects; unsafe impl Send for nsStyleEffects {} unsafe impl Sync for nsStyleEffects {} impl HeapSizeOf for nsStyleEffects { fn heap_size_of_children(&self) -> usize { 0 } } +use structs::nsStyleImage; unsafe impl Send for nsStyleImage {} unsafe impl Sync for nsStyleImage {} impl HeapSizeOf for nsStyleImage { fn heap_size_of_children(&self) -> usize { 0 } } +use structs::nsStyleGradient; unsafe impl Send for nsStyleGradient {} unsafe impl Sync for nsStyleGradient {} impl HeapSizeOf for nsStyleGradient { fn heap_size_of_children(&self) -> usize { 0 } } +use structs::nsStyleCoord; unsafe impl Send for nsStyleCoord {} unsafe impl Sync for nsStyleCoord {} impl HeapSizeOf for nsStyleCoord { fn heap_size_of_children(&self) -> usize { 0 } } +use structs::nsStyleGradientStop; unsafe impl Send for nsStyleGradientStop {} unsafe impl Sync for nsStyleGradientStop {} impl HeapSizeOf for nsStyleGradientStop { fn heap_size_of_children(&self) -> usize { 0 } } +use structs::SheetParsingMode; +use structs::nsMainThreadPtrHandle; +use structs::nsMainThreadPtrHolder; +use structs::nscolor; +use structs::nsFont; +use structs::FontFamilyList; +use structs::FontFamilyType; +use structs::nsIAtom; pub enum nsINode { } pub type RawGeckoNode = nsINode; diff --git a/ports/geckolib/gecko_bindings/structs_debug.rs b/ports/geckolib/gecko_bindings/structs_debug.rs index b08a42d5084..30e1e2d65f9 100644 --- a/ports/geckolib/gecko_bindings/structs_debug.rs +++ b/ports/geckolib/gecko_bindings/structs_debug.rs @@ -1879,168 +1879,6 @@ fn bindgen_test_layout_NS_ConvertUTF8toUTF16() { assert_eq!(::std::mem::align_of::<NS_ConvertUTF8toUTF16>() , 8usize); } pub type nsVoidableString = nsAutoString; -pub enum ErrorReporter { } -#[repr(u32)] -#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)] -pub enum nsCSSTokenType { - eCSSToken_Whitespace = 0, - eCSSToken_Comment = 1, - eCSSToken_Ident = 2, - eCSSToken_Function = 3, - eCSSToken_AtKeyword = 4, - eCSSToken_ID = 5, - eCSSToken_Hash = 6, - eCSSToken_Number = 7, - eCSSToken_Dimension = 8, - eCSSToken_Percentage = 9, - eCSSToken_String = 10, - eCSSToken_Bad_String = 11, - eCSSToken_URL = 12, - eCSSToken_Bad_URL = 13, - eCSSToken_Symbol = 14, - eCSSToken_Includes = 15, - eCSSToken_Dashmatch = 16, - eCSSToken_Beginsmatch = 17, - eCSSToken_Endsmatch = 18, - eCSSToken_Containsmatch = 19, - eCSSToken_URange = 20, - eCSSToken_HTMLComment = 21, -} -#[repr(u32)] -#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)] -pub enum nsCSSTokenSerializationType { - eCSSTokenSerialization_Nothing = 0, - eCSSTokenSerialization_Whitespace = 1, - eCSSTokenSerialization_AtKeyword_or_Hash = 2, - eCSSTokenSerialization_Number = 3, - eCSSTokenSerialization_Dimension = 4, - eCSSTokenSerialization_Percentage = 5, - eCSSTokenSerialization_URange = 6, - eCSSTokenSerialization_URL_or_BadURL = 7, - eCSSTokenSerialization_Function = 8, - eCSSTokenSerialization_Ident = 9, - eCSSTokenSerialization_CDC = 10, - eCSSTokenSerialization_DashMatch = 11, - eCSSTokenSerialization_ContainsMatch = 12, - eCSSTokenSerialization_Symbol_Hash = 13, - eCSSTokenSerialization_Symbol_At = 14, - eCSSTokenSerialization_Symbol_Dot_or_Plus = 15, - eCSSTokenSerialization_Symbol_Minus = 16, - eCSSTokenSerialization_Symbol_OpenParen = 17, - eCSSTokenSerialization_Symbol_Question = 18, - eCSSTokenSerialization_Symbol_Assorted = 19, - eCSSTokenSerialization_Symbol_Equals = 20, - eCSSTokenSerialization_Symbol_Bar = 21, - eCSSTokenSerialization_Symbol_Slash = 22, - eCSSTokenSerialization_Symbol_Asterisk = 23, - eCSSTokenSerialization_Other = 24, -} -#[repr(C)] -pub struct nsCSSToken { - pub mIdent: nsAutoString, - pub mNumber: f32, - pub mInteger: i32, - pub mInteger2: i32, - pub mType: nsCSSTokenType, - pub mSymbol: ::std::os::raw::c_ushort, - pub mIntegerValid: bool, - pub mHasSign: bool, -} -#[test] -fn bindgen_test_layout_nsCSSToken() { - assert_eq!(::std::mem::size_of::<nsCSSToken>() , 184usize); - assert_eq!(::std::mem::align_of::<nsCSSToken>() , 8usize); -} -#[repr(C)] -#[derive(Debug, Copy)] -pub struct nsCSSScannerPosition { - pub mOffset: u32, - pub mLineNumber: u32, - pub mLineOffset: u32, - pub mTokenLineNumber: u32, - pub mTokenLineOffset: u32, - pub mTokenOffset: u32, - pub mInitialized: bool, -} -impl ::std::clone::Clone for nsCSSScannerPosition { - fn clone(&self) -> Self { *self } -} -#[test] -fn bindgen_test_layout_nsCSSScannerPosition() { - assert_eq!(::std::mem::size_of::<nsCSSScannerPosition>() , 28usize); - assert_eq!(::std::mem::align_of::<nsCSSScannerPosition>() , 4usize); -} -#[repr(u32)] -#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)] -pub enum nsCSSScannerExclude { - eCSSScannerExclude_None = 0, - eCSSScannerExclude_Comments = 1, - eCSSScannerExclude_WhitespaceAndComments = 2, -} -#[repr(C)] -#[derive(Debug)] -pub struct nsCSSScanner { - pub mBuffer: *const ::std::os::raw::c_ushort, - pub mOffset: u32, - pub mCount: u32, - pub mLineNumber: u32, - pub mLineOffset: u32, - pub mTokenLineNumber: u32, - pub mTokenLineOffset: u32, - pub mTokenOffset: u32, - pub mRecordStartOffset: u32, - pub mEOFCharacters: nsCSSScanner_EOFCharacters, - pub mReporter: *mut ErrorReporter, - pub mSVGMode: bool, - pub mRecording: bool, - pub mSeenBadToken: bool, - pub mSeenVariableReference: bool, -} -#[repr(u32)] -#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)] -pub enum nsCSSScanner_EOFCharacters { - eEOFCharacters_None = 0, - eEOFCharacters_DropBackslash = 1, - eEOFCharacters_ReplacementChar = 2, - eEOFCharacters_Asterisk = 4, - eEOFCharacters_Slash = 8, - eEOFCharacters_DoubleQuote = 16, - eEOFCharacters_SingleQuote = 32, - eEOFCharacters_CloseParen = 64, -} -#[test] -fn bindgen_test_layout_nsCSSScanner() { - assert_eq!(::std::mem::size_of::<nsCSSScanner>() , 64usize); - assert_eq!(::std::mem::align_of::<nsCSSScanner>() , 8usize); -} -#[repr(C)] -pub struct nsCSSGridTemplateAreaToken { - pub mName: nsAutoString, - pub isTrash: bool, -} -#[test] -fn bindgen_test_layout_nsCSSGridTemplateAreaToken() { - assert_eq!(::std::mem::size_of::<nsCSSGridTemplateAreaToken>() , - 168usize); - assert_eq!(::std::mem::align_of::<nsCSSGridTemplateAreaToken>() , 8usize); -} -#[repr(C)] -#[derive(Debug, Copy)] -pub struct nsCSSGridTemplateAreaScanner { - pub mBuffer: *const ::std::os::raw::c_ushort, - pub mOffset: u32, - pub mCount: u32, -} -impl ::std::clone::Clone for nsCSSGridTemplateAreaScanner { - fn clone(&self) -> Self { *self } -} -#[test] -fn bindgen_test_layout_nsCSSGridTemplateAreaScanner() { - assert_eq!(::std::mem::size_of::<nsCSSGridTemplateAreaScanner>() , - 16usize); - assert_eq!(::std::mem::align_of::<nsCSSGridTemplateAreaScanner>() , - 8usize); -} /** * A "unique identifier". This is modeled after OSF DCE UUIDs. */ @@ -2225,6 +2063,151 @@ pub struct RefPtr_ConstRemovingRefPtrTraits<T, U> { pub struct RefPtrGetterAddRefs<T> { pub mTargetSmartPtr: *mut RefPtr<T>, } +pub enum TileClient { } +#[repr(C)] +#[derive(Debug, Copy)] +pub struct nsTArrayFallibleResult { + pub mResult: bool, +} +impl ::std::clone::Clone for nsTArrayFallibleResult { + fn clone(&self) -> Self { *self } +} +#[test] +fn bindgen_test_layout_nsTArrayFallibleResult() { + assert_eq!(::std::mem::size_of::<nsTArrayFallibleResult>() , 1usize); + assert_eq!(::std::mem::align_of::<nsTArrayFallibleResult>() , 1usize); +} +#[repr(C)] +#[derive(Debug, Copy)] +pub struct nsTArrayInfallibleResult; +impl ::std::clone::Clone for nsTArrayInfallibleResult { + fn clone(&self) -> Self { *self } +} +#[repr(C)] +#[derive(Debug, Copy)] +pub struct nsTArrayFallibleAllocatorBase; +impl ::std::clone::Clone for nsTArrayFallibleAllocatorBase { + fn clone(&self) -> Self { *self } +} +#[repr(C)] +#[derive(Debug, Copy)] +pub struct nsTArrayInfallibleAllocatorBase; +impl ::std::clone::Clone for nsTArrayInfallibleAllocatorBase { + fn clone(&self) -> Self { *self } +} +#[repr(C)] +#[derive(Debug, Copy)] +pub struct nsTArrayFallibleAllocator { + pub _base: nsTArrayFallibleAllocatorBase, +} +impl ::std::clone::Clone for nsTArrayFallibleAllocator { + fn clone(&self) -> Self { *self } +} +#[repr(C)] +#[derive(Debug, Copy)] +pub struct nsTArrayInfallibleAllocator { + pub _base: nsTArrayInfallibleAllocatorBase, +} +impl ::std::clone::Clone for nsTArrayInfallibleAllocator { + fn clone(&self) -> Self { *self } +} +#[repr(C)] +#[derive(Debug, Copy)] +pub struct nsTArrayHeader { + pub mLength: u32, + pub _bitfield_1: u32, +} +impl ::std::clone::Clone for nsTArrayHeader { + fn clone(&self) -> Self { *self } +} +#[test] +fn bindgen_test_layout_nsTArrayHeader() { + assert_eq!(::std::mem::size_of::<nsTArrayHeader>() , 8usize); + assert_eq!(::std::mem::align_of::<nsTArrayHeader>() , 4usize); +} +extern "C" { + #[link_name = "_ZN14nsTArrayHeader9sEmptyHdrE"] + pub static mut nsTArrayHeader_consts_sEmptyHdr: nsTArrayHeader; +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct nsTArray_SafeElementAtHelper<E, Derived> { + pub _phantom0: ::std::marker::PhantomData<E>, + pub _phantom1: ::std::marker::PhantomData<Derived>, +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct nsTArray_SafeElementAtSmartPtrHelper<E, Derived> { + pub _phantom0: ::std::marker::PhantomData<E>, + pub _phantom1: ::std::marker::PhantomData<Derived>, +} +#[repr(C)] +#[derive(Debug)] +pub struct nsTArray_base<Alloc, Copy> { + pub mHdr: *mut nsTArrayHeader, + pub _phantom0: ::std::marker::PhantomData<Alloc>, + pub _phantom1: ::std::marker::PhantomData<Copy>, +} +#[repr(C)] +#[derive(Debug)] +pub struct nsTArray_base_IsAutoArrayRestorer<Alloc, Copy> { + pub mArray: *mut nsTArray_base<Alloc, Copy>, + pub mElemAlign: usize, + pub mIsAuto: bool, + pub _phantom0: ::std::marker::PhantomData<Copy>, +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct nsDefaultComparator<A, B> { + pub _phantom0: ::std::marker::PhantomData<A>, + pub _phantom1: ::std::marker::PhantomData<B>, +} +#[repr(C)] +#[derive(Debug, Copy)] +pub struct nsTArray_CopyWithMemutils; +impl ::std::clone::Clone for nsTArray_CopyWithMemutils { + fn clone(&self) -> Self { *self } +} +extern "C" { + #[link_name = "_ZN25nsTArray_CopyWithMemutils12allowReallocE"] + pub static nsTArray_CopyWithMemutils_consts_allowRealloc: bool; +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct nsTArray_CopyWithConstructors<ElemType> { + pub _phantom0: ::std::marker::PhantomData<ElemType>, +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct nsTArray_CopyChooser<E> { + pub _phantom0: ::std::marker::PhantomData<E>, +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct nsTArray_TypedBase<E, Derived> { + pub _base: nsTArray_SafeElementAtHelper<E, Derived>, + pub _phantom0: ::std::marker::PhantomData<Derived>, +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct ItemComparatorEq<Item, Comparator> { + pub mItem: *const Item, + pub mComp: *const Comparator, +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct ItemComparatorFirstElementGT<Item, Comparator> { + pub mItem: *const Item, + pub mComp: *const Comparator, +} +/** + * <div rustbindgen replaces="nsTArray"></div> + */ +#[repr(C)] +#[derive(Debug)] +pub struct nsTArray<T> { + pub mBuffer: *mut T, +} #[repr(C)] #[derive(Debug, Copy)] pub struct nsCOMPtr_helper; @@ -2381,6 +2364,87 @@ pub struct nsAutoPtr_Proxy<T, R, Args> { pub struct nsAutoPtrGetterTransfers<T> { pub mTargetSmartPtr: *mut nsAutoPtr<T>, } +/** + * 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)] +#[derive(Debug)] +pub struct nsStringBuffer { + pub mRefCount: u32, + pub mStorageSize: u32, +} +#[test] +fn bindgen_test_layout_nsStringBuffer() { + assert_eq!(::std::mem::size_of::<nsStringBuffer>() , 8usize); + assert_eq!(::std::mem::align_of::<nsStringBuffer>() , 4usize); +} +#[repr(C)] +#[derive(Debug, Copy)] +pub struct nsIAtom { + pub _base: nsISupports, + pub _bitfield_1: u32, + pub mHash: u32, + /** + * WARNING! There is an invisible constraint on |mString|: the chars it + * points to must belong to an nsStringBuffer. This is so that the + * nsStringBuffer::FromData() calls above are valid. + */ + pub mString: *mut ::std::os::raw::c_ushort, +} +#[repr(C)] +pub struct _vftable_nsIAtom { + pub _base: _vftable_nsISupports, +} +impl ::std::clone::Clone for nsIAtom { + fn clone(&self) -> Self { *self } +} +#[test] +fn bindgen_test_layout_nsIAtom() { + assert_eq!(::std::mem::size_of::<nsIAtom>() , 24usize); + assert_eq!(::std::mem::align_of::<nsIAtom>() , 8usize); +} +#[repr(C)] +#[derive(Debug)] +pub struct nsAtomString { + pub _base: nsString, +} +#[test] +fn bindgen_test_layout_nsAtomString() { + assert_eq!(::std::mem::size_of::<nsAtomString>() , 16usize); + assert_eq!(::std::mem::align_of::<nsAtomString>() , 8usize); +} +#[repr(C)] +#[derive(Debug)] +pub struct nsAtomCString { + pub _base: nsCString, +} +#[test] +fn bindgen_test_layout_nsAtomCString() { + assert_eq!(::std::mem::size_of::<nsAtomCString>() , 16usize); + assert_eq!(::std::mem::align_of::<nsAtomCString>() , 8usize); +} +#[repr(C)] +pub struct nsDependentAtomString { + pub _base: [u64; 2usize], +} +#[repr(C)] +#[derive(Debug, Copy)] +pub struct piecewise_construct_t; +impl ::std::clone::Clone for piecewise_construct_t { + fn clone(&self) -> Self { *self } +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct pair<_T1, _T2> { + pub first: _T1, + pub second: _T2, +} pub type PLDHashNumber = u32; #[repr(C)] #[derive(Debug, Copy)] @@ -2591,325 +2655,110 @@ pub struct nsTHashtable_Iterator<EntryType> { } #[repr(C)] pub struct nsDataHashtable; -pub enum TileClient { } +pub enum nsIContentSecurityPolicy { } +pub enum nsIDOMDocument { } #[repr(C)] -#[derive(Debug, Copy)] -pub struct nsTArrayFallibleResult { - pub mResult: bool, -} -impl ::std::clone::Clone for nsTArrayFallibleResult { - fn clone(&self) -> Self { *self } +pub struct nsIPrincipal { + pub _bindgen_opaque_blob: u64, } #[test] -fn bindgen_test_layout_nsTArrayFallibleResult() { - assert_eq!(::std::mem::size_of::<nsTArrayFallibleResult>() , 1usize); - assert_eq!(::std::mem::align_of::<nsTArrayFallibleResult>() , 1usize); -} -#[repr(C)] -#[derive(Debug, Copy)] -pub struct nsTArrayInfallibleResult; -impl ::std::clone::Clone for nsTArrayInfallibleResult { - fn clone(&self) -> Self { *self } -} -#[repr(C)] -#[derive(Debug, Copy)] -pub struct nsTArrayFallibleAllocatorBase; -impl ::std::clone::Clone for nsTArrayFallibleAllocatorBase { - fn clone(&self) -> Self { *self } -} -#[repr(C)] -#[derive(Debug, Copy)] -pub struct nsTArrayInfallibleAllocatorBase; -impl ::std::clone::Clone for nsTArrayInfallibleAllocatorBase { - fn clone(&self) -> Self { *self } +fn bindgen_test_layout_nsIPrincipal() { + assert_eq!(::std::mem::size_of::<nsIPrincipal>() , 8usize); + assert_eq!(::std::mem::align_of::<nsIPrincipal>() , 8usize); } #[repr(C)] #[derive(Debug, Copy)] -pub struct nsTArrayFallibleAllocator { - pub _base: nsTArrayFallibleAllocatorBase, -} -impl ::std::clone::Clone for nsTArrayFallibleAllocator { - fn clone(&self) -> Self { *self } +pub struct nsIExpandedPrincipal { + pub _base: nsISupports, } #[repr(C)] -#[derive(Debug, Copy)] -pub struct nsTArrayInfallibleAllocator { - pub _base: nsTArrayInfallibleAllocatorBase, +pub struct _vftable_nsIExpandedPrincipal { + pub _base: _vftable_nsISupports, } -impl ::std::clone::Clone for nsTArrayInfallibleAllocator { +impl ::std::clone::Clone for nsIExpandedPrincipal { fn clone(&self) -> Self { *self } } #[repr(C)] #[derive(Debug, Copy)] -pub struct nsTArrayHeader { - pub mLength: u32, - pub _bitfield_1: u32, -} -impl ::std::clone::Clone for nsTArrayHeader { - fn clone(&self) -> Self { *self } -} -#[test] -fn bindgen_test_layout_nsTArrayHeader() { - assert_eq!(::std::mem::size_of::<nsTArrayHeader>() , 8usize); - assert_eq!(::std::mem::align_of::<nsTArrayHeader>() , 4usize); -} -extern "C" { - #[link_name = "_ZN14nsTArrayHeader9sEmptyHdrE"] - pub static mut nsTArrayHeader_consts_sEmptyHdr: nsTArrayHeader; -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct nsTArray_SafeElementAtHelper<E, Derived> { - pub _phantom0: ::std::marker::PhantomData<E>, - pub _phantom1: ::std::marker::PhantomData<Derived>, -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct nsTArray_SafeElementAtSmartPtrHelper<E, Derived> { - pub _phantom0: ::std::marker::PhantomData<E>, - pub _phantom1: ::std::marker::PhantomData<Derived>, -} -#[repr(C)] -#[derive(Debug)] -pub struct nsTArray_base<Alloc, Copy> { - pub mHdr: *mut nsTArrayHeader, - pub _phantom0: ::std::marker::PhantomData<Alloc>, - pub _phantom1: ::std::marker::PhantomData<Copy>, -} -#[repr(C)] -#[derive(Debug)] -pub struct nsTArray_base_IsAutoArrayRestorer<Alloc, Copy> { - pub mArray: *mut nsTArray_base<Alloc, Copy>, - pub mElemAlign: usize, - pub mIsAuto: bool, - pub _phantom0: ::std::marker::PhantomData<Copy>, +pub struct nsIURI { + pub _base: nsISupports, } #[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct nsDefaultComparator<A, B> { - pub _phantom0: ::std::marker::PhantomData<A>, - pub _phantom1: ::std::marker::PhantomData<B>, +pub struct _vftable_nsIURI { + pub _base: _vftable_nsISupports, } -#[repr(C)] -#[derive(Debug, Copy)] -pub struct nsTArray_CopyWithMemutils; -impl ::std::clone::Clone for nsTArray_CopyWithMemutils { +impl ::std::clone::Clone for nsIURI { fn clone(&self) -> Self { *self } } -extern "C" { - #[link_name = "_ZN25nsTArray_CopyWithMemutils12allowReallocE"] - pub static nsTArray_CopyWithMemutils_consts_allowRealloc: bool; -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct nsTArray_CopyWithConstructors<ElemType> { - pub _phantom0: ::std::marker::PhantomData<ElemType>, -} -extern "C" { - #[link_name = "_ZN29nsTArray_CopyWithConstructors12allowReallocE"] - pub static nsTArray_CopyWithConstructors_consts_allowRealloc: bool; -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct nsTArray_CopyChooser<E> { - pub _phantom0: ::std::marker::PhantomData<E>, -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct nsTArray_TypedBase<E, Derived> { - pub _base: nsTArray_SafeElementAtHelper<E, Derived>, - pub _phantom0: ::std::marker::PhantomData<Derived>, -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct ItemComparatorEq<Item, Comparator> { - pub mItem: *const Item, - pub mComp: *const Comparator, -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct ItemComparatorFirstElementGT<Item, Comparator> { - pub mItem: *const Item, - pub mComp: *const Comparator, -} /** - * <div rustbindgen replaces="nsTArray"></div> - */ -#[repr(C)] -#[derive(Debug)] -pub struct nsTArray<T> { - pub mBuffer: *mut T, -} -pub enum CSSVariableResolver { } -#[repr(C)] -pub struct CSSVariableValues { - pub mVariableIDs: [u64; 6usize], - /** - * Array of variables, indexed by variable ID. - */ - pub mVariables: nsTArray<CSSVariableValues_Variable>, -} -#[repr(C)] -#[derive(Debug)] -pub struct CSSVariableValues_Variable { - pub mVariableName: nsString, - pub mValue: nsString, - pub mFirstToken: nsCSSTokenSerializationType, - pub mLastToken: nsCSSTokenSerializationType, -} -#[test] -fn bindgen_test_layout_CSSVariableValues_Variable() { - assert_eq!(::std::mem::size_of::<CSSVariableValues_Variable>() , 40usize); - assert_eq!(::std::mem::align_of::<CSSVariableValues_Variable>() , 8usize); -} -#[test] -fn bindgen_test_layout_CSSVariableValues() { - assert_eq!(::std::mem::size_of::<CSSVariableValues>() , 56usize); - assert_eq!(::std::mem::align_of::<CSSVariableValues>() , 8usize); -} -#[repr(i8)] -#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)] -pub enum SheetType { - Agent = 0, - User = 1, - PresHint = 2, - SVGAttrAnimation = 3, - Doc = 4, - ScopedDoc = 5, - StyleAttr = 6, - Override = 7, - Animation = 8, - Transition = 9, - Count = 10, - Unknown = -1, -} -/** - * StaticAutoPtr and StaticRefPtr are like nsAutoPtr and nsRefPtr, except they - * are suitable for use as global variables. - * - * In particular, a global instance of Static{Auto,Ref}Ptr doesn't cause the - * compiler to emit a static initializer (in release builds, anyway). - * - * In order to accomplish this, Static{Auto,Ref}Ptr must have a trivial - * constructor and destructor. As a consequence, it cannot initialize its raw - * pointer to 0 on construction, and it cannot delete/release its raw pointer - * upon destruction. - * - * Since the compiler guarantees that all global variables are initialized to - * 0, these trivial constructors are safe. Since we rely on this, the clang - * plugin, run as part of our "static analysis" builds, makes it a compile-time - * error to use Static{Auto,Ref}Ptr as anything except a global variable. - * - * Static{Auto,Ref}Ptr have a limited interface as compared to ns{Auto,Ref}Ptr; - * this is intentional, since their range of acceptable uses is smaller. - */ -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct StaticAutoPtr<T> { - pub mRawPtr: *mut T, -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct StaticRefPtr<T> { - pub mRawPtr: *mut T, -} -pub enum Zero { } -pub enum _cairo_surface { } -pub type cairo_surface_t = _cairo_surface; -pub enum _cairo_user_data_key { } -pub type cairo_user_data_key_t = _cairo_user_data_key; -pub type thebes_destroy_func_t = - ::std::option::Option<unsafe extern "C" fn(data: - *mut ::std::os::raw::c_void)>; -/** - * Currently needs to be 'double' for Cairo compatibility. Could - * become 'float', perhaps, in some configurations. - */ -pub type gfxFloat = f64; -/** - * Priority of a line break opportunity. + * Enum defining the mode in which a sheet is to be parsed. This is + * usually, but not always, the same as the cascade level at which the + * sheet will apply (see nsStyleSet.h). Most of the Loader APIs only + * support loading of author sheets. * - * eNoBreak The line has no break opportunities - * eWordWrapBreak The line has a break opportunity only within a word. With - * overflow-wrap|word-wrap: break-word we will break at this point only if - * there are no other break opportunities in the line. - * eNormalBreak The line has a break opportunity determined by the standard - * line-breaking algorithm. + * Author sheets are the normal case: styles embedded in or linked + * from HTML pages. They are also the most restricted. * - * Future expansion: split eNormalBreak into multiple priorities, e.g. - * punctuation break and whitespace break (bug 389710). - * As and when we implement it, text-wrap: unrestricted will - * mean that priorities are ignored and all line-break - * opportunities are equal. + * User sheets can do anything author sheets can do, and also get + * access to a few CSS extensions that are not yet suitable for + * exposure on the public Web, but are very useful for expressing + * user style overrides, such as @-moz-document rules. * - * @see gfxTextRun::BreakAndMeasureText - * @see nsLineLayout::NotifyOptionalBreakPosition + * Agent sheets have access to all author- and user-sheet features + * plus more extensions that are necessary for internal use but, + * again, not yet suitable for exposure on the public Web. Some of + * these are outright unsafe to expose; in particular, incorrect + * styling of anonymous box pseudo-elements can violate layout + * invariants. */ -#[repr(i32)] -#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)] -pub enum gfxBreakPriority { - eNoBreak = 0, - eWordWrapBreak = 1, - eNormalBreak = 2, -} -#[repr(i32)] -#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)] -pub enum gfxSurfaceType { - Image = 0, - PDF = 1, - PS = 2, - Xlib = 3, - Xcb = 4, - Glitz = 5, - Quartz = 6, - Win32 = 7, - BeOS = 8, - DirectFB = 9, - SVG = 10, - OS2 = 11, - Win32Printing = 12, - QuartzImage = 13, - Script = 14, - QPainter = 15, - Recording = 16, - VG = 17, - GL = 18, - DRM = 19, - Tee = 20, - XML = 21, - Skia = 22, - Subsurface = 23, - Max = 24, -} -#[repr(i32)] +#[repr(u32)] #[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)] -pub enum gfxContentType { - COLOR = 4096, - ALPHA = 8192, - COLOR_ALPHA = 12288, - SENTINEL = 65535, +pub enum SheetParsingMode { + eAuthorSheetFeatures = 0, + eUserSheetFeatures = 1, + eAgentSheetFeatures = 2, } +pub type nsLoadFlags = u32; #[repr(C)] #[derive(Debug, Copy)] -pub struct piecewise_construct_t; -impl ::std::clone::Clone for piecewise_construct_t { - fn clone(&self) -> Self { *self } +pub struct nsIRequest { + pub _base: nsISupports, } #[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct pair<_T1, _T2> { - pub first: _T1, - pub second: _T2, +pub struct _vftable_nsIRequest { + pub _base: _vftable_nsISupports, } -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct __make_pair_return_impl<_Tp> { - pub _phantom0: ::std::marker::PhantomData<_Tp>, +#[repr(u32)] +#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)] +pub enum nsIRequest_nsIRequest_h_unnamed_7 { + LOAD_REQUESTMASK = 65535, + LOAD_NORMAL = 0, + LOAD_BACKGROUND = 1, + INHIBIT_PIPELINE = 64, + INHIBIT_CACHING = 128, + INHIBIT_PERSISTENT_CACHING = 256, + LOAD_BYPASS_CACHE = 512, + LOAD_FROM_CACHE = 1024, + VALIDATE_ALWAYS = 2048, + VALIDATE_NEVER = 4096, + VALIDATE_ONCE_PER_SESSION = 8192, + LOAD_ANONYMOUS = 16384, + LOAD_FRESH_CONNECTION = 32768, } +impl ::std::clone::Clone for nsIRequest { + fn clone(&self) -> Self { *self } +} +/** + * A class for holding strong references to handle-managed objects. + * + * This is intended for use with objects like StyleSheetHandle, where + * the handle type is not a pointer but which can still have ->AddRef() + * and ->Release() called on it. + */ #[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct __make_pair_return<_Tp> { - pub _phantom0: ::std::marker::PhantomData<_Tp>, +#[derive(Debug)] +pub struct HandleRefPtr<T> { + pub mHandle: T, } pub type Float = f32; #[repr(i8)] @@ -3142,7 +2991,7 @@ pub type gfxImageFormat = SurfaceFormat; pub struct RectCorner; #[repr(u32)] #[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)] -pub enum RectCorner_Types_h_unnamed_6 { +pub enum RectCorner_Types_h_unnamed_8 { TopLeft = 0, TopRight = 1, BottomRight = 2, @@ -3261,6 +3110,266 @@ fn bindgen_test_layout_nsRect() { assert_eq!(::std::mem::size_of::<nsRect>() , 16usize); assert_eq!(::std::mem::align_of::<nsRect>() , 4usize); } +pub enum AnimationEffectReadOnly { } +pub enum AnimationEffectReadOnlyAtoms { } +pub enum AnimationEffectTimingPropertiesAtoms { } +pub enum ComputedTimingPropertiesAtoms { } +#[repr(i32)] +#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)] +pub enum FillMode { + None = 0, + Forwards = 1, + Backwards = 2, + Both = 3, + Auto = 4, + EndGuard_ = 5, +} +#[repr(i32)] +#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)] +pub enum PlaybackDirection { + Normal = 0, + Reverse = 1, + Alternate = 2, + Alternate_reverse = 3, + EndGuard_ = 4, +} +pub type NativeType = AnimationEffectReadOnly; +pub enum ErrorReporter { } +#[repr(u32)] +#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)] +pub enum nsCSSTokenType { + eCSSToken_Whitespace = 0, + eCSSToken_Comment = 1, + eCSSToken_Ident = 2, + eCSSToken_Function = 3, + eCSSToken_AtKeyword = 4, + eCSSToken_ID = 5, + eCSSToken_Hash = 6, + eCSSToken_Number = 7, + eCSSToken_Dimension = 8, + eCSSToken_Percentage = 9, + eCSSToken_String = 10, + eCSSToken_Bad_String = 11, + eCSSToken_URL = 12, + eCSSToken_Bad_URL = 13, + eCSSToken_Symbol = 14, + eCSSToken_Includes = 15, + eCSSToken_Dashmatch = 16, + eCSSToken_Beginsmatch = 17, + eCSSToken_Endsmatch = 18, + eCSSToken_Containsmatch = 19, + eCSSToken_URange = 20, + eCSSToken_HTMLComment = 21, +} +#[repr(u32)] +#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)] +pub enum nsCSSTokenSerializationType { + eCSSTokenSerialization_Nothing = 0, + eCSSTokenSerialization_Whitespace = 1, + eCSSTokenSerialization_AtKeyword_or_Hash = 2, + eCSSTokenSerialization_Number = 3, + eCSSTokenSerialization_Dimension = 4, + eCSSTokenSerialization_Percentage = 5, + eCSSTokenSerialization_URange = 6, + eCSSTokenSerialization_URL_or_BadURL = 7, + eCSSTokenSerialization_Function = 8, + eCSSTokenSerialization_Ident = 9, + eCSSTokenSerialization_CDC = 10, + eCSSTokenSerialization_DashMatch = 11, + eCSSTokenSerialization_ContainsMatch = 12, + eCSSTokenSerialization_Symbol_Hash = 13, + eCSSTokenSerialization_Symbol_At = 14, + eCSSTokenSerialization_Symbol_Dot_or_Plus = 15, + eCSSTokenSerialization_Symbol_Minus = 16, + eCSSTokenSerialization_Symbol_OpenParen = 17, + eCSSTokenSerialization_Symbol_Question = 18, + eCSSTokenSerialization_Symbol_Assorted = 19, + eCSSTokenSerialization_Symbol_Equals = 20, + eCSSTokenSerialization_Symbol_Bar = 21, + eCSSTokenSerialization_Symbol_Slash = 22, + eCSSTokenSerialization_Symbol_Asterisk = 23, + eCSSTokenSerialization_Other = 24, +} +#[repr(C)] +pub struct nsCSSToken { + pub mIdent: nsAutoString, + pub mNumber: f32, + pub mInteger: i32, + pub mInteger2: i32, + pub mType: nsCSSTokenType, + pub mSymbol: ::std::os::raw::c_ushort, + pub mIntegerValid: bool, + pub mHasSign: bool, +} +#[test] +fn bindgen_test_layout_nsCSSToken() { + assert_eq!(::std::mem::size_of::<nsCSSToken>() , 184usize); + assert_eq!(::std::mem::align_of::<nsCSSToken>() , 8usize); +} +#[repr(C)] +#[derive(Debug, Copy)] +pub struct nsCSSScannerPosition { + pub mOffset: u32, + pub mLineNumber: u32, + pub mLineOffset: u32, + pub mTokenLineNumber: u32, + pub mTokenLineOffset: u32, + pub mTokenOffset: u32, + pub mInitialized: bool, +} +impl ::std::clone::Clone for nsCSSScannerPosition { + fn clone(&self) -> Self { *self } +} +#[test] +fn bindgen_test_layout_nsCSSScannerPosition() { + assert_eq!(::std::mem::size_of::<nsCSSScannerPosition>() , 28usize); + assert_eq!(::std::mem::align_of::<nsCSSScannerPosition>() , 4usize); +} +#[repr(u32)] +#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)] +pub enum nsCSSScannerExclude { + eCSSScannerExclude_None = 0, + eCSSScannerExclude_Comments = 1, + eCSSScannerExclude_WhitespaceAndComments = 2, +} +#[repr(C)] +#[derive(Debug)] +pub struct nsCSSScanner { + pub mBuffer: *const ::std::os::raw::c_ushort, + pub mOffset: u32, + pub mCount: u32, + pub mLineNumber: u32, + pub mLineOffset: u32, + pub mTokenLineNumber: u32, + pub mTokenLineOffset: u32, + pub mTokenOffset: u32, + pub mRecordStartOffset: u32, + pub mEOFCharacters: nsCSSScanner_EOFCharacters, + pub mReporter: *mut ErrorReporter, + pub mSVGMode: bool, + pub mRecording: bool, + pub mSeenBadToken: bool, + pub mSeenVariableReference: bool, +} +#[repr(u32)] +#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)] +pub enum nsCSSScanner_EOFCharacters { + eEOFCharacters_None = 0, + eEOFCharacters_DropBackslash = 1, + eEOFCharacters_ReplacementChar = 2, + eEOFCharacters_Asterisk = 4, + eEOFCharacters_Slash = 8, + eEOFCharacters_DoubleQuote = 16, + eEOFCharacters_SingleQuote = 32, + eEOFCharacters_CloseParen = 64, +} +#[test] +fn bindgen_test_layout_nsCSSScanner() { + assert_eq!(::std::mem::size_of::<nsCSSScanner>() , 64usize); + assert_eq!(::std::mem::align_of::<nsCSSScanner>() , 8usize); +} +#[repr(C)] +pub struct nsCSSGridTemplateAreaToken { + pub mName: nsAutoString, + pub isTrash: bool, +} +#[test] +fn bindgen_test_layout_nsCSSGridTemplateAreaToken() { + assert_eq!(::std::mem::size_of::<nsCSSGridTemplateAreaToken>() , + 168usize); + assert_eq!(::std::mem::align_of::<nsCSSGridTemplateAreaToken>() , 8usize); +} +#[repr(C)] +#[derive(Debug, Copy)] +pub struct nsCSSGridTemplateAreaScanner { + pub mBuffer: *const ::std::os::raw::c_ushort, + pub mOffset: u32, + pub mCount: u32, +} +impl ::std::clone::Clone for nsCSSGridTemplateAreaScanner { + fn clone(&self) -> Self { *self } +} +#[test] +fn bindgen_test_layout_nsCSSGridTemplateAreaScanner() { + assert_eq!(::std::mem::size_of::<nsCSSGridTemplateAreaScanner>() , + 16usize); + assert_eq!(::std::mem::align_of::<nsCSSGridTemplateAreaScanner>() , + 8usize); +} +pub enum CSSVariableResolver { } +#[repr(C)] +pub struct CSSVariableValues { + pub mVariableIDs: [u64; 6usize], + /** + * Array of variables, indexed by variable ID. + */ + pub mVariables: nsTArray<CSSVariableValues_Variable>, +} +#[repr(C)] +#[derive(Debug)] +pub struct CSSVariableValues_Variable { + pub mVariableName: nsString, + pub mValue: nsString, + pub mFirstToken: nsCSSTokenSerializationType, + pub mLastToken: nsCSSTokenSerializationType, +} +#[test] +fn bindgen_test_layout_CSSVariableValues_Variable() { + assert_eq!(::std::mem::size_of::<CSSVariableValues_Variable>() , 40usize); + assert_eq!(::std::mem::align_of::<CSSVariableValues_Variable>() , 8usize); +} +#[test] +fn bindgen_test_layout_CSSVariableValues() { + assert_eq!(::std::mem::size_of::<CSSVariableValues>() , 56usize); + assert_eq!(::std::mem::align_of::<CSSVariableValues>() , 8usize); +} +#[repr(i8)] +#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)] +pub enum SheetType { + Agent = 0, + User = 1, + PresHint = 2, + SVGAttrAnimation = 3, + Doc = 4, + ScopedDoc = 5, + StyleAttr = 6, + Override = 7, + Animation = 8, + Transition = 9, + Count = 10, + Unknown = -1, +} +/** + * StaticAutoPtr and StaticRefPtr are like nsAutoPtr and nsRefPtr, except they + * are suitable for use as global variables. + * + * In particular, a global instance of Static{Auto,Ref}Ptr doesn't cause the + * compiler to emit a static initializer (in release builds, anyway). + * + * In order to accomplish this, Static{Auto,Ref}Ptr must have a trivial + * constructor and destructor. As a consequence, it cannot initialize its raw + * pointer to 0 on construction, and it cannot delete/release its raw pointer + * upon destruction. + * + * Since the compiler guarantees that all global variables are initialized to + * 0, these trivial constructors are safe. Since we rely on this, the clang + * plugin, run as part of our "static analysis" builds, makes it a compile-time + * error to use Static{Auto,Ref}Ptr as anything except a global variable. + * + * Static{Auto,Ref}Ptr have a limited interface as compared to ns{Auto,Ref}Ptr; + * this is intentional, since their range of acceptable uses is smaller. + */ +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct StaticAutoPtr<T> { + pub mRawPtr: *mut T, +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct StaticRefPtr<T> { + pub mRawPtr: *mut T, +} +pub enum Zero { } pub const eFamily_generic_first: FontFamilyType = FontFamilyType::eFamily_serif; pub const eFamily_generic_last: FontFamilyType = @@ -3393,47 +3502,6 @@ fn bindgen_test_layout_nsFont() { #[repr(i8)] #[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)] pub enum StyleBoxSizing { Content = 0, Border = 1, } -#[repr(i32)] -#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)] -pub enum PlaybackDirection { _BindgenOpaqueEnum = 0, } -#[repr(i32)] -#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)] -pub enum FillMode { _BindgenOpaqueEnum = 0, } -pub enum nsIContentSecurityPolicy { } -pub enum nsIDOMDocument { } -#[repr(C)] -pub struct nsIPrincipal { - pub _bindgen_opaque_blob: u64, -} -#[test] -fn bindgen_test_layout_nsIPrincipal() { - assert_eq!(::std::mem::size_of::<nsIPrincipal>() , 8usize); - assert_eq!(::std::mem::align_of::<nsIPrincipal>() , 8usize); -} -#[repr(C)] -#[derive(Debug, Copy)] -pub struct nsIExpandedPrincipal { - pub _base: nsISupports, -} -#[repr(C)] -pub struct _vftable_nsIExpandedPrincipal { - pub _base: _vftable_nsISupports, -} -impl ::std::clone::Clone for nsIExpandedPrincipal { - fn clone(&self) -> Self { *self } -} -#[repr(C)] -#[derive(Debug, Copy)] -pub struct nsIURI { - pub _base: nsISupports, -} -#[repr(C)] -pub struct _vftable_nsIURI { - pub _base: _vftable_nsISupports, -} -impl ::std::clone::Clone for nsIURI { - fn clone(&self) -> Self { *self } -} pub const eCSSProperty_COUNT_DUMMY: nsCSSProperty = nsCSSProperty::eCSSProperty_z_index; pub const eCSSProperty_all: nsCSSProperty = @@ -3994,26 +4062,6 @@ pub struct nsMainThreadPtrHolder<T> { pub struct nsMainThreadPtrHandle<T> { pub mPtr: RefPtr<T>, } -/** - * 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)] -#[derive(Debug)] -pub struct nsStringBuffer { - pub mRefCount: u32, - pub mStorageSize: u32, -} -#[test] -fn bindgen_test_layout_nsStringBuffer() { - assert_eq!(::std::mem::size_of::<nsStringBuffer>() , 8usize); - assert_eq!(::std::mem::align_of::<nsStringBuffer>() , 4usize); -} pub enum CSSStyleSheet { } #[repr(C)] pub struct URLValueData { @@ -4174,14 +4222,14 @@ pub enum nsCSSUnit { #[derive(Debug)] pub struct nsCSSValue { pub mUnit: nsCSSUnit, - pub mValue: nsCSSValue_nsCSSValue_h_unnamed_9, + pub mValue: nsCSSValue_nsCSSValue_h_unnamed_10, } #[repr(u32)] #[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)] pub enum nsCSSValue_Serialization { eNormalized = 0, eAuthorSpecified = 1, } #[repr(C)] #[derive(Debug, Copy)] -pub struct nsCSSValue_nsCSSValue_h_unnamed_9 { +pub struct nsCSSValue_nsCSSValue_h_unnamed_10 { pub mInt: __BindgenUnionField<i32>, pub mFloat: __BindgenUnionField<f32>, pub mString: __BindgenUnionField<*mut nsStringBuffer>, @@ -4204,15 +4252,15 @@ pub struct nsCSSValue_nsCSSValue_h_unnamed_9 { pub mFontFamilyList: __BindgenUnionField<*mut FontFamilyListRefCnt>, pub _bindgen_data_: u64, } -impl nsCSSValue_nsCSSValue_h_unnamed_9 { } -impl ::std::clone::Clone for nsCSSValue_nsCSSValue_h_unnamed_9 { +impl nsCSSValue_nsCSSValue_h_unnamed_10 { } +impl ::std::clone::Clone for nsCSSValue_nsCSSValue_h_unnamed_10 { fn clone(&self) -> Self { *self } } #[test] -fn bindgen_test_layout_nsCSSValue_nsCSSValue_h_unnamed_9() { - assert_eq!(::std::mem::size_of::<nsCSSValue_nsCSSValue_h_unnamed_9>() , +fn bindgen_test_layout_nsCSSValue_nsCSSValue_h_unnamed_10() { + assert_eq!(::std::mem::size_of::<nsCSSValue_nsCSSValue_h_unnamed_10>() , 8usize); - assert_eq!(::std::mem::align_of::<nsCSSValue_nsCSSValue_h_unnamed_9>() , + assert_eq!(::std::mem::align_of::<nsCSSValue_nsCSSValue_h_unnamed_10>() , 8usize); } #[test] @@ -4501,125 +4549,6 @@ fn bindgen_test_layout_CounterStyleManager() { assert_eq!(::std::mem::align_of::<CounterStyleManager>() , 8usize); } /** - * Enum defining the mode in which a sheet is to be parsed. This is - * usually, but not always, the same as the cascade level at which the - * sheet will apply (see nsStyleSet.h). Most of the Loader APIs only - * support loading of author sheets. - * - * Author sheets are the normal case: styles embedded in or linked - * from HTML pages. They are also the most restricted. - * - * User sheets can do anything author sheets can do, and also get - * access to a few CSS extensions that are not yet suitable for - * exposure on the public Web, but are very useful for expressing - * user style overrides, such as @-moz-document rules. - * - * Agent sheets have access to all author- and user-sheet features - * plus more extensions that are necessary for internal use but, - * again, not yet suitable for exposure on the public Web. Some of - * these are outright unsafe to expose; in particular, incorrect - * styling of anonymous box pseudo-elements can violate layout - * invariants. - */ -#[repr(u32)] -#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)] -pub enum SheetParsingMode { - eAuthorSheetFeatures = 0, - eUserSheetFeatures = 1, - eAgentSheetFeatures = 2, -} -pub type nsLoadFlags = u32; -#[repr(C)] -#[derive(Debug, Copy)] -pub struct nsIRequest { - pub _base: nsISupports, -} -#[repr(C)] -pub struct _vftable_nsIRequest { - pub _base: _vftable_nsISupports, -} -#[repr(u32)] -#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)] -pub enum nsIRequest_nsIRequest_h_unnamed_10 { - LOAD_REQUESTMASK = 65535, - LOAD_NORMAL = 0, - LOAD_BACKGROUND = 1, - INHIBIT_PIPELINE = 64, - INHIBIT_CACHING = 128, - INHIBIT_PERSISTENT_CACHING = 256, - LOAD_BYPASS_CACHE = 512, - LOAD_FROM_CACHE = 1024, - VALIDATE_ALWAYS = 2048, - VALIDATE_NEVER = 4096, - VALIDATE_ONCE_PER_SESSION = 8192, - LOAD_ANONYMOUS = 16384, - LOAD_FRESH_CONNECTION = 32768, -} -impl ::std::clone::Clone for nsIRequest { - fn clone(&self) -> Self { *self } -} -#[repr(C)] -#[derive(Debug, Copy)] -pub struct nsIAtom { - pub _base: nsISupports, - pub _bitfield_1: u32, - pub mHash: u32, - /** - * WARNING! There is an invisible constraint on |mString|: the chars it - * points to must belong to an nsStringBuffer. This is so that the - * nsStringBuffer::FromData() calls above are valid. - */ - pub mString: *mut ::std::os::raw::c_ushort, -} -#[repr(C)] -pub struct _vftable_nsIAtom { - pub _base: _vftable_nsISupports, -} -impl ::std::clone::Clone for nsIAtom { - fn clone(&self) -> Self { *self } -} -#[test] -fn bindgen_test_layout_nsIAtom() { - assert_eq!(::std::mem::size_of::<nsIAtom>() , 24usize); - assert_eq!(::std::mem::align_of::<nsIAtom>() , 8usize); -} -#[repr(C)] -#[derive(Debug)] -pub struct nsAtomString { - pub _base: nsString, -} -#[test] -fn bindgen_test_layout_nsAtomString() { - assert_eq!(::std::mem::size_of::<nsAtomString>() , 16usize); - assert_eq!(::std::mem::align_of::<nsAtomString>() , 8usize); -} -#[repr(C)] -#[derive(Debug)] -pub struct nsAtomCString { - pub _base: nsCString, -} -#[test] -fn bindgen_test_layout_nsAtomCString() { - assert_eq!(::std::mem::size_of::<nsAtomCString>() , 16usize); - assert_eq!(::std::mem::align_of::<nsAtomCString>() , 8usize); -} -#[repr(C)] -pub struct nsDependentAtomString { - pub _base: [u64; 2usize], -} -/** - * A class for holding strong references to handle-managed objects. - * - * This is intended for use with objects like StyleSheetHandle, where - * the handle type is not a pointer but which can still have ->AddRef() - * and ->Release() called on it. - */ -#[repr(C)] -#[derive(Debug)] -pub struct HandleRefPtr<T> { - pub mHandle: T, -} -/** * A class for holding strong references to nsPresArena-allocated * objects. * diff --git a/ports/geckolib/gecko_bindings/structs_release.rs b/ports/geckolib/gecko_bindings/structs_release.rs index c7559d71b43..a7ce48de72d 100644 --- a/ports/geckolib/gecko_bindings/structs_release.rs +++ b/ports/geckolib/gecko_bindings/structs_release.rs @@ -1879,168 +1879,6 @@ fn bindgen_test_layout_NS_ConvertUTF8toUTF16() { assert_eq!(::std::mem::align_of::<NS_ConvertUTF8toUTF16>() , 8usize); } pub type nsVoidableString = nsAutoString; -pub enum ErrorReporter { } -#[repr(u32)] -#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)] -pub enum nsCSSTokenType { - eCSSToken_Whitespace = 0, - eCSSToken_Comment = 1, - eCSSToken_Ident = 2, - eCSSToken_Function = 3, - eCSSToken_AtKeyword = 4, - eCSSToken_ID = 5, - eCSSToken_Hash = 6, - eCSSToken_Number = 7, - eCSSToken_Dimension = 8, - eCSSToken_Percentage = 9, - eCSSToken_String = 10, - eCSSToken_Bad_String = 11, - eCSSToken_URL = 12, - eCSSToken_Bad_URL = 13, - eCSSToken_Symbol = 14, - eCSSToken_Includes = 15, - eCSSToken_Dashmatch = 16, - eCSSToken_Beginsmatch = 17, - eCSSToken_Endsmatch = 18, - eCSSToken_Containsmatch = 19, - eCSSToken_URange = 20, - eCSSToken_HTMLComment = 21, -} -#[repr(u32)] -#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)] -pub enum nsCSSTokenSerializationType { - eCSSTokenSerialization_Nothing = 0, - eCSSTokenSerialization_Whitespace = 1, - eCSSTokenSerialization_AtKeyword_or_Hash = 2, - eCSSTokenSerialization_Number = 3, - eCSSTokenSerialization_Dimension = 4, - eCSSTokenSerialization_Percentage = 5, - eCSSTokenSerialization_URange = 6, - eCSSTokenSerialization_URL_or_BadURL = 7, - eCSSTokenSerialization_Function = 8, - eCSSTokenSerialization_Ident = 9, - eCSSTokenSerialization_CDC = 10, - eCSSTokenSerialization_DashMatch = 11, - eCSSTokenSerialization_ContainsMatch = 12, - eCSSTokenSerialization_Symbol_Hash = 13, - eCSSTokenSerialization_Symbol_At = 14, - eCSSTokenSerialization_Symbol_Dot_or_Plus = 15, - eCSSTokenSerialization_Symbol_Minus = 16, - eCSSTokenSerialization_Symbol_OpenParen = 17, - eCSSTokenSerialization_Symbol_Question = 18, - eCSSTokenSerialization_Symbol_Assorted = 19, - eCSSTokenSerialization_Symbol_Equals = 20, - eCSSTokenSerialization_Symbol_Bar = 21, - eCSSTokenSerialization_Symbol_Slash = 22, - eCSSTokenSerialization_Symbol_Asterisk = 23, - eCSSTokenSerialization_Other = 24, -} -#[repr(C)] -pub struct nsCSSToken { - pub mIdent: nsAutoString, - pub mNumber: f32, - pub mInteger: i32, - pub mInteger2: i32, - pub mType: nsCSSTokenType, - pub mSymbol: ::std::os::raw::c_ushort, - pub mIntegerValid: bool, - pub mHasSign: bool, -} -#[test] -fn bindgen_test_layout_nsCSSToken() { - assert_eq!(::std::mem::size_of::<nsCSSToken>() , 184usize); - assert_eq!(::std::mem::align_of::<nsCSSToken>() , 8usize); -} -#[repr(C)] -#[derive(Debug, Copy)] -pub struct nsCSSScannerPosition { - pub mOffset: u32, - pub mLineNumber: u32, - pub mLineOffset: u32, - pub mTokenLineNumber: u32, - pub mTokenLineOffset: u32, - pub mTokenOffset: u32, - pub mInitialized: bool, -} -impl ::std::clone::Clone for nsCSSScannerPosition { - fn clone(&self) -> Self { *self } -} -#[test] -fn bindgen_test_layout_nsCSSScannerPosition() { - assert_eq!(::std::mem::size_of::<nsCSSScannerPosition>() , 28usize); - assert_eq!(::std::mem::align_of::<nsCSSScannerPosition>() , 4usize); -} -#[repr(u32)] -#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)] -pub enum nsCSSScannerExclude { - eCSSScannerExclude_None = 0, - eCSSScannerExclude_Comments = 1, - eCSSScannerExclude_WhitespaceAndComments = 2, -} -#[repr(C)] -#[derive(Debug)] -pub struct nsCSSScanner { - pub mBuffer: *const ::std::os::raw::c_ushort, - pub mOffset: u32, - pub mCount: u32, - pub mLineNumber: u32, - pub mLineOffset: u32, - pub mTokenLineNumber: u32, - pub mTokenLineOffset: u32, - pub mTokenOffset: u32, - pub mRecordStartOffset: u32, - pub mEOFCharacters: nsCSSScanner_EOFCharacters, - pub mReporter: *mut ErrorReporter, - pub mSVGMode: bool, - pub mRecording: bool, - pub mSeenBadToken: bool, - pub mSeenVariableReference: bool, -} -#[repr(u32)] -#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)] -pub enum nsCSSScanner_EOFCharacters { - eEOFCharacters_None = 0, - eEOFCharacters_DropBackslash = 1, - eEOFCharacters_ReplacementChar = 2, - eEOFCharacters_Asterisk = 4, - eEOFCharacters_Slash = 8, - eEOFCharacters_DoubleQuote = 16, - eEOFCharacters_SingleQuote = 32, - eEOFCharacters_CloseParen = 64, -} -#[test] -fn bindgen_test_layout_nsCSSScanner() { - assert_eq!(::std::mem::size_of::<nsCSSScanner>() , 64usize); - assert_eq!(::std::mem::align_of::<nsCSSScanner>() , 8usize); -} -#[repr(C)] -pub struct nsCSSGridTemplateAreaToken { - pub mName: nsAutoString, - pub isTrash: bool, -} -#[test] -fn bindgen_test_layout_nsCSSGridTemplateAreaToken() { - assert_eq!(::std::mem::size_of::<nsCSSGridTemplateAreaToken>() , - 168usize); - assert_eq!(::std::mem::align_of::<nsCSSGridTemplateAreaToken>() , 8usize); -} -#[repr(C)] -#[derive(Debug, Copy)] -pub struct nsCSSGridTemplateAreaScanner { - pub mBuffer: *const ::std::os::raw::c_ushort, - pub mOffset: u32, - pub mCount: u32, -} -impl ::std::clone::Clone for nsCSSGridTemplateAreaScanner { - fn clone(&self) -> Self { *self } -} -#[test] -fn bindgen_test_layout_nsCSSGridTemplateAreaScanner() { - assert_eq!(::std::mem::size_of::<nsCSSGridTemplateAreaScanner>() , - 16usize); - assert_eq!(::std::mem::align_of::<nsCSSGridTemplateAreaScanner>() , - 8usize); -} /** * A "unique identifier". This is modeled after OSF DCE UUIDs. */ @@ -2225,6 +2063,151 @@ pub struct RefPtr_ConstRemovingRefPtrTraits<T, U> { pub struct RefPtrGetterAddRefs<T> { pub mTargetSmartPtr: *mut RefPtr<T>, } +pub enum TileClient { } +#[repr(C)] +#[derive(Debug, Copy)] +pub struct nsTArrayFallibleResult { + pub mResult: bool, +} +impl ::std::clone::Clone for nsTArrayFallibleResult { + fn clone(&self) -> Self { *self } +} +#[test] +fn bindgen_test_layout_nsTArrayFallibleResult() { + assert_eq!(::std::mem::size_of::<nsTArrayFallibleResult>() , 1usize); + assert_eq!(::std::mem::align_of::<nsTArrayFallibleResult>() , 1usize); +} +#[repr(C)] +#[derive(Debug, Copy)] +pub struct nsTArrayInfallibleResult; +impl ::std::clone::Clone for nsTArrayInfallibleResult { + fn clone(&self) -> Self { *self } +} +#[repr(C)] +#[derive(Debug, Copy)] +pub struct nsTArrayFallibleAllocatorBase; +impl ::std::clone::Clone for nsTArrayFallibleAllocatorBase { + fn clone(&self) -> Self { *self } +} +#[repr(C)] +#[derive(Debug, Copy)] +pub struct nsTArrayInfallibleAllocatorBase; +impl ::std::clone::Clone for nsTArrayInfallibleAllocatorBase { + fn clone(&self) -> Self { *self } +} +#[repr(C)] +#[derive(Debug, Copy)] +pub struct nsTArrayFallibleAllocator { + pub _base: nsTArrayFallibleAllocatorBase, +} +impl ::std::clone::Clone for nsTArrayFallibleAllocator { + fn clone(&self) -> Self { *self } +} +#[repr(C)] +#[derive(Debug, Copy)] +pub struct nsTArrayInfallibleAllocator { + pub _base: nsTArrayInfallibleAllocatorBase, +} +impl ::std::clone::Clone for nsTArrayInfallibleAllocator { + fn clone(&self) -> Self { *self } +} +#[repr(C)] +#[derive(Debug, Copy)] +pub struct nsTArrayHeader { + pub mLength: u32, + pub _bitfield_1: u32, +} +impl ::std::clone::Clone for nsTArrayHeader { + fn clone(&self) -> Self { *self } +} +#[test] +fn bindgen_test_layout_nsTArrayHeader() { + assert_eq!(::std::mem::size_of::<nsTArrayHeader>() , 8usize); + assert_eq!(::std::mem::align_of::<nsTArrayHeader>() , 4usize); +} +extern "C" { + #[link_name = "_ZN14nsTArrayHeader9sEmptyHdrE"] + pub static mut nsTArrayHeader_consts_sEmptyHdr: nsTArrayHeader; +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct nsTArray_SafeElementAtHelper<E, Derived> { + pub _phantom0: ::std::marker::PhantomData<E>, + pub _phantom1: ::std::marker::PhantomData<Derived>, +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct nsTArray_SafeElementAtSmartPtrHelper<E, Derived> { + pub _phantom0: ::std::marker::PhantomData<E>, + pub _phantom1: ::std::marker::PhantomData<Derived>, +} +#[repr(C)] +#[derive(Debug)] +pub struct nsTArray_base<Alloc, Copy> { + pub mHdr: *mut nsTArrayHeader, + pub _phantom0: ::std::marker::PhantomData<Alloc>, + pub _phantom1: ::std::marker::PhantomData<Copy>, +} +#[repr(C)] +#[derive(Debug)] +pub struct nsTArray_base_IsAutoArrayRestorer<Alloc, Copy> { + pub mArray: *mut nsTArray_base<Alloc, Copy>, + pub mElemAlign: usize, + pub mIsAuto: bool, + pub _phantom0: ::std::marker::PhantomData<Copy>, +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct nsDefaultComparator<A, B> { + pub _phantom0: ::std::marker::PhantomData<A>, + pub _phantom1: ::std::marker::PhantomData<B>, +} +#[repr(C)] +#[derive(Debug, Copy)] +pub struct nsTArray_CopyWithMemutils; +impl ::std::clone::Clone for nsTArray_CopyWithMemutils { + fn clone(&self) -> Self { *self } +} +extern "C" { + #[link_name = "_ZN25nsTArray_CopyWithMemutils12allowReallocE"] + pub static nsTArray_CopyWithMemutils_consts_allowRealloc: bool; +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct nsTArray_CopyWithConstructors<ElemType> { + pub _phantom0: ::std::marker::PhantomData<ElemType>, +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct nsTArray_CopyChooser<E> { + pub _phantom0: ::std::marker::PhantomData<E>, +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct nsTArray_TypedBase<E, Derived> { + pub _base: nsTArray_SafeElementAtHelper<E, Derived>, + pub _phantom0: ::std::marker::PhantomData<Derived>, +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct ItemComparatorEq<Item, Comparator> { + pub mItem: *const Item, + pub mComp: *const Comparator, +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct ItemComparatorFirstElementGT<Item, Comparator> { + pub mItem: *const Item, + pub mComp: *const Comparator, +} +/** + * <div rustbindgen replaces="nsTArray"></div> + */ +#[repr(C)] +#[derive(Debug)] +pub struct nsTArray<T> { + pub mBuffer: *mut T, +} #[repr(C)] #[derive(Debug, Copy)] pub struct nsCOMPtr_helper; @@ -2382,6 +2365,87 @@ pub struct nsAutoPtr_Proxy<T, R, Args> { pub struct nsAutoPtrGetterTransfers<T> { pub mTargetSmartPtr: *mut nsAutoPtr<T>, } +/** + * 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)] +#[derive(Debug)] +pub struct nsStringBuffer { + pub mRefCount: u32, + pub mStorageSize: u32, +} +#[test] +fn bindgen_test_layout_nsStringBuffer() { + assert_eq!(::std::mem::size_of::<nsStringBuffer>() , 8usize); + assert_eq!(::std::mem::align_of::<nsStringBuffer>() , 4usize); +} +#[repr(C)] +#[derive(Debug, Copy)] +pub struct nsIAtom { + pub _base: nsISupports, + pub _bitfield_1: u32, + pub mHash: u32, + /** + * WARNING! There is an invisible constraint on |mString|: the chars it + * points to must belong to an nsStringBuffer. This is so that the + * nsStringBuffer::FromData() calls above are valid. + */ + pub mString: *mut ::std::os::raw::c_ushort, +} +#[repr(C)] +pub struct _vftable_nsIAtom { + pub _base: _vftable_nsISupports, +} +impl ::std::clone::Clone for nsIAtom { + fn clone(&self) -> Self { *self } +} +#[test] +fn bindgen_test_layout_nsIAtom() { + assert_eq!(::std::mem::size_of::<nsIAtom>() , 24usize); + assert_eq!(::std::mem::align_of::<nsIAtom>() , 8usize); +} +#[repr(C)] +#[derive(Debug)] +pub struct nsAtomString { + pub _base: nsString, +} +#[test] +fn bindgen_test_layout_nsAtomString() { + assert_eq!(::std::mem::size_of::<nsAtomString>() , 16usize); + assert_eq!(::std::mem::align_of::<nsAtomString>() , 8usize); +} +#[repr(C)] +#[derive(Debug)] +pub struct nsAtomCString { + pub _base: nsCString, +} +#[test] +fn bindgen_test_layout_nsAtomCString() { + assert_eq!(::std::mem::size_of::<nsAtomCString>() , 16usize); + assert_eq!(::std::mem::align_of::<nsAtomCString>() , 8usize); +} +#[repr(C)] +pub struct nsDependentAtomString { + pub _base: [u64; 2usize], +} +#[repr(C)] +#[derive(Debug, Copy)] +pub struct piecewise_construct_t; +impl ::std::clone::Clone for piecewise_construct_t { + fn clone(&self) -> Self { *self } +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct pair<_T1, _T2> { + pub first: _T1, + pub second: _T2, +} pub type PLDHashNumber = u32; #[repr(C)] #[derive(Debug, Copy)] @@ -2570,325 +2634,110 @@ pub struct nsTHashtable_Iterator<EntryType> { } #[repr(C)] pub struct nsDataHashtable; -pub enum TileClient { } +pub enum nsIContentSecurityPolicy { } +pub enum nsIDOMDocument { } #[repr(C)] -#[derive(Debug, Copy)] -pub struct nsTArrayFallibleResult { - pub mResult: bool, -} -impl ::std::clone::Clone for nsTArrayFallibleResult { - fn clone(&self) -> Self { *self } +pub struct nsIPrincipal { + pub _bindgen_opaque_blob: u64, } #[test] -fn bindgen_test_layout_nsTArrayFallibleResult() { - assert_eq!(::std::mem::size_of::<nsTArrayFallibleResult>() , 1usize); - assert_eq!(::std::mem::align_of::<nsTArrayFallibleResult>() , 1usize); -} -#[repr(C)] -#[derive(Debug, Copy)] -pub struct nsTArrayInfallibleResult; -impl ::std::clone::Clone for nsTArrayInfallibleResult { - fn clone(&self) -> Self { *self } -} -#[repr(C)] -#[derive(Debug, Copy)] -pub struct nsTArrayFallibleAllocatorBase; -impl ::std::clone::Clone for nsTArrayFallibleAllocatorBase { - fn clone(&self) -> Self { *self } -} -#[repr(C)] -#[derive(Debug, Copy)] -pub struct nsTArrayInfallibleAllocatorBase; -impl ::std::clone::Clone for nsTArrayInfallibleAllocatorBase { - fn clone(&self) -> Self { *self } +fn bindgen_test_layout_nsIPrincipal() { + assert_eq!(::std::mem::size_of::<nsIPrincipal>() , 8usize); + assert_eq!(::std::mem::align_of::<nsIPrincipal>() , 8usize); } #[repr(C)] #[derive(Debug, Copy)] -pub struct nsTArrayFallibleAllocator { - pub _base: nsTArrayFallibleAllocatorBase, -} -impl ::std::clone::Clone for nsTArrayFallibleAllocator { - fn clone(&self) -> Self { *self } +pub struct nsIExpandedPrincipal { + pub _base: nsISupports, } #[repr(C)] -#[derive(Debug, Copy)] -pub struct nsTArrayInfallibleAllocator { - pub _base: nsTArrayInfallibleAllocatorBase, +pub struct _vftable_nsIExpandedPrincipal { + pub _base: _vftable_nsISupports, } -impl ::std::clone::Clone for nsTArrayInfallibleAllocator { +impl ::std::clone::Clone for nsIExpandedPrincipal { fn clone(&self) -> Self { *self } } #[repr(C)] #[derive(Debug, Copy)] -pub struct nsTArrayHeader { - pub mLength: u32, - pub _bitfield_1: u32, -} -impl ::std::clone::Clone for nsTArrayHeader { - fn clone(&self) -> Self { *self } -} -#[test] -fn bindgen_test_layout_nsTArrayHeader() { - assert_eq!(::std::mem::size_of::<nsTArrayHeader>() , 8usize); - assert_eq!(::std::mem::align_of::<nsTArrayHeader>() , 4usize); -} -extern "C" { - #[link_name = "_ZN14nsTArrayHeader9sEmptyHdrE"] - pub static mut nsTArrayHeader_consts_sEmptyHdr: nsTArrayHeader; -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct nsTArray_SafeElementAtHelper<E, Derived> { - pub _phantom0: ::std::marker::PhantomData<E>, - pub _phantom1: ::std::marker::PhantomData<Derived>, -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct nsTArray_SafeElementAtSmartPtrHelper<E, Derived> { - pub _phantom0: ::std::marker::PhantomData<E>, - pub _phantom1: ::std::marker::PhantomData<Derived>, -} -#[repr(C)] -#[derive(Debug)] -pub struct nsTArray_base<Alloc, Copy> { - pub mHdr: *mut nsTArrayHeader, - pub _phantom0: ::std::marker::PhantomData<Alloc>, - pub _phantom1: ::std::marker::PhantomData<Copy>, -} -#[repr(C)] -#[derive(Debug)] -pub struct nsTArray_base_IsAutoArrayRestorer<Alloc, Copy> { - pub mArray: *mut nsTArray_base<Alloc, Copy>, - pub mElemAlign: usize, - pub mIsAuto: bool, - pub _phantom0: ::std::marker::PhantomData<Copy>, +pub struct nsIURI { + pub _base: nsISupports, } #[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct nsDefaultComparator<A, B> { - pub _phantom0: ::std::marker::PhantomData<A>, - pub _phantom1: ::std::marker::PhantomData<B>, +pub struct _vftable_nsIURI { + pub _base: _vftable_nsISupports, } -#[repr(C)] -#[derive(Debug, Copy)] -pub struct nsTArray_CopyWithMemutils; -impl ::std::clone::Clone for nsTArray_CopyWithMemutils { +impl ::std::clone::Clone for nsIURI { fn clone(&self) -> Self { *self } } -extern "C" { - #[link_name = "_ZN25nsTArray_CopyWithMemutils12allowReallocE"] - pub static nsTArray_CopyWithMemutils_consts_allowRealloc: bool; -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct nsTArray_CopyWithConstructors<ElemType> { - pub _phantom0: ::std::marker::PhantomData<ElemType>, -} -extern "C" { - #[link_name = "_ZN29nsTArray_CopyWithConstructors12allowReallocE"] - pub static nsTArray_CopyWithConstructors_consts_allowRealloc: bool; -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct nsTArray_CopyChooser<E> { - pub _phantom0: ::std::marker::PhantomData<E>, -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct nsTArray_TypedBase<E, Derived> { - pub _base: nsTArray_SafeElementAtHelper<E, Derived>, - pub _phantom0: ::std::marker::PhantomData<Derived>, -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct ItemComparatorEq<Item, Comparator> { - pub mItem: *const Item, - pub mComp: *const Comparator, -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct ItemComparatorFirstElementGT<Item, Comparator> { - pub mItem: *const Item, - pub mComp: *const Comparator, -} /** - * <div rustbindgen replaces="nsTArray"></div> - */ -#[repr(C)] -#[derive(Debug)] -pub struct nsTArray<T> { - pub mBuffer: *mut T, -} -pub enum CSSVariableResolver { } -#[repr(C)] -pub struct CSSVariableValues { - pub mVariableIDs: [u64; 5usize], - /** - * Array of variables, indexed by variable ID. - */ - pub mVariables: nsTArray<CSSVariableValues_Variable>, -} -#[repr(C)] -#[derive(Debug)] -pub struct CSSVariableValues_Variable { - pub mVariableName: nsString, - pub mValue: nsString, - pub mFirstToken: nsCSSTokenSerializationType, - pub mLastToken: nsCSSTokenSerializationType, -} -#[test] -fn bindgen_test_layout_CSSVariableValues_Variable() { - assert_eq!(::std::mem::size_of::<CSSVariableValues_Variable>() , 40usize); - assert_eq!(::std::mem::align_of::<CSSVariableValues_Variable>() , 8usize); -} -#[test] -fn bindgen_test_layout_CSSVariableValues() { - assert_eq!(::std::mem::size_of::<CSSVariableValues>() , 48usize); - assert_eq!(::std::mem::align_of::<CSSVariableValues>() , 8usize); -} -#[repr(i8)] -#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)] -pub enum SheetType { - Agent = 0, - User = 1, - PresHint = 2, - SVGAttrAnimation = 3, - Doc = 4, - ScopedDoc = 5, - StyleAttr = 6, - Override = 7, - Animation = 8, - Transition = 9, - Count = 10, - Unknown = -1, -} -/** - * StaticAutoPtr and StaticRefPtr are like nsAutoPtr and nsRefPtr, except they - * are suitable for use as global variables. - * - * In particular, a global instance of Static{Auto,Ref}Ptr doesn't cause the - * compiler to emit a static initializer (in release builds, anyway). - * - * In order to accomplish this, Static{Auto,Ref}Ptr must have a trivial - * constructor and destructor. As a consequence, it cannot initialize its raw - * pointer to 0 on construction, and it cannot delete/release its raw pointer - * upon destruction. - * - * Since the compiler guarantees that all global variables are initialized to - * 0, these trivial constructors are safe. Since we rely on this, the clang - * plugin, run as part of our "static analysis" builds, makes it a compile-time - * error to use Static{Auto,Ref}Ptr as anything except a global variable. - * - * Static{Auto,Ref}Ptr have a limited interface as compared to ns{Auto,Ref}Ptr; - * this is intentional, since their range of acceptable uses is smaller. - */ -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct StaticAutoPtr<T> { - pub mRawPtr: *mut T, -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct StaticRefPtr<T> { - pub mRawPtr: *mut T, -} -pub enum Zero { } -pub enum _cairo_surface { } -pub type cairo_surface_t = _cairo_surface; -pub enum _cairo_user_data_key { } -pub type cairo_user_data_key_t = _cairo_user_data_key; -pub type thebes_destroy_func_t = - ::std::option::Option<unsafe extern "C" fn(data: - *mut ::std::os::raw::c_void)>; -/** - * Currently needs to be 'double' for Cairo compatibility. Could - * become 'float', perhaps, in some configurations. - */ -pub type gfxFloat = f64; -/** - * Priority of a line break opportunity. + * Enum defining the mode in which a sheet is to be parsed. This is + * usually, but not always, the same as the cascade level at which the + * sheet will apply (see nsStyleSet.h). Most of the Loader APIs only + * support loading of author sheets. * - * eNoBreak The line has no break opportunities - * eWordWrapBreak The line has a break opportunity only within a word. With - * overflow-wrap|word-wrap: break-word we will break at this point only if - * there are no other break opportunities in the line. - * eNormalBreak The line has a break opportunity determined by the standard - * line-breaking algorithm. + * Author sheets are the normal case: styles embedded in or linked + * from HTML pages. They are also the most restricted. * - * Future expansion: split eNormalBreak into multiple priorities, e.g. - * punctuation break and whitespace break (bug 389710). - * As and when we implement it, text-wrap: unrestricted will - * mean that priorities are ignored and all line-break - * opportunities are equal. + * User sheets can do anything author sheets can do, and also get + * access to a few CSS extensions that are not yet suitable for + * exposure on the public Web, but are very useful for expressing + * user style overrides, such as @-moz-document rules. * - * @see gfxTextRun::BreakAndMeasureText - * @see nsLineLayout::NotifyOptionalBreakPosition + * Agent sheets have access to all author- and user-sheet features + * plus more extensions that are necessary for internal use but, + * again, not yet suitable for exposure on the public Web. Some of + * these are outright unsafe to expose; in particular, incorrect + * styling of anonymous box pseudo-elements can violate layout + * invariants. */ -#[repr(i32)] -#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)] -pub enum gfxBreakPriority { - eNoBreak = 0, - eWordWrapBreak = 1, - eNormalBreak = 2, -} -#[repr(i32)] -#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)] -pub enum gfxSurfaceType { - Image = 0, - PDF = 1, - PS = 2, - Xlib = 3, - Xcb = 4, - Glitz = 5, - Quartz = 6, - Win32 = 7, - BeOS = 8, - DirectFB = 9, - SVG = 10, - OS2 = 11, - Win32Printing = 12, - QuartzImage = 13, - Script = 14, - QPainter = 15, - Recording = 16, - VG = 17, - GL = 18, - DRM = 19, - Tee = 20, - XML = 21, - Skia = 22, - Subsurface = 23, - Max = 24, -} -#[repr(i32)] +#[repr(u32)] #[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)] -pub enum gfxContentType { - COLOR = 4096, - ALPHA = 8192, - COLOR_ALPHA = 12288, - SENTINEL = 65535, +pub enum SheetParsingMode { + eAuthorSheetFeatures = 0, + eUserSheetFeatures = 1, + eAgentSheetFeatures = 2, } +pub type nsLoadFlags = u32; #[repr(C)] #[derive(Debug, Copy)] -pub struct piecewise_construct_t; -impl ::std::clone::Clone for piecewise_construct_t { - fn clone(&self) -> Self { *self } +pub struct nsIRequest { + pub _base: nsISupports, } #[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct pair<_T1, _T2> { - pub first: _T1, - pub second: _T2, +pub struct _vftable_nsIRequest { + pub _base: _vftable_nsISupports, } -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct __make_pair_return_impl<_Tp> { - pub _phantom0: ::std::marker::PhantomData<_Tp>, +#[repr(u32)] +#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)] +pub enum nsIRequest_nsIRequest_h_unnamed_7 { + LOAD_REQUESTMASK = 65535, + LOAD_NORMAL = 0, + LOAD_BACKGROUND = 1, + INHIBIT_PIPELINE = 64, + INHIBIT_CACHING = 128, + INHIBIT_PERSISTENT_CACHING = 256, + LOAD_BYPASS_CACHE = 512, + LOAD_FROM_CACHE = 1024, + VALIDATE_ALWAYS = 2048, + VALIDATE_NEVER = 4096, + VALIDATE_ONCE_PER_SESSION = 8192, + LOAD_ANONYMOUS = 16384, + LOAD_FRESH_CONNECTION = 32768, } +impl ::std::clone::Clone for nsIRequest { + fn clone(&self) -> Self { *self } +} +/** + * A class for holding strong references to handle-managed objects. + * + * This is intended for use with objects like StyleSheetHandle, where + * the handle type is not a pointer but which can still have ->AddRef() + * and ->Release() called on it. + */ #[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct __make_pair_return<_Tp> { - pub _phantom0: ::std::marker::PhantomData<_Tp>, +#[derive(Debug)] +pub struct HandleRefPtr<T> { + pub mHandle: T, } pub type Float = f32; #[repr(i8)] @@ -3121,7 +2970,7 @@ pub type gfxImageFormat = SurfaceFormat; pub struct RectCorner; #[repr(u32)] #[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)] -pub enum RectCorner_Types_h_unnamed_6 { +pub enum RectCorner_Types_h_unnamed_8 { TopLeft = 0, TopRight = 1, BottomRight = 2, @@ -3240,6 +3089,266 @@ fn bindgen_test_layout_nsRect() { assert_eq!(::std::mem::size_of::<nsRect>() , 16usize); assert_eq!(::std::mem::align_of::<nsRect>() , 4usize); } +pub enum AnimationEffectReadOnly { } +pub enum AnimationEffectReadOnlyAtoms { } +pub enum AnimationEffectTimingPropertiesAtoms { } +pub enum ComputedTimingPropertiesAtoms { } +#[repr(i32)] +#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)] +pub enum FillMode { + None = 0, + Forwards = 1, + Backwards = 2, + Both = 3, + Auto = 4, + EndGuard_ = 5, +} +#[repr(i32)] +#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)] +pub enum PlaybackDirection { + Normal = 0, + Reverse = 1, + Alternate = 2, + Alternate_reverse = 3, + EndGuard_ = 4, +} +pub type NativeType = AnimationEffectReadOnly; +pub enum ErrorReporter { } +#[repr(u32)] +#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)] +pub enum nsCSSTokenType { + eCSSToken_Whitespace = 0, + eCSSToken_Comment = 1, + eCSSToken_Ident = 2, + eCSSToken_Function = 3, + eCSSToken_AtKeyword = 4, + eCSSToken_ID = 5, + eCSSToken_Hash = 6, + eCSSToken_Number = 7, + eCSSToken_Dimension = 8, + eCSSToken_Percentage = 9, + eCSSToken_String = 10, + eCSSToken_Bad_String = 11, + eCSSToken_URL = 12, + eCSSToken_Bad_URL = 13, + eCSSToken_Symbol = 14, + eCSSToken_Includes = 15, + eCSSToken_Dashmatch = 16, + eCSSToken_Beginsmatch = 17, + eCSSToken_Endsmatch = 18, + eCSSToken_Containsmatch = 19, + eCSSToken_URange = 20, + eCSSToken_HTMLComment = 21, +} +#[repr(u32)] +#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)] +pub enum nsCSSTokenSerializationType { + eCSSTokenSerialization_Nothing = 0, + eCSSTokenSerialization_Whitespace = 1, + eCSSTokenSerialization_AtKeyword_or_Hash = 2, + eCSSTokenSerialization_Number = 3, + eCSSTokenSerialization_Dimension = 4, + eCSSTokenSerialization_Percentage = 5, + eCSSTokenSerialization_URange = 6, + eCSSTokenSerialization_URL_or_BadURL = 7, + eCSSTokenSerialization_Function = 8, + eCSSTokenSerialization_Ident = 9, + eCSSTokenSerialization_CDC = 10, + eCSSTokenSerialization_DashMatch = 11, + eCSSTokenSerialization_ContainsMatch = 12, + eCSSTokenSerialization_Symbol_Hash = 13, + eCSSTokenSerialization_Symbol_At = 14, + eCSSTokenSerialization_Symbol_Dot_or_Plus = 15, + eCSSTokenSerialization_Symbol_Minus = 16, + eCSSTokenSerialization_Symbol_OpenParen = 17, + eCSSTokenSerialization_Symbol_Question = 18, + eCSSTokenSerialization_Symbol_Assorted = 19, + eCSSTokenSerialization_Symbol_Equals = 20, + eCSSTokenSerialization_Symbol_Bar = 21, + eCSSTokenSerialization_Symbol_Slash = 22, + eCSSTokenSerialization_Symbol_Asterisk = 23, + eCSSTokenSerialization_Other = 24, +} +#[repr(C)] +pub struct nsCSSToken { + pub mIdent: nsAutoString, + pub mNumber: f32, + pub mInteger: i32, + pub mInteger2: i32, + pub mType: nsCSSTokenType, + pub mSymbol: ::std::os::raw::c_ushort, + pub mIntegerValid: bool, + pub mHasSign: bool, +} +#[test] +fn bindgen_test_layout_nsCSSToken() { + assert_eq!(::std::mem::size_of::<nsCSSToken>() , 184usize); + assert_eq!(::std::mem::align_of::<nsCSSToken>() , 8usize); +} +#[repr(C)] +#[derive(Debug, Copy)] +pub struct nsCSSScannerPosition { + pub mOffset: u32, + pub mLineNumber: u32, + pub mLineOffset: u32, + pub mTokenLineNumber: u32, + pub mTokenLineOffset: u32, + pub mTokenOffset: u32, + pub mInitialized: bool, +} +impl ::std::clone::Clone for nsCSSScannerPosition { + fn clone(&self) -> Self { *self } +} +#[test] +fn bindgen_test_layout_nsCSSScannerPosition() { + assert_eq!(::std::mem::size_of::<nsCSSScannerPosition>() , 28usize); + assert_eq!(::std::mem::align_of::<nsCSSScannerPosition>() , 4usize); +} +#[repr(u32)] +#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)] +pub enum nsCSSScannerExclude { + eCSSScannerExclude_None = 0, + eCSSScannerExclude_Comments = 1, + eCSSScannerExclude_WhitespaceAndComments = 2, +} +#[repr(C)] +#[derive(Debug)] +pub struct nsCSSScanner { + pub mBuffer: *const ::std::os::raw::c_ushort, + pub mOffset: u32, + pub mCount: u32, + pub mLineNumber: u32, + pub mLineOffset: u32, + pub mTokenLineNumber: u32, + pub mTokenLineOffset: u32, + pub mTokenOffset: u32, + pub mRecordStartOffset: u32, + pub mEOFCharacters: nsCSSScanner_EOFCharacters, + pub mReporter: *mut ErrorReporter, + pub mSVGMode: bool, + pub mRecording: bool, + pub mSeenBadToken: bool, + pub mSeenVariableReference: bool, +} +#[repr(u32)] +#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)] +pub enum nsCSSScanner_EOFCharacters { + eEOFCharacters_None = 0, + eEOFCharacters_DropBackslash = 1, + eEOFCharacters_ReplacementChar = 2, + eEOFCharacters_Asterisk = 4, + eEOFCharacters_Slash = 8, + eEOFCharacters_DoubleQuote = 16, + eEOFCharacters_SingleQuote = 32, + eEOFCharacters_CloseParen = 64, +} +#[test] +fn bindgen_test_layout_nsCSSScanner() { + assert_eq!(::std::mem::size_of::<nsCSSScanner>() , 64usize); + assert_eq!(::std::mem::align_of::<nsCSSScanner>() , 8usize); +} +#[repr(C)] +pub struct nsCSSGridTemplateAreaToken { + pub mName: nsAutoString, + pub isTrash: bool, +} +#[test] +fn bindgen_test_layout_nsCSSGridTemplateAreaToken() { + assert_eq!(::std::mem::size_of::<nsCSSGridTemplateAreaToken>() , + 168usize); + assert_eq!(::std::mem::align_of::<nsCSSGridTemplateAreaToken>() , 8usize); +} +#[repr(C)] +#[derive(Debug, Copy)] +pub struct nsCSSGridTemplateAreaScanner { + pub mBuffer: *const ::std::os::raw::c_ushort, + pub mOffset: u32, + pub mCount: u32, +} +impl ::std::clone::Clone for nsCSSGridTemplateAreaScanner { + fn clone(&self) -> Self { *self } +} +#[test] +fn bindgen_test_layout_nsCSSGridTemplateAreaScanner() { + assert_eq!(::std::mem::size_of::<nsCSSGridTemplateAreaScanner>() , + 16usize); + assert_eq!(::std::mem::align_of::<nsCSSGridTemplateAreaScanner>() , + 8usize); +} +pub enum CSSVariableResolver { } +#[repr(C)] +pub struct CSSVariableValues { + pub mVariableIDs: [u64; 5usize], + /** + * Array of variables, indexed by variable ID. + */ + pub mVariables: nsTArray<CSSVariableValues_Variable>, +} +#[repr(C)] +#[derive(Debug)] +pub struct CSSVariableValues_Variable { + pub mVariableName: nsString, + pub mValue: nsString, + pub mFirstToken: nsCSSTokenSerializationType, + pub mLastToken: nsCSSTokenSerializationType, +} +#[test] +fn bindgen_test_layout_CSSVariableValues_Variable() { + assert_eq!(::std::mem::size_of::<CSSVariableValues_Variable>() , 40usize); + assert_eq!(::std::mem::align_of::<CSSVariableValues_Variable>() , 8usize); +} +#[test] +fn bindgen_test_layout_CSSVariableValues() { + assert_eq!(::std::mem::size_of::<CSSVariableValues>() , 48usize); + assert_eq!(::std::mem::align_of::<CSSVariableValues>() , 8usize); +} +#[repr(i8)] +#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)] +pub enum SheetType { + Agent = 0, + User = 1, + PresHint = 2, + SVGAttrAnimation = 3, + Doc = 4, + ScopedDoc = 5, + StyleAttr = 6, + Override = 7, + Animation = 8, + Transition = 9, + Count = 10, + Unknown = -1, +} +/** + * StaticAutoPtr and StaticRefPtr are like nsAutoPtr and nsRefPtr, except they + * are suitable for use as global variables. + * + * In particular, a global instance of Static{Auto,Ref}Ptr doesn't cause the + * compiler to emit a static initializer (in release builds, anyway). + * + * In order to accomplish this, Static{Auto,Ref}Ptr must have a trivial + * constructor and destructor. As a consequence, it cannot initialize its raw + * pointer to 0 on construction, and it cannot delete/release its raw pointer + * upon destruction. + * + * Since the compiler guarantees that all global variables are initialized to + * 0, these trivial constructors are safe. Since we rely on this, the clang + * plugin, run as part of our "static analysis" builds, makes it a compile-time + * error to use Static{Auto,Ref}Ptr as anything except a global variable. + * + * Static{Auto,Ref}Ptr have a limited interface as compared to ns{Auto,Ref}Ptr; + * this is intentional, since their range of acceptable uses is smaller. + */ +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct StaticAutoPtr<T> { + pub mRawPtr: *mut T, +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct StaticRefPtr<T> { + pub mRawPtr: *mut T, +} +pub enum Zero { } pub const eFamily_generic_first: FontFamilyType = FontFamilyType::eFamily_serif; pub const eFamily_generic_last: FontFamilyType = @@ -3372,47 +3481,6 @@ fn bindgen_test_layout_nsFont() { #[repr(i8)] #[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)] pub enum StyleBoxSizing { Content = 0, Border = 1, } -#[repr(i32)] -#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)] -pub enum PlaybackDirection { _BindgenOpaqueEnum = 0, } -#[repr(i32)] -#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)] -pub enum FillMode { _BindgenOpaqueEnum = 0, } -pub enum nsIContentSecurityPolicy { } -pub enum nsIDOMDocument { } -#[repr(C)] -pub struct nsIPrincipal { - pub _bindgen_opaque_blob: u64, -} -#[test] -fn bindgen_test_layout_nsIPrincipal() { - assert_eq!(::std::mem::size_of::<nsIPrincipal>() , 8usize); - assert_eq!(::std::mem::align_of::<nsIPrincipal>() , 8usize); -} -#[repr(C)] -#[derive(Debug, Copy)] -pub struct nsIExpandedPrincipal { - pub _base: nsISupports, -} -#[repr(C)] -pub struct _vftable_nsIExpandedPrincipal { - pub _base: _vftable_nsISupports, -} -impl ::std::clone::Clone for nsIExpandedPrincipal { - fn clone(&self) -> Self { *self } -} -#[repr(C)] -#[derive(Debug, Copy)] -pub struct nsIURI { - pub _base: nsISupports, -} -#[repr(C)] -pub struct _vftable_nsIURI { - pub _base: _vftable_nsISupports, -} -impl ::std::clone::Clone for nsIURI { - fn clone(&self) -> Self { *self } -} pub const eCSSProperty_COUNT_DUMMY: nsCSSProperty = nsCSSProperty::eCSSProperty_z_index; pub const eCSSProperty_all: nsCSSProperty = @@ -3973,26 +4041,6 @@ pub struct nsMainThreadPtrHolder<T> { pub struct nsMainThreadPtrHandle<T> { pub mPtr: RefPtr<T>, } -/** - * 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)] -#[derive(Debug)] -pub struct nsStringBuffer { - pub mRefCount: u32, - pub mStorageSize: u32, -} -#[test] -fn bindgen_test_layout_nsStringBuffer() { - assert_eq!(::std::mem::size_of::<nsStringBuffer>() , 8usize); - assert_eq!(::std::mem::align_of::<nsStringBuffer>() , 4usize); -} pub enum CSSStyleSheet { } #[repr(C)] pub struct URLValueData { @@ -4153,14 +4201,14 @@ pub enum nsCSSUnit { #[derive(Debug)] pub struct nsCSSValue { pub mUnit: nsCSSUnit, - pub mValue: nsCSSValue_nsCSSValue_h_unnamed_9, + pub mValue: nsCSSValue_nsCSSValue_h_unnamed_10, } #[repr(u32)] #[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)] pub enum nsCSSValue_Serialization { eNormalized = 0, eAuthorSpecified = 1, } #[repr(C)] #[derive(Debug, Copy)] -pub struct nsCSSValue_nsCSSValue_h_unnamed_9 { +pub struct nsCSSValue_nsCSSValue_h_unnamed_10 { pub mInt: __BindgenUnionField<i32>, pub mFloat: __BindgenUnionField<f32>, pub mString: __BindgenUnionField<*mut nsStringBuffer>, @@ -4183,15 +4231,15 @@ pub struct nsCSSValue_nsCSSValue_h_unnamed_9 { pub mFontFamilyList: __BindgenUnionField<*mut FontFamilyListRefCnt>, pub _bindgen_data_: u64, } -impl nsCSSValue_nsCSSValue_h_unnamed_9 { } -impl ::std::clone::Clone for nsCSSValue_nsCSSValue_h_unnamed_9 { +impl nsCSSValue_nsCSSValue_h_unnamed_10 { } +impl ::std::clone::Clone for nsCSSValue_nsCSSValue_h_unnamed_10 { fn clone(&self) -> Self { *self } } #[test] -fn bindgen_test_layout_nsCSSValue_nsCSSValue_h_unnamed_9() { - assert_eq!(::std::mem::size_of::<nsCSSValue_nsCSSValue_h_unnamed_9>() , +fn bindgen_test_layout_nsCSSValue_nsCSSValue_h_unnamed_10() { + assert_eq!(::std::mem::size_of::<nsCSSValue_nsCSSValue_h_unnamed_10>() , 8usize); - assert_eq!(::std::mem::align_of::<nsCSSValue_nsCSSValue_h_unnamed_9>() , + assert_eq!(::std::mem::align_of::<nsCSSValue_nsCSSValue_h_unnamed_10>() , 8usize); } #[test] @@ -4480,125 +4528,6 @@ fn bindgen_test_layout_CounterStyleManager() { assert_eq!(::std::mem::align_of::<CounterStyleManager>() , 8usize); } /** - * Enum defining the mode in which a sheet is to be parsed. This is - * usually, but not always, the same as the cascade level at which the - * sheet will apply (see nsStyleSet.h). Most of the Loader APIs only - * support loading of author sheets. - * - * Author sheets are the normal case: styles embedded in or linked - * from HTML pages. They are also the most restricted. - * - * User sheets can do anything author sheets can do, and also get - * access to a few CSS extensions that are not yet suitable for - * exposure on the public Web, but are very useful for expressing - * user style overrides, such as @-moz-document rules. - * - * Agent sheets have access to all author- and user-sheet features - * plus more extensions that are necessary for internal use but, - * again, not yet suitable for exposure on the public Web. Some of - * these are outright unsafe to expose; in particular, incorrect - * styling of anonymous box pseudo-elements can violate layout - * invariants. - */ -#[repr(u32)] -#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)] -pub enum SheetParsingMode { - eAuthorSheetFeatures = 0, - eUserSheetFeatures = 1, - eAgentSheetFeatures = 2, -} -pub type nsLoadFlags = u32; -#[repr(C)] -#[derive(Debug, Copy)] -pub struct nsIRequest { - pub _base: nsISupports, -} -#[repr(C)] -pub struct _vftable_nsIRequest { - pub _base: _vftable_nsISupports, -} -#[repr(u32)] -#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)] -pub enum nsIRequest_nsIRequest_h_unnamed_10 { - LOAD_REQUESTMASK = 65535, - LOAD_NORMAL = 0, - LOAD_BACKGROUND = 1, - INHIBIT_PIPELINE = 64, - INHIBIT_CACHING = 128, - INHIBIT_PERSISTENT_CACHING = 256, - LOAD_BYPASS_CACHE = 512, - LOAD_FROM_CACHE = 1024, - VALIDATE_ALWAYS = 2048, - VALIDATE_NEVER = 4096, - VALIDATE_ONCE_PER_SESSION = 8192, - LOAD_ANONYMOUS = 16384, - LOAD_FRESH_CONNECTION = 32768, -} -impl ::std::clone::Clone for nsIRequest { - fn clone(&self) -> Self { *self } -} -#[repr(C)] -#[derive(Debug, Copy)] -pub struct nsIAtom { - pub _base: nsISupports, - pub _bitfield_1: u32, - pub mHash: u32, - /** - * WARNING! There is an invisible constraint on |mString|: the chars it - * points to must belong to an nsStringBuffer. This is so that the - * nsStringBuffer::FromData() calls above are valid. - */ - pub mString: *mut ::std::os::raw::c_ushort, -} -#[repr(C)] -pub struct _vftable_nsIAtom { - pub _base: _vftable_nsISupports, -} -impl ::std::clone::Clone for nsIAtom { - fn clone(&self) -> Self { *self } -} -#[test] -fn bindgen_test_layout_nsIAtom() { - assert_eq!(::std::mem::size_of::<nsIAtom>() , 24usize); - assert_eq!(::std::mem::align_of::<nsIAtom>() , 8usize); -} -#[repr(C)] -#[derive(Debug)] -pub struct nsAtomString { - pub _base: nsString, -} -#[test] -fn bindgen_test_layout_nsAtomString() { - assert_eq!(::std::mem::size_of::<nsAtomString>() , 16usize); - assert_eq!(::std::mem::align_of::<nsAtomString>() , 8usize); -} -#[repr(C)] -#[derive(Debug)] -pub struct nsAtomCString { - pub _base: nsCString, -} -#[test] -fn bindgen_test_layout_nsAtomCString() { - assert_eq!(::std::mem::size_of::<nsAtomCString>() , 16usize); - assert_eq!(::std::mem::align_of::<nsAtomCString>() , 8usize); -} -#[repr(C)] -pub struct nsDependentAtomString { - pub _base: [u64; 2usize], -} -/** - * A class for holding strong references to handle-managed objects. - * - * This is intended for use with objects like StyleSheetHandle, where - * the handle type is not a pointer but which can still have ->AddRef() - * and ->Release() called on it. - */ -#[repr(C)] -#[derive(Debug)] -pub struct HandleRefPtr<T> { - pub mHandle: T, -} -/** * A class for holding strong references to nsPresArena-allocated * objects. * diff --git a/ports/geckolib/gecko_bindings/tools/regen.py b/ports/geckolib/gecko_bindings/tools/regen.py new file mode 100755 index 00000000000..d252edda447 --- /dev/null +++ b/ports/geckolib/gecko_bindings/tools/regen.py @@ -0,0 +1,385 @@ +#!/usr/bin/env python + +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +from __future__ import print_function +import os +import sys +import argparse +import platform +import copy +import subprocess +import tempfile + +DESCRIPTION = 'Regenerate the rust version of the structs or the bindings file.' +TOOLS_DIR = os.path.dirname(os.path.abspath(__file__)) +COMMON_BUILD_KEY = "__common__" + +COMPILATION_TARGETS = { + # Flags common for all the targets. + COMMON_BUILD_KEY: { + "flags": [ + "-x", "c++", "-std=gnu++0x", + "-allow-unknown-types", "-no-bitfield-methods", + "-no-type-renaming", "-no-namespaced-constants", + "-DTRACING=1", "-DIMPL_LIBXUL", "-DMOZ_STYLO_BINDINGS=1", + "-DMOZILLA_INTERNAL_API", + ], + "search_dirs": [ + "{}/dist/include", + "{}/dist/include/nspr", + "{}/../nsprpub/pr/include" + ], + "includes": [ + "{}/mozilla-config.h", + ], + }, + # Generation of style structs. + "structs": { + "test": True, + "flags": [ + "-ignore-functions", + ], + "includes": [ + "{}/dist/include/nsThemeConstants.h", + "{}/dist/include/mozilla/dom/AnimationEffectReadOnlyBinding.h", + ], + "files": [ + "{}/dist/include/nsStyleStruct.h", + ], + "build_kinds": { + "debug": { + "flags": [ + "-DDEBUG=1", + "-DJS_DEBUG=1", + ] + }, + "release": { + } + }, + "match_headers": [ + "RefCountType.h", "nscore.h", "nsError.h", "nsID.h", "nsString", + "nsAString", "nsSubstring", "nsTSubstring", "nsTString", + "nsISupportsBase.h", "nsCOMPtr.h", "nsIAtom.h", "nsIURI.h", + "nsAutoPtr.h", "nsColor.h", "nsCoord.h", "nsPoint.h", "nsRect.h", + "nsMargin.h", "nsThemeConstants.h", "nsCSSProperty.h", + "CSSVariableValues.h", "nsFont.h", "nsTHashtable.h", + "PLDHashTable.h", "nsColor.h", "nsStyleStruct.h", "nsStyleCoord.h", + "RefPtr.h", "nsISupportsImpl.h", "gfxFontConstants.h", + "gfxFontFamilyList.h", "gfxFontFeatures.h", "imgRequestProxy.h", + "nsIRequest.h", "imgIRequest.h", "CounterStyleManager.h", + "nsStyleConsts.h", "nsCSSValue.h", "SheetType.h", "nsIPrincipal.h", + "nsDataHashtable.h", "nsCSSScanner.h", "utility", "nsTArray", + "pair", "SheetParsingMode.h", "StaticPtr.h", "nsProxyRelease.h", + "mozilla/dom/AnimationEffectReadOnlyBinding.h", + "/Types.h", # <- Disallow UnionTypes.h + ], + "blacklist": [ + "IsDestructibleFallbackImpl", "IsDestructibleFallback", + "nsProxyReleaseEvent", "FallibleTArray", "nsTArray_Impl", + "__is_tuple_like_impl", "tuple_size", "tuple", + "__make_pair_return_impl", "__make_pair_return", "tuple_element", + "_Itup_cat", "AnimationEffectTimingProperties", + "FastAnimationEffectTimingProperties", "ComputedTimingProperties", + "FastComputedTimingProperties", + ], + "opaque_types": [ + "nsIntMargin", "nsIntPoint", "nsIntRect", "nsCOMArray", + "nsDependentString", "EntryStore", "gfxFontFeatureValueSet", + "imgRequestProxy", "imgRequestProxyStatic", "CounterStyleManager", + "ImageValue", "URLValue", "URLValueData", "nsIPrincipal", + "nsDataHashtable", "imgIRequest" + ] + }, + # Generation of the ffi bindings. + "bindings": { + "raw_lines": [ + "use heapsize::HeapSizeOf;", + ], + "match_headers": [ + "ServoBindings.h", + "nsStyleStructList.h", + ], + "files": [ + "{}/dist/include/mozilla/ServoBindings.h", + ], + + # Types to just use from the `structs` target. + "structs_types": [ + "nsStyleFont", "nsStyleColor", "nsStyleList", "nsStyleText", + "nsStyleVisibility", "nsStyleUserInterface", "nsStyleTableBorder", + "nsStyleSVG", "nsStyleVariables", "nsStyleBackground", + "nsStylePosition", "nsStyleTextReset", "nsStyleDisplay", + "nsStyleContent", "nsStyleUIReset", "nsStyleTable", + "nsStyleMargin", "nsStylePadding", "nsStyleBorder", + "nsStyleOutline", "nsStyleXUL", "nsStyleSVGReset", "nsStyleColumn", + "nsStyleEffects", "nsStyleImage", "nsStyleGradient", + "nsStyleCoord", "nsStyleGradientStop", + + "SheetParsingMode", "nsMainThreadPtrHandle", + "nsMainThreadPtrHolder", "nscolor", "nsFont", "FontFamilyList", + "FontFamilyType", "nsIAtom", + ], + } +} + + +def platform_dependent_defines(): + ret = [] + + if os.name == "posix": + ret.append("-DOS_POSIX=1") + + ret.append({ + "Linux": "-DOS_LINUX=1", + "Darwin": "-DOS_MACOSX=1", + # TODO: Windows? + }[platform.system()]) + + return ret + + +def extend_object(obj, other): + if not obj or not other: + return obj + + if isinstance(obj, list) and isinstance(other, list): + obj.extend(other) + return + + assert isinstance(obj, dict) and isinstance(other, dict) + + for key in other.keys(): + if key in obj: + extend_object(obj[key], other[key]) + else: + obj[key] = copy.deepcopy(other[key]) + + +def build(objdir, target_name, kind_name=None, + output_filename=None, bindgen=None, skip_test=False, + verbose=False): + assert target_name in COMPILATION_TARGETS + + current_target = COMPILATION_TARGETS[target_name] + if COMMON_BUILD_KEY in COMPILATION_TARGETS: + current_target = copy.deepcopy(COMPILATION_TARGETS[COMMON_BUILD_KEY]) + extend_object(current_target, COMPILATION_TARGETS[target_name]) + + assert ((kind_name is None and "build_kinds" not in current_target) or + (kind_name in current_target["build_kinds"])) + + if bindgen is None: + bindgen = "{}/rust-bindgen/target/debug/bindgen".format(TOOLS_DIR) + + if output_filename is None: + filename = "{}.rs".format(target_name) + + if kind_name is not None: + filename = "{}_{}.rs".format(target_name, kind_name) + + output_filename = "{}/../{}".format(TOOLS_DIR, filename) + + if kind_name is not None: + current_target = copy.deepcopy(current_target) + extend_object(current_target, current_target["build_kinds"][kind_name]) + + print("[BINDGEN] {}::{} in \"{}\"... ".format(target_name, kind_name, objdir), end='') + sys.stdout.flush() + + flags = [] + flags.extend(platform_dependent_defines()) + + if "flags" in current_target: + flags.extend(current_target["flags"]) + + if "raw_lines" in current_target: + for raw_line in current_target["raw_lines"]: + flags.append("-raw-line") + flags.append(raw_line) + + if "search_dirs" in current_target: + for dir_name in current_target["search_dirs"]: + flags.append("-I") + flags.append(dir_name.format(objdir)) + + if "includes" in current_target: + for file_name in current_target["includes"]: + flags.append("-include") + flags.append(file_name.format(objdir)) + + if "match_headers" in current_target: + for header in current_target["match_headers"]: + flags.append("-match") + flags.append(header.format(objdir)) + + if "blacklist" in current_target: + for ty in current_target["blacklist"]: + flags.append("-blacklist-type") + flags.append(ty) + + if "opaque_types" in current_target: + for ty in current_target["opaque_types"]: + flags.append("-opaque-type") + flags.append(ty) + + if "structs_types" in current_target: + for ty in current_target["structs_types"]: + flags.append("-blacklist-type") + flags.append(ty) + flags.append("-raw-line") + flags.append("use structs::{};".format(ty)) + # TODO: this is hacky, figure out a better way to do it without + # hardcoding everything... + if ty.startswith("nsStyle"): + flags.extend([ + "-raw-line", + "unsafe impl Send for {} {{}}".format(ty), + "-raw-line", + "unsafe impl Sync for {} {{}}".format(ty), + "-raw-line", + "impl HeapSizeOf for {} {{ fn heap_size_of_children(&self) -> usize {{ 0 }} }}".format(ty) + ]) + + flags.append("-o") + flags.append(output_filename) + + # TODO: support more files, that's the whole point of this. + assert len(current_target["files"]) == 1 + flags.append(current_target["files"][0].format(objdir)) + + flags.insert(0, bindgen) + output = None + try: + output = subprocess.check_output(flags, stderr=subprocess.STDOUT) + output = output.decode('utf8') + except subprocess.CalledProcessError as e: + print("FAIL\n", e.output.decode('utf8')) + return 1 + + print("OK") + + if verbose: + print(output) + + if current_target.get("test", False) and not skip_test: + print("[RUSTC]... ", end='') + sys.stdout.flush() + + tests_file = tempfile.NamedTemporaryFile() + output = None + try: + rustc_command = ["rustc", output_filename, "--test", "-o", tests_file.name] + output = subprocess.check_output(rustc_command, stderr=subprocess.STDOUT) + output = output.decode('utf8') + except subprocess.CalledProcessError as e: + print("FAIL\n", e.output.decode('utf8')) + return 1 + + print("OK") + + if verbose: + print(output) + + tests_file.file.close() + print("[RUSTC_TEST]... ", end='') + sys.stdout.flush() + + try: + output = subprocess.check_output([tests_file.name], stderr=subprocess.STDOUT) + output = output.decode('utf8') + except subprocess.CalledProcessError as e: + print("tests failed: ", e.output.decode('utf8')) + return 1 + + print("OK") + + # TODO: this -3 is hacky as heck + print(output.split('\n')[-3]) + + if verbose: + print(output) + + return 0 + + +def builds_for(target_name, kind): + if target_name == "all": + for target in COMPILATION_TARGETS.keys(): + if target == COMMON_BUILD_KEY: + continue + + if "build_kinds" in COMPILATION_TARGETS[target]: + for kind in COMPILATION_TARGETS[target]["build_kinds"].keys(): + yield (target, kind) + else: + yield (target, None) + return + + target = COMPILATION_TARGETS[target_name] + if "build_kinds" in target: + if kind is None: + for kind in target["build_kinds"].keys(): + yield(target_name, kind) + else: + yield (target_name, kind) + return + + yield (target_name, None) + + +def main(): + parser = argparse.ArgumentParser(description=DESCRIPTION) + parser.add_argument('--target', + help='The target to build, either "structs" or "bindings"') + parser.add_argument('--kind', + help='Kind of build') + parser.add_argument('--bindgen', + help='Override bindgen binary') + parser.add_argument('--output', '-o', + help='Output of the script') + parser.add_argument('--skip-test', + action='store_true', + help='Skip automatic tests, useful for debugging') + parser.add_argument('--verbose', '-v', + action='store_true', + help='Be... verbose') + parser.add_argument('objdir') + + args = parser.parse_args() + + if not os.path.isdir(args.objdir): + print("\"{}\" doesn't seem to be a directory".format(args.objdir)) + return 1 + + if args.target != COMMON_BUILD_KEY and args.target != "all" and args.target not in COMPILATION_TARGETS: + print("{} is not a valid compilation target.".format(args.target)) + print("Valid compilation targets are:") + for target in COMPILATION_TARGETS.keys(): + if target != COMMON_BUILD_KEY: + print("\t * {}".format(target)) + return 1 + + current_target = COMPILATION_TARGETS.get(args.target, {}) + if args.kind and "build_kinds" in current_target and args.kind not in current_target["build_kinds"]: + print("{} is not a valid build kind.".format(args.kind)) + print("Valid build kinds are:") + for kind in current_target["build_kinds"].keys(): + print("\t * {}".format(kind)) + return 1 + + for target, kind in builds_for(args.target, args.kind): + ret = build(args.objdir, target, kind, + bindgen=args.bindgen, skip_test=args.skip_test, + output_filename=args.output, + verbose=args.verbose) + if ret != 0: + print("{}::{} failed".format(target, kind)) + return ret + + return 0 + +if __name__ == '__main__': + sys.exit(main()) diff --git a/ports/geckolib/gecko_bindings/tools/regen.sh b/ports/geckolib/gecko_bindings/tools/regen.sh new file mode 100755 index 00000000000..ffdf99688f1 --- /dev/null +++ b/ports/geckolib/gecko_bindings/tools/regen.sh @@ -0,0 +1,26 @@ +#!/bin/bash + +if [ $# -eq 0 ]; then + echo "Usage: $0 /path/to/gecko/objdir [other-regen.py-flags]" + exit 1 +fi + +# Check for rust-bindgen +if [ ! -d rust-bindgen ]; then + echo "rust-bindgen not found. Run setup_bindgen.sh first." + exit 1 +fi + +# Check for /usr/include +if [ ! -d /usr/include ]; then + echo "/usr/include doesn't exist. Mac users may need to run xcode-select --install." + exit 1 +fi + +if [ "$(uname)" == "Linux" ]; then + LIBCLANG_PATH=/usr/lib/llvm-3.8/lib; +else + LIBCLANG_PATH=`brew --prefix llvm38`/lib/llvm-3.8/lib; +fi + +./regen.py --target all "$@" diff --git a/ports/geckolib/gecko_bindings/tools/regen_bindings.sh b/ports/geckolib/gecko_bindings/tools/regen_bindings.sh deleted file mode 100755 index 73da1e1399c..00000000000 --- a/ports/geckolib/gecko_bindings/tools/regen_bindings.sh +++ /dev/null @@ -1,94 +0,0 @@ -#!/bin/bash - -# Run in the tools directory. -cd "$(dirname $0)" - -if [ $# -ne 1 ]; then - echo "Usage: $0 /path/to/gecko/objdir" - exit 1 -fi - -# Check for rust-bindgen -if [ ! -d rust-bindgen ]; then - echo "rust-bindgen not found. Run setup_bindgen.sh first." - exit 1 -fi - -# Check for /usr/include -if [ ! -d /usr/include ]; then - echo "/usr/include doesn't exist. Mac users may need to run xcode-select --install." - exit 1 -fi - -if [ "$(uname)" == "Linux" ]; then - PLATFORM_DEPENDENT_DEFINES+="-DOS_LINUX"; - LIBCLANG_PATH=/usr/lib/llvm-3.8/lib; -else - PLATFORM_DEPENDENT_DEFINES+="-DOS_MACOSX"; - LIBCLANG_PATH=`brew --prefix llvm38`/lib/llvm-3.8/lib; -fi - -# Prevent bindgen from generating opaque types for common gecko types. -export MAP_GECKO_TYPES="" - -# Extra code we want to generate. -export EXTRA_CODE="-raw-line 'use heapsize::HeapSizeOf;' " - -# Style structs. -for STRUCT in nsStyleFont nsStyleColor nsStyleList nsStyleText \ - nsStyleVisibility nsStyleUserInterface nsStyleTableBorder \ - nsStyleSVG nsStyleVariables nsStyleBackground nsStylePosition \ - nsStyleTextReset nsStyleDisplay nsStyleContent nsStyleUIReset \ - nsStyleTable nsStyleMargin nsStylePadding nsStyleBorder \ - nsStyleOutline nsStyleXUL nsStyleSVGReset nsStyleColumn nsStyleEffects \ - nsStyleImage nsStyleGradient nsStyleCoord nsStyleGradientStop -do - MAP_GECKO_TYPES=$MAP_GECKO_TYPES"-blacklist-type $STRUCT " - MAP_GECKO_TYPES=$MAP_GECKO_TYPES"-raw-line 'use structs::$STRUCT;' " - EXTRA_CODE=$EXTRA_CODE"-raw-line 'unsafe impl Send for $STRUCT {}' " - EXTRA_CODE=$EXTRA_CODE"-raw-line 'unsafe impl Sync for $STRUCT {}' " - EXTRA_CODE=$EXTRA_CODE"-raw-line 'impl HeapSizeOf for $STRUCT { fn heap_size_of_children(&self) -> usize { 0 } }' " -done - -# Other mapped types. -for TYPE in SheetParsingMode nsMainThreadPtrHandle nsMainThreadPtrHolder nscolor nsFont \ - FontFamilyList FontFamilyType nsIAtom -do - MAP_GECKO_TYPES=$MAP_GECKO_TYPES"-blacklist-type $TYPE " - MAP_GECKO_TYPES=$MAP_GECKO_TYPES"-raw-line 'use structs::$TYPE;' " -done - - - -# Check for the include directory. -export OBJDIR="$1" -export SRCDIR="$1/.." # Not necessarily true, but let's assume. -export DIST_INCLUDE="$1/dist/include" -if [ ! -d "$DIST_INCLUDE" ]; then - echo "$DIST_INCLUDE: directory not found" - exit 1 -fi - -export RUST_BACKTRACE=1 - -# We need to use 'eval' here to make MAP_GECKO_TYPES evaluate properly as -# multiple arguments. -eval ./rust-bindgen/target/debug/bindgen \ - -x c++ -std=gnu++0x \ - "-I$DIST_INCLUDE" \ - "-I$DIST_INCLUDE/nspr/" \ - "-I$1/nsprpub/pr/include/" \ - $PLATFORM_DEPENDENT_DEFINES \ - -DMOZILLA_INTERNAL_API \ - -DMOZ_STYLO_BINDINGS=1 \ - -DJS_DEBUG=1 \ - -DDEBUG=1 -DTRACING=1 -DOS_POSIX=1 \ - -DIMPL_LIBXUL \ - -o ../bindings.rs \ - -no-type-renaming \ - -include "$1/mozilla-config.h" \ - "$DIST_INCLUDE/mozilla/ServoBindings.h" \ - -match "ServoBindings.h" \ - -match "nsStyleStructList.h" \ - $MAP_GECKO_TYPES \ - $EXTRA_CODE diff --git a/ports/geckolib/gecko_bindings/tools/regen_style_structs.sh b/ports/geckolib/gecko_bindings/tools/regen_style_structs.sh deleted file mode 100755 index 3c9adc8147e..00000000000 --- a/ports/geckolib/gecko_bindings/tools/regen_style_structs.sh +++ /dev/null @@ -1,148 +0,0 @@ -#!/bin/bash - -# Run in the tools directory. -cd "$(dirname $0)" - -if [ $# -ne 1 ]; then - echo "Usage: $0 /path/to/gecko/objdir" - exit 1 -fi - -# Check for rust-bindgen -if [ ! -d rust-bindgen ]; then - echo "rust-bindgen not found. Run setup_bindgen.sh first." - exit 1 -fi - -# Check for /usr/include -if [ ! -d /usr/include ]; then - echo "/usr/include doesn't exist. Mac users may need to run xcode-select --install." - exit 1 -fi - -if [ "$(uname)" == "Linux" ]; then - PLATFORM_DEPENDENT_DEFINES+="-DOS_LINUX"; - LIBCLANG_PATH=/usr/lib/llvm-3.8/lib; -else - PLATFORM_DEPENDENT_DEFINES+="-DOS_MACOSX"; - LIBCLANG_PATH=`brew --prefix llvm38`/lib/llvm-3.8/lib; -fi - - -# Check for the include directory. -export DIST_INCLUDE="$1/dist/include" -if [ ! -d "$DIST_INCLUDE" ]; then - echo "$DIST_INCLUDE: directory not found" - exit 1 -fi - -export RUST_BACKTRACE=1 - -for target in debug release; do - ./rust-bindgen/target/debug/bindgen \ - -o ../structs_${target}.rs \ - -x c++ -std=gnu++0x \ - -allow-unknown-types \ - -no-bitfield-methods \ - "-I$DIST_INCLUDE" "-I$DIST_INCLUDE/nspr" \ - "-I$1/../nsprpub/pr/include" \ - $PLATFORM_DEPENDENT_DEFINES \ - -ignore-functions \ - -no-type-renaming \ - -DMOZILLA_INTERNAL_API \ - -DMOZ_STYLO_BINDINGS=1 \ - `[ "$target" = debug ] && echo "-DDEBUG=1 -DJS_DEBUG=1"` \ - -DTRACING=1 -DOS_POSIX=1 \ - -DIMPL_LIBXUL \ - -include "nsThemeConstants.h" \ - -match "RefCountType.h" \ - -match "nscore.h" \ - -match "nsError.h" \ - -match "nsID.h" \ - -match "nsString" \ - -match "nsAString" \ - -match "nsSubstring" \ - -match "nsTSubstring" \ - -match "nsTString" \ - -match "nsISupportsBase.h" \ - -match "nsCOMPtr.h" \ - -match "nsIAtom.h" \ - -match "nsIURI.h" \ - -match "nsAutoPtr.h" \ - -match "nsColor.h" \ - -match "nsCoord.h" \ - -match "nsPoint.h" \ - -match "nsRect.h" \ - -match "nsMargin.h" \ - -match "nsThemeConstants.h" \ - -match "nsCSSProperty.h" \ - -match "CSSVariableValues.h" \ - -match "nsFont.h" \ - -match "nsTHashtable.h" \ - -match "PLDHashTable.h" \ - -match "nsColor.h" \ - -match "nsStyleStruct.h" \ - -match "nsStyleCoord.h" \ - -match "RefPtr.h" \ - -match "nsISupportsImpl.h" \ - -match "gfxFontConstants.h" \ - -match "gfxFontFamilyList.h" \ - -match "gfxFontFeatures.h" \ - -match "imgRequestProxy.h" \ - -match "nsIRequest.h" \ - -match "imgIRequest.h" \ - -match "CounterStyleManager.h" \ - -match "nsStyleConsts.h" \ - -match "nsCSSValue.h" \ - -match "SheetType.h" \ - -match "nsIPrincipal.h" \ - -match "nsDataHashtable.h" \ - -match "nsCSSScanner.h" \ - -match "Types.h" \ - -match "utility" \ - -match "nsTArray" \ - -match "pair" \ - -match "SheetParsingMode.h" \ - -match "StaticPtr.h" \ - -match "nsProxyRelease.h" \ - -blacklist-type "IsDestructibleFallbackImpl" \ - -blacklist-type "IsDestructibleFallback" \ - -blacklist-type "nsProxyReleaseEvent" \ - -blacklist-type "FallibleTArray" \ - -blacklist-type "nsTArray_Impl" \ - -blacklist-type "__is_tuple_like_impl" \ - -opaque-type "nsIntMargin" \ - -opaque-type "nsIntPoint" \ - -opaque-type "nsIntRect" \ - -opaque-type "nsCOMArray" \ - -opaque-type "nsDependentString" \ - -opaque-type "EntryStore" \ - -opaque-type "gfxFontFeatureValueSet" \ - -opaque-type "imgRequestProxy" \ - -opaque-type "imgRequestProxyStatic" \ - -opaque-type "CounterStyleManager" \ - -opaque-type "ImageValue" \ - -opaque-type "URLValue" \ - -opaque-type "URLValueData" \ - -opaque-type "nsIPrincipal" \ - -opaque-type "nsDataHashtable" \ - -opaque-type "imgIRequest" \ - -include "$1/mozilla-config.h" \ - "$DIST_INCLUDE/nsStyleStruct.h" - if [ $? -ne 0 ]; then - echo -e "\e[91mwarning:\e[0m bindgen exited with nonzero exit status" - exit 1 - fi -done - -echo -e "\e[34minfo:\e[0m bindgen exited successfully, running tests" -TESTS_FILE=$(mktemp) -TESTS_SRC=$(mktemp) -for target in debug release; do - echo "#![feature(const_fn)]" > $TESTS_SRC - cat ../structs_${target}.rs >> $TESTS_SRC - multirust run nightly rustc $TESTS_SRC --test -o $TESTS_FILE - $TESTS_FILE -done -rm $TESTS_FILE -rm $TESTS_SRC diff --git a/python/tidy/servo_tidy/tidy.py b/python/tidy/servo_tidy/tidy.py index 3b1b443eb87..fa0708d403a 100644 --- a/python/tidy/servo_tidy/tidy.py +++ b/python/tidy/servo_tidy/tidy.py @@ -70,8 +70,6 @@ IGNORED_DIRS = [ # Generated and upstream code combined with our own. Could use cleanup os.path.join(".", "target"), os.path.join(".", "ports", "cef"), - # Tooling, generated locally from external repos. - os.path.join(".", "ports", "geckolib", "gecko_bindings", "tools"), # Hidden directories os.path.join(".", "."), ] |