servo: Merge #15580 - Bindgenup (from emilio:stylo); r=heycam

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

Source-Repo: https://github.com/servo/servo
Source-Revision: 35e7a4cd2c27db605f15670f318dffba22a1c680

--HG--
extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear
extra : subtree_revision : 7d3a170fc1e0785344337ee95fcde41edac0b425
This commit is contained in:
Emilio Cobos Álvarez 2017-02-16 02:58:54 -08:00
Родитель efab3fcb41
Коммит d4f0d791be
8 изменённых файлов: 21925 добавлений и 7876 удалений

12
servo/Cargo.lock сгенерированный
Просмотреть файл

@ -152,13 +152,13 @@ dependencies = [
[[package]]
name = "bindgen"
version = "0.21.1"
version = "0.22.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"aster 0.38.0 (registry+https://github.com/rust-lang/crates.io-index)",
"cexpr 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"cfg-if 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"clang-sys 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)",
"clang-sys 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)",
"clap 2.20.3 (registry+https://github.com/rust-lang/crates.io-index)",
"env_logger 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
@ -345,7 +345,7 @@ dependencies = [
[[package]]
name = "clang-sys"
version = "0.12.0"
version = "0.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
@ -2750,7 +2750,7 @@ version = "0.0.1"
dependencies = [
"app_units 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
"atomic_refcell 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"bindgen 0.21.1 (registry+https://github.com/rust-lang/crates.io-index)",
"bindgen 0.22.0 (registry+https://github.com/rust-lang/crates.io-index)",
"bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"cfg-if 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"cssparser 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
@ -3365,7 +3365,7 @@ dependencies = [
"checksum backtrace 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f551bc2ddd53aea015d453ef0b635af89444afa5ed2405dd0b2062ad5d600d80"
"checksum backtrace-sys 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "222dcb05eb5e2cdb6780af3576397d258aa82160e8be44141c9248c8e4b3d310"
"checksum bincode 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "55eb0b7fd108527b0c77860f75eca70214e11a8b4c6ef05148c54c05a25d48ad"
"checksum bindgen 0.21.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cba697ecbf51e4a1d1d84c6dee5339d22a5f9f5e04694e53e873ea26257a73f2"
"checksum bindgen 0.22.0 (registry+https://github.com/rust-lang/crates.io-index)" = "facc480c409c373db3c870e377ce223e5e07d979efc2604691dc6f583e8ded0f"
"checksum bit-set 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d9bf6104718e80d7b26a68fdbacff3481cfc05df670821affc7e9cbc1884400c"
"checksum bit-vec 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "5b97c2c8e8bbb4251754f559df8af22fb264853c7d009084a576cdf12565089d"
"checksum bitflags 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8dead7461c1127cf637931a1e50934eb6eee8bff2f74433ac7909e9afcee04a3"
@ -3383,7 +3383,7 @@ dependencies = [
"checksum cexpr 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "393a5f0088efbe41f9d1fcd062f24e83c278608420e62109feb2c8abee07de7d"
"checksum cfg-if 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "de1e760d7b6535af4241fca8bd8adf68e2e7edacc6b29f5d399050c5e48cf88c"
"checksum cgl 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "8bdd78cca65a739cb5475dbf6b6bbb49373e327f4a6f2b499c0f98632df38c10"
"checksum clang-sys 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "822ea22bbbef9f5934e9477860545fb0311a1759e43a276de42e2856c605aa2b"
"checksum clang-sys 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4f98f0715ff67f27ca6a2f8f0ffc2a56f8edbc7acd57489c29eadc3a15c4eafe"
"checksum clap 2.20.3 (registry+https://github.com/rust-lang/crates.io-index)" = "f89819450aa94325998aa83ce7ea142db11ad24c725d6bc48459845e0d6d9f18"
"checksum clippy_lints 0.0.112 (registry+https://github.com/rust-lang/crates.io-index)" = "51461bf5f0862158b3239e55af263d5fe67620ccbb824f87c9ed0f7cd1ce1184"
"checksum cmake 0.1.20 (registry+https://github.com/rust-lang/crates.io-index)" = "a3a6805df695087e7c1bcd9a82e03ad6fb864c8e67ac41b1348229ce5b7f0407"

Просмотреть файл

@ -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"

Просмотреть файл

@ -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)

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -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") =>

Просмотреть файл

@ -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
}
}
}

Просмотреть файл

@ -258,11 +258,11 @@ pub extern "C" fn Servo_AnimationValue_GetOpacity(value: RawServoAnimationValueB
#[no_mangle]
pub extern "C" fn Servo_AnimationValue_GetTransform(value: RawServoAnimationValueBorrowed,
list: &mut structs::RefPtr<nsCSSValueSharedList>)
list: *mut structs::RefPtr<nsCSSValueSharedList>)
{
let value = AnimationValue::as_arc(&value);
if let AnimationValue::Transform(ref servo_list) = **value {
style_structs::Box::convert_transform(servo_list.0.clone().unwrap(), list);
style_structs::Box::convert_transform(servo_list.0.clone().unwrap(), unsafe { &mut *list });
} else {
panic!("The AnimationValue should be transform");
}