Auto merge of #15580 - emilio:stylo, r=heycam

Bindgenup

Major pain point is that I had to write the bitfield stuff manually, but that
should be resolved soon again.

Now we generate proper layout for _every_ struct, including field offsets \o/.

r? @heycam

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/15580)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2017-02-16 02:58:54 -08:00 committed by GitHub
commit 35e7a4cd2c
8 changed files with 21925 additions and 7876 deletions

View file

@ -66,7 +66,7 @@ kernel32-sys = "0.2"
[build-dependencies]
lazy_static = "0.2"
bindgen = { version = "0.21.1", optional = true }
bindgen = { version = "0.22", optional = true }
phf_codegen = "0.7.20"
regex = {version = "0.2", optional = true}
walkdir = "1.0"

View file

@ -12,6 +12,7 @@ use gecko_bindings::structs::RawServoAnimationValue;
use gecko_bindings::structs::RawServoDeclarationBlock;
use gecko_bindings::structs::RawGeckoPresContext;
use gecko_bindings::structs::RawGeckoPresContextOwned;
use gecko_bindings::structs::RefPtr;
use gecko_bindings::structs::ThreadSafeURIHolder;
use gecko_bindings::structs::ThreadSafePrincipalHolder;
use gecko_bindings::structs::CSSPseudoClassType;
@ -156,7 +157,6 @@ use gecko_bindings::structs::Loader;
use gecko_bindings::structs::ServoStyleSheet;
use gecko_bindings::structs::EffectCompositor_CascadeLevel;
use gecko_bindings::structs::RawServoAnimationValueBorrowedListBorrowed;
use gecko_bindings::structs::RefPtr;
pub type nsTArrayBorrowed_uintptr_t<'a> = &'a mut ::gecko_bindings::structs::nsTArray<usize>;
pub type ServoComputedValuesStrong = ::gecko_bindings::sugar::ownership::Strong<ServoComputedValues>;
pub type ServoComputedValuesBorrowed<'a> = &'a ServoComputedValues;
@ -500,11 +500,13 @@ extern "C" {
-> u32;
}
extern "C" {
pub fn Gecko_GetStyleAttrDeclarationBlock(element: RawGeckoElementBorrowed)
pub fn Gecko_GetStyleAttrDeclarationBlock(element:
RawGeckoElementBorrowed)
-> RawServoDeclarationBlockStrongBorrowedOrNull;
}
extern "C" {
pub fn Gecko_GetHTMLPresentationAttrDeclarationBlock(element: RawGeckoElementBorrowed)
pub fn Gecko_GetHTMLPresentationAttrDeclarationBlock(element:
RawGeckoElementBorrowed)
-> RawServoDeclarationBlockStrongBorrowedOrNull;
}
extern "C" {
@ -1305,8 +1307,10 @@ extern "C" {
-> f32;
}
extern "C" {
pub fn Servo_AnimationValue_GetTransform(value: RawServoAnimationValueBorrowed,
list: &mut RefPtr<nsCSSValueSharedList>);
pub fn Servo_AnimationValue_GetTransform(value:
RawServoAnimationValueBorrowed,
list:
*mut RefPtr<nsCSSValueSharedList>);
}
extern "C" {
pub fn Servo_ParseStyleAttribute(data: *const nsACString_internal)

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1858,8 +1858,12 @@ cfg_if! {
pub static nsGkAtoms_onvoicechange: *mut nsIAtom;
#[link_name = "_ZN9nsGkAtoms15onvoiceschangedE"]
pub static nsGkAtoms_onvoiceschanged: *mut nsIAtom;
#[link_name = "_ZN9nsGkAtoms19onvrdisplayactivateE"]
pub static nsGkAtoms_onvrdisplayactivate: *mut nsIAtom;
#[link_name = "_ZN9nsGkAtoms18onvrdisplayconnectE"]
pub static nsGkAtoms_onvrdisplayconnect: *mut nsIAtom;
#[link_name = "_ZN9nsGkAtoms21onvrdisplaydeactivateE"]
pub static nsGkAtoms_onvrdisplaydeactivate: *mut nsIAtom;
#[link_name = "_ZN9nsGkAtoms21onvrdisplaydisconnectE"]
pub static nsGkAtoms_onvrdisplaydisconnect: *mut nsIAtom;
#[link_name = "_ZN9nsGkAtoms24onvrdisplaypresentchangeE"]
@ -6771,8 +6775,12 @@ cfg_if! {
pub static nsGkAtoms_onvoicechange: *mut nsIAtom;
#[link_name = "?onvoiceschanged@nsGkAtoms@@2PEAVnsIAtom@@EA"]
pub static nsGkAtoms_onvoiceschanged: *mut nsIAtom;
#[link_name = "?onvrdisplayactivate@nsGkAtoms@@2PEAVnsIAtom@@EA"]
pub static nsGkAtoms_onvrdisplayactivate: *mut nsIAtom;
#[link_name = "?onvrdisplayconnect@nsGkAtoms@@2PEAVnsIAtom@@EA"]
pub static nsGkAtoms_onvrdisplayconnect: *mut nsIAtom;
#[link_name = "?onvrdisplaydeactivate@nsGkAtoms@@2PEAVnsIAtom@@EA"]
pub static nsGkAtoms_onvrdisplaydeactivate: *mut nsIAtom;
#[link_name = "?onvrdisplaydisconnect@nsGkAtoms@@2PEAVnsIAtom@@EA"]
pub static nsGkAtoms_onvrdisplaydisconnect: *mut nsIAtom;
#[link_name = "?onvrdisplaypresentchange@nsGkAtoms@@2PEAVnsIAtom@@EA"]
@ -11684,8 +11692,12 @@ cfg_if! {
pub static nsGkAtoms_onvoicechange: *mut nsIAtom;
#[link_name = "\x01?onvoiceschanged@nsGkAtoms@@2PAVnsIAtom@@A"]
pub static nsGkAtoms_onvoiceschanged: *mut nsIAtom;
#[link_name = "\x01?onvrdisplayactivate@nsGkAtoms@@2PAVnsIAtom@@A"]
pub static nsGkAtoms_onvrdisplayactivate: *mut nsIAtom;
#[link_name = "\x01?onvrdisplayconnect@nsGkAtoms@@2PAVnsIAtom@@A"]
pub static nsGkAtoms_onvrdisplayconnect: *mut nsIAtom;
#[link_name = "\x01?onvrdisplaydeactivate@nsGkAtoms@@2PAVnsIAtom@@A"]
pub static nsGkAtoms_onvrdisplaydeactivate: *mut nsIAtom;
#[link_name = "\x01?onvrdisplaydisconnect@nsGkAtoms@@2PAVnsIAtom@@A"]
pub static nsGkAtoms_onvrdisplaydisconnect: *mut nsIAtom;
#[link_name = "\x01?onvrdisplaypresentchange@nsGkAtoms@@2PAVnsIAtom@@A"]
@ -16600,8 +16612,12 @@ macro_rules! atom {
{ unsafe { $crate::string_cache::atom_macro::atom_from_static($crate::string_cache::atom_macro::nsGkAtoms_onvoicechange as *mut _) } };
("onvoiceschanged") =>
{ unsafe { $crate::string_cache::atom_macro::atom_from_static($crate::string_cache::atom_macro::nsGkAtoms_onvoiceschanged as *mut _) } };
("onvrdisplayactivate") =>
{ unsafe { $crate::string_cache::atom_macro::atom_from_static($crate::string_cache::atom_macro::nsGkAtoms_onvrdisplayactivate as *mut _) } };
("onvrdisplayconnect") =>
{ unsafe { $crate::string_cache::atom_macro::atom_from_static($crate::string_cache::atom_macro::nsGkAtoms_onvrdisplayconnect as *mut _) } };
("onvrdisplaydeactivate") =>
{ unsafe { $crate::string_cache::atom_macro::atom_from_static($crate::string_cache::atom_macro::nsGkAtoms_onvrdisplaydeactivate as *mut _) } };
("onvrdisplaydisconnect") =>
{ unsafe { $crate::string_cache::atom_macro::atom_from_static($crate::string_cache::atom_macro::nsGkAtoms_onvrdisplaydisconnect as *mut _) } };
("onvrdisplaypresentchange") =>

View file

@ -135,16 +135,22 @@ impl WeakAtom {
/// Returns whether this atom is static.
#[inline]
pub fn is_static(&self) -> bool {
// FIXME(emilio): re-introduce bitfield accessors:
//
// https://github.com/servo/rust-bindgen/issues/519
unsafe {
(*self.as_ptr()).mIsStatic() != 0
((*self.as_ptr())._bitfield_1 & (0x80000000 as u32)) != 0
}
}
/// Returns the length of the atom string.
#[inline]
pub fn len(&self) -> u32 {
// FIXME(emilio): re-introduce bitfield accessors:
//
// https://github.com/servo/rust-bindgen/issues/519
unsafe {
(*self.as_ptr()).mLength()
(*self.as_ptr())._bitfield_1 & 0x7FFFFFFF
}
}
@ -282,10 +288,11 @@ impl From<*mut nsIAtom> for Atom {
fn from(ptr: *mut nsIAtom) -> Atom {
debug_assert!(!ptr.is_null());
unsafe {
if (*ptr).mIsStatic() == 0 {
let ret = Atom(WeakAtom::new(ptr));
if !ret.is_static() {
Gecko_AddRefAtom(ptr);
}
Atom(WeakAtom::new(ptr))
ret
}
}
}