зеркало из https://github.com/mozilla/gecko-dev.git
servo: Merge #19072 - style: Update bindgen to 0.31.2 (from emilio:bindgen-up-finally); r=xidorn
Just waiting for a try run. Source-Repo: https://github.com/servo/servo Source-Revision: a376382ed06dce1aa4a63138270b3131375ed5ed --HG-- extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear extra : subtree_revision : 224e9fc02fd9a67f98ea7edd97d47535e765c3a1
This commit is contained in:
Родитель
05fdcd08b7
Коммит
315f41e7b7
|
@ -65,14 +65,6 @@ dependencies = [
|
|||
"odds 0.2.25 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "aster"
|
||||
version = "0.41.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"syntex_syntax 0.58.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "atomic_refcell"
|
||||
version = "0.1.0"
|
||||
|
@ -148,10 +140,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "bindgen"
|
||||
version = "0.29.1"
|
||||
version = "0.31.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"aster 0.41.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.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"clang-sys 0.21.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -160,10 +151,9 @@ dependencies = [
|
|||
"lazy_static 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"peeking_take_while 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"quasi 0.32.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"quasi_codegen 0.32.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"regex 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"syntex_syntax 0.58.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"which 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -2427,26 +2417,6 @@ dependencies = [
|
|||
"void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "quasi"
|
||||
version = "0.32.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"syntex_errors 0.58.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"syntex_syntax 0.58.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "quasi_codegen"
|
||||
version = "0.32.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"aster 0.41.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"syntex 0.58.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"syntex_errors 0.58.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"syntex_syntax 0.58.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "quote"
|
||||
version = "0.3.15"
|
||||
|
@ -3151,7 +3121,7 @@ dependencies = [
|
|||
"app_units 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"arrayvec 0.3.23 (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.29.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"bindgen 0.31.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"bitflags 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"byteorder 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cfg-if 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -3299,48 +3269,6 @@ dependencies = [
|
|||
"syn 0.11.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "syntex"
|
||||
version = "0.58.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"syntex_errors 0.58.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"syntex_syntax 0.58.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "syntex_errors"
|
||||
version = "0.58.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"libc 0.2.23 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"syntex_pos 0.58.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"term 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "syntex_pos"
|
||||
version = "0.58.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "syntex_syntax"
|
||||
version = "0.58.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"bitflags 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"syntex_errors 0.58.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"syntex_pos 0.58.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "task_info"
|
||||
version = "0.0.1"
|
||||
|
@ -3358,15 +3286,6 @@ dependencies = [
|
|||
"utf-8 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "term"
|
||||
version = "0.4.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "term_size"
|
||||
version = "0.2.3"
|
||||
|
@ -3683,6 +3602,14 @@ dependencies = [
|
|||
"serde 1.0.14 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "which"
|
||||
version = "1.0.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"libc 0.2.23 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "winapi"
|
||||
version = "0.2.8"
|
||||
|
@ -3794,7 +3721,6 @@ dependencies = [
|
|||
"checksum antidote 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "34fde25430d87a9388dadbe6e34d7f72a462c8b43ac8d309b42b0a8505d7e2a5"
|
||||
"checksum app_units 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)" = "ed0a4de09a3b8449515e649f3bb84f72ea15fc2d10639beb0776a09b7d308074"
|
||||
"checksum arrayvec 0.3.23 (registry+https://github.com/rust-lang/crates.io-index)" = "699e63a93b79d717e8c3b5eb1b28b7780d0d6d9e59a72eb769291c83b0c8dc67"
|
||||
"checksum aster 0.41.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4ccfdf7355d9db158df68f976ed030ab0f6578af811f5a7bb6dcf221ec24e0e0"
|
||||
"checksum atomic_refcell 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fb2dcb6e6d35f20276943cc04bb98e538b348d525a04ac79c10021561d202f21"
|
||||
"checksum audio-video-metadata 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "f9a5fd5696539cf7a0c2f826be1d13f9a8673be2f9632c8b62f5b122f7e74416"
|
||||
"checksum azure 0.21.2 (git+https://github.com/servo/rust-azure)" = "<none>"
|
||||
|
@ -3803,7 +3729,7 @@ dependencies = [
|
|||
"checksum base64 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "96434f987501f0ed4eb336a411e0631ecd1afa11574fe148587adc4ff96143c9"
|
||||
"checksum binary-space-partition 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "88ceb0d16c4fd0e42876e298d7d3ce3780dd9ebdcbe4199816a32c77e08597ff"
|
||||
"checksum bincode 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9a6301db0b49fb63551bc15b5ae348147101cdf323242b93ec7546d5002ff1af"
|
||||
"checksum bindgen 0.29.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ba610cba0c1727ed837316540068b51349b8268c073906067b7c3948598929bd"
|
||||
"checksum bindgen 0.31.3 (registry+https://github.com/rust-lang/crates.io-index)" = "57253399c086f4f29e57ffd3b5cdbc23a806a00292619351aa4cfa39cb49d4ea"
|
||||
"checksum bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "aad18937a628ec6abcd26d1489012cc0e18c21798210f491af69ded9b881106d"
|
||||
"checksum bitflags 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1370e9fc2a6ae53aea8b7a5110edbd08836ed87c88736dfabccade1c2b44bff4"
|
||||
"checksum bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4efd02e230a02e18f92fc2735f44597385ed02ad8f831e7c1c1156ee5e1ab3a5"
|
||||
|
@ -3984,8 +3910,6 @@ dependencies = [
|
|||
"checksum precomputed-hash 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c"
|
||||
"checksum procedural-masquerade 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "c93cdc1fb30af9ddf3debc4afbdb0f35126cbd99daa229dd76cdd5349b41d989"
|
||||
"checksum push-trait 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fdc13b1a53bc505b526086361221aaa612fefb9b0ecf2853f9d31f807764e004"
|
||||
"checksum quasi 0.32.0 (registry+https://github.com/rust-lang/crates.io-index)" = "18c45c4854d6d1cf5d531db97c75880feb91c958b0720f4ec1057135fec358b3"
|
||||
"checksum quasi_codegen 0.32.0 (registry+https://github.com/rust-lang/crates.io-index)" = "51b9e25fa23c044c1803f43ca59c98dac608976dd04ce799411edd58ece776d4"
|
||||
"checksum quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6e920b65c65f10b2ae65c831a81a073a89edd28c7cce89475bff467ab4167a"
|
||||
"checksum rand 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)" = "022e0636ec2519ddae48154b028864bdce4eaf7d35226ab8e65c611be97b189d"
|
||||
"checksum rayon 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "b614fe08b6665cb9a231d07ac1364b0ef3cb3698f1239ee0c4c3a88a524f54c8"
|
||||
|
@ -4036,12 +3960,7 @@ dependencies = [
|
|||
"checksum syn 0.11.11 (registry+https://github.com/rust-lang/crates.io-index)" = "d3b891b9015c88c576343b9b3e41c2c11a51c219ef067b264bd9c8aa9b441dad"
|
||||
"checksum synom 0.11.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a393066ed9010ebaed60b9eafa373d4b1baac186dd7e008555b0f702b51945b6"
|
||||
"checksum synstructure 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "cf318c34a2f8381a4f3d4db2c91b45bca2b1cd8cbe56caced900647be164800c"
|
||||
"checksum syntex 0.58.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a8f5e3aaa79319573d19938ea38d068056b826db9883a5d47f86c1cecc688f0e"
|
||||
"checksum syntex_errors 0.58.1 (registry+https://github.com/rust-lang/crates.io-index)" = "867cc5c2d7140ae7eaad2ae9e8bf39cb18a67ca651b7834f88d46ca98faadb9c"
|
||||
"checksum syntex_pos 0.58.1 (registry+https://github.com/rust-lang/crates.io-index)" = "13ad4762fe52abc9f4008e85c4fb1b1fe3aa91ccb99ff4826a439c7c598e1047"
|
||||
"checksum syntex_syntax 0.58.1 (registry+https://github.com/rust-lang/crates.io-index)" = "6e0e4dbae163dd98989464c23dd503161b338790640e11537686f2ef0f25c791"
|
||||
"checksum tendril 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9de21546595a0873061940d994bbbc5c35f024ae4fd61ec5c5b159115684f508"
|
||||
"checksum term 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)" = "d168af3930b369cfe245132550579d47dfd873d69470755a19c2c6568dbbd989"
|
||||
"checksum term_size 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "07b6c1ac5b3fffd75073276bca1ceed01f67a28537097a2a9539e116e50fb21a"
|
||||
"checksum thread-id 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8df7875b676fddfadffd96deea3b1124e5ede707d4884248931077518cf1f773"
|
||||
"checksum thread_local 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "c85048c6260d17cf486ceae3282d9fb6b90be220bf5b28c400f5485ffc29f0c7"
|
||||
|
@ -4074,6 +3993,7 @@ dependencies = [
|
|||
"checksum webdriver 0.22.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d548aabf87411b1b4ba91fd07eacd8b238135c7131a452b8a9f6386209167e18"
|
||||
"checksum webrender 0.53.1 (git+https://github.com/servo/webrender)" = "<none>"
|
||||
"checksum webrender_api 0.53.1 (git+https://github.com/servo/webrender)" = "<none>"
|
||||
"checksum which 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "4be6cfa54dab45266e98b5d7be2f8ce959ddd49abd141a05d52dce4b07f803bb"
|
||||
"checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a"
|
||||
"checksum winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc"
|
||||
"checksum ws 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "04614a58714f3fd4a8b1da4bcae9f031c532d35988c3d39627619248113f8be8"
|
||||
|
|
|
@ -79,7 +79,7 @@ kernel32-sys = "0.2"
|
|||
[build-dependencies]
|
||||
lazy_static = "0.2"
|
||||
log = "0.3"
|
||||
bindgen = { version = "0.29.1", optional = true }
|
||||
bindgen = { version = "0.31.2", optional = true }
|
||||
regex = {version = "0.2", optional = true}
|
||||
walkdir = "1.0"
|
||||
toml = {version = "0.2.1", optional = true, default-features = false}
|
||||
|
|
|
@ -200,7 +200,13 @@ mod bindings {
|
|||
|
||||
impl BuilderExt for Builder {
|
||||
fn get_initial_builder() -> Builder {
|
||||
let mut builder = Builder::default();
|
||||
use bindgen::RustTarget;
|
||||
|
||||
// Disable rust unions, because we replace some types inside of
|
||||
// them.
|
||||
let mut builder = Builder::default()
|
||||
.rustfmt_bindings(false)
|
||||
.rust_target(RustTarget::Stable_1_0);
|
||||
for dir in SEARCH_PATHS.iter() {
|
||||
builder = builder.clang_arg("-I").clang_arg(dir.to_str().unwrap());
|
||||
}
|
||||
|
@ -233,7 +239,7 @@ mod bindings {
|
|||
// https://github.com/nikomatsakis/rust-memory-model/issues/2
|
||||
fn zero_size_type(self, ty: &str, structs_list: &HashSet<&str>) -> Builder {
|
||||
if !structs_list.contains(ty) {
|
||||
self.hide_type(ty)
|
||||
self.blacklist_type(ty)
|
||||
.raw_line(format!("enum {}Void {{ }}", ty))
|
||||
.raw_line(format!("pub struct {0}({0}Void);", ty))
|
||||
} else {
|
||||
|
@ -241,16 +247,16 @@ mod bindings {
|
|||
}
|
||||
}
|
||||
fn borrowed_type(self, ty: &str) -> Builder {
|
||||
self.hide_type(format!("{}Borrowed", ty))
|
||||
self.blacklist_type(format!("{}Borrowed", ty))
|
||||
.raw_line(format!("pub type {0}Borrowed<'a> = &'a {0};", ty))
|
||||
.hide_type(format!("{}BorrowedOrNull", ty))
|
||||
.blacklist_type(format!("{}BorrowedOrNull", ty))
|
||||
.raw_line(format!("pub type {0}BorrowedOrNull<'a> = Option<&'a {0}>;", ty))
|
||||
}
|
||||
fn mutable_borrowed_type(self, ty: &str) -> Builder {
|
||||
self.borrowed_type(ty)
|
||||
.hide_type(format!("{}BorrowedMut", ty))
|
||||
.blacklist_type(format!("{}BorrowedMut", ty))
|
||||
.raw_line(format!("pub type {0}BorrowedMut<'a> = &'a mut {0};", ty))
|
||||
.hide_type(format!("{}BorrowedMutOrNull", ty))
|
||||
.blacklist_type(format!("{}BorrowedMutOrNull", ty))
|
||||
.raw_line(format!("pub type {0}BorrowedMutOrNull<'a> = Option<&'a mut {0}>;", ty))
|
||||
}
|
||||
}
|
||||
|
@ -342,7 +348,7 @@ mod bindings {
|
|||
fn handle_common(self, fixups: &mut Vec<Fixup>) -> BuilderWithConfig<'a> {
|
||||
self.handle_str_items("headers", |b, item| b.header(add_include(item)))
|
||||
.handle_str_items("raw-lines", |b, item| b.raw_line(item))
|
||||
.handle_str_items("hide-types", |b, item| b.hide_type(item))
|
||||
.handle_str_items("hide-types", |b, item| b.blacklist_type(item))
|
||||
.handle_table_items("fixups", |builder, item| {
|
||||
fixups.push(Fixup {
|
||||
pat: item["pat"].as_str().unwrap().into(),
|
||||
|
@ -391,9 +397,9 @@ mod bindings {
|
|||
let builder = BuilderWithConfig::new(builder, CONFIG["structs"].as_table().unwrap())
|
||||
.handle_common(&mut fixups)
|
||||
.handle_str_items("bitfield-enums", |b, item| b.bitfield_enum(item))
|
||||
.handle_str_items("constified-enums", |b, item| b.constified_enum(item))
|
||||
.handle_str_items("whitelist-vars", |b, item| b.whitelisted_var(item))
|
||||
.handle_str_items("whitelist-types", |b, item| b.whitelisted_type(item))
|
||||
.handle_str_items("rusty-enums", |b, item| b.rustified_enum(item))
|
||||
.handle_str_items("whitelist-vars", |b, item| b.whitelist_var(item))
|
||||
.handle_str_items("whitelist-types", |b, item| b.whitelist_type(item))
|
||||
.handle_str_items("opaque-types", |b, item| b.opaque_type(item))
|
||||
.handle_list("constified-enum-variants", |builder, iter| {
|
||||
let mut map = HashMap::new();
|
||||
|
@ -411,11 +417,16 @@ mod bindings {
|
|||
let gecko = item["gecko"].as_str().unwrap();
|
||||
let servo = item["servo"].as_str().unwrap();
|
||||
let gecko_name = gecko.rsplit("::").next().unwrap();
|
||||
let gecko = gecko.split("::")
|
||||
.map(|s| format!("\\s*{}\\s*", s))
|
||||
.collect::<Vec<_>>()
|
||||
.join("::");
|
||||
|
||||
fixups.push(Fixup {
|
||||
pat: format!("\\broot::{}\\b", gecko),
|
||||
pat: format!("\\broot\\s*::\\s*{}\\b", gecko),
|
||||
rep: format!("::gecko_bindings::structs::{}", gecko_name)
|
||||
});
|
||||
builder.hide_type(gecko)
|
||||
builder.blacklist_type(gecko)
|
||||
.raw_line(format!("pub type {0}{2} = {1}{2};", gecko_name, servo,
|
||||
if generic { "<T>" } else { "" }))
|
||||
})
|
||||
|
@ -480,9 +491,9 @@ mod bindings {
|
|||
let mut fixups = vec![];
|
||||
let mut builder = BuilderWithConfig::new(builder, config)
|
||||
.handle_common(&mut fixups)
|
||||
.handle_str_items("whitelist-functions", |b, item| b.whitelisted_function(item))
|
||||
.handle_str_items("whitelist-functions", |b, item| b.whitelist_function(item))
|
||||
.handle_str_items("structs-types", |mut builder, ty| {
|
||||
builder = builder.hide_type(ty)
|
||||
builder = builder.blacklist_type(ty)
|
||||
.raw_line(format!("use gecko_bindings::structs::{};", ty));
|
||||
structs_types.insert(ty);
|
||||
// TODO this is hacky, figure out a better way to do it without
|
||||
|
@ -500,16 +511,16 @@ mod bindings {
|
|||
.handle_table_items("array-types", |builder, item| {
|
||||
let cpp_type = item["cpp-type"].as_str().unwrap();
|
||||
let rust_type = item["rust-type"].as_str().unwrap();
|
||||
builder.hide_type(format!("nsTArrayBorrowed_{}", cpp_type))
|
||||
builder
|
||||
.raw_line(format!(concat!("pub type nsTArrayBorrowed_{}<'a> = ",
|
||||
"&'a mut ::gecko_bindings::structs::nsTArray<{}>;"),
|
||||
cpp_type, rust_type))
|
||||
})
|
||||
.handle_table_items("servo-owned-types", |mut builder, item| {
|
||||
let name = item["name"].as_str().unwrap();
|
||||
builder = builder.hide_type(format!("{}Owned", name))
|
||||
builder = builder.blacklist_type(format!("{}Owned", name))
|
||||
.raw_line(format!("pub type {0}Owned = ::gecko_bindings::sugar::ownership::Owned<{0}>;", name))
|
||||
.hide_type(format!("{}OwnedOrNull", name))
|
||||
.blacklist_type(format!("{}OwnedOrNull", name))
|
||||
.raw_line(format!(concat!("pub type {0}OwnedOrNull = ",
|
||||
"::gecko_bindings::sugar::ownership::OwnedOrNull<{0}>;"), name))
|
||||
.mutable_borrowed_type(name);
|
||||
|
@ -527,7 +538,7 @@ mod bindings {
|
|||
.get_builder();
|
||||
for ty in get_arc_types().iter() {
|
||||
builder = builder
|
||||
.hide_type(format!("{}Strong", ty))
|
||||
.blacklist_type(format!("{}Strong", ty))
|
||||
.raw_line(format!("pub type {0}Strong = ::gecko_bindings::sugar::ownership::Strong<{0}>;", ty))
|
||||
.borrowed_type(ty)
|
||||
.zero_size_type(ty, &structs_types);
|
||||
|
|
|
@ -243,24 +243,6 @@ pub trait TNode : Sized + Copy + Clone + Debug + NodeInfo + PartialEq {
|
|||
unsafe fn set_can_be_fragmented(&self, value: bool);
|
||||
}
|
||||
|
||||
/// Wrapper to output the ElementData along with the node when formatting for
|
||||
/// Debug.
|
||||
pub struct ShowData<N: TNode>(pub N);
|
||||
impl<N: TNode> Debug for ShowData<N> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
fmt_with_data(f, self.0)
|
||||
}
|
||||
}
|
||||
|
||||
/// Wrapper to output the primary computed values along with the node when
|
||||
/// formatting for Debug. This is very verbose.
|
||||
pub struct ShowDataAndPrimaryValues<N: TNode>(pub N);
|
||||
impl<N: TNode> Debug for ShowDataAndPrimaryValues<N> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
fmt_with_data_and_primary_values(f, self.0)
|
||||
}
|
||||
}
|
||||
|
||||
/// Wrapper to output the subtree rather than the single node when formatting
|
||||
/// for Debug.
|
||||
pub struct ShowSubtree<N: TNode>(pub N);
|
||||
|
@ -283,7 +265,9 @@ impl<N: TNode> Debug for ShowSubtreeData<N> {
|
|||
|
||||
/// Wrapper to output the subtree along with the ElementData and primary
|
||||
/// ComputedValues when formatting for Debug. This is extremely verbose.
|
||||
#[cfg(feature = "servo")]
|
||||
pub struct ShowSubtreeDataAndPrimaryValues<N: TNode>(pub N);
|
||||
#[cfg(feature = "servo")]
|
||||
impl<N: TNode> Debug for ShowSubtreeDataAndPrimaryValues<N> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
writeln!(f, "DOM Subtree:")?;
|
||||
|
@ -305,6 +289,7 @@ fn fmt_with_data<N: TNode>(f: &mut fmt::Formatter, n: N) -> fmt::Result {
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "servo")]
|
||||
fn fmt_with_data_and_primary_values<N: TNode>(f: &mut fmt::Formatter, n: N) -> fmt::Result {
|
||||
if let Some(el) = n.as_element() {
|
||||
let dd = el.has_dirty_descendants();
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
Различия файлов скрыты, потому что одна или несколько строк слишком длинны
|
@ -16,7 +16,7 @@ use gecko_bindings::bindings;
|
|||
use gecko_bindings::structs;
|
||||
use gecko_bindings::structs::{nsCSSKeyword, nsCSSProps_KTableEntry, nsCSSValue, nsCSSUnit};
|
||||
use gecko_bindings::structs::{nsMediaExpression_Range, nsMediaFeature};
|
||||
use gecko_bindings::structs::{nsMediaFeature_ValueType, nsMediaFeature_RangeType, nsMediaFeature_RequirementFlags};
|
||||
use gecko_bindings::structs::{nsMediaFeature_ValueType, nsMediaFeature_RangeType};
|
||||
use gecko_bindings::structs::{nsPresContext, RawGeckoPresContextOwned};
|
||||
use media_queries::MediaType;
|
||||
use parser::ParserContext;
|
||||
|
@ -236,7 +236,7 @@ impl ToCss for Expression {
|
|||
{
|
||||
dest.write_str("(")?;
|
||||
|
||||
if (self.feature.mReqFlags & nsMediaFeature_RequirementFlags::eHasWebkitPrefix as u8) != 0 {
|
||||
if (self.feature.mReqFlags & structs::nsMediaFeature_RequirementFlags_eHasWebkitPrefix) != 0 {
|
||||
dest.write_str("-webkit-")?;
|
||||
}
|
||||
match self.range {
|
||||
|
@ -612,7 +612,7 @@ impl Expression {
|
|||
|
||||
if context.in_chrome_stylesheet() ||
|
||||
context.stylesheet_origin == Origin::UserAgent {
|
||||
flags |= nsMediaFeature_RequirementFlags::eUserAgentAndChromeOnly as u8;
|
||||
flags |= structs::nsMediaFeature_RequirementFlags_eUserAgentAndChromeOnly;
|
||||
}
|
||||
|
||||
let result = {
|
||||
|
@ -621,9 +621,9 @@ impl Expression {
|
|||
if unsafe { structs::StylePrefs_sWebkitPrefixedAliasesEnabled } &&
|
||||
starts_with_ignore_ascii_case(feature_name, "-webkit-") {
|
||||
feature_name = &feature_name[8..];
|
||||
flags |= nsMediaFeature_RequirementFlags::eHasWebkitPrefix as u8;
|
||||
flags |= structs::nsMediaFeature_RequirementFlags_eHasWebkitPrefix;
|
||||
if unsafe { structs::StylePrefs_sWebkitDevicePixelRatioEnabled } {
|
||||
flags |= nsMediaFeature_RequirementFlags::eWebkitDevicePixelRatioPrefEnabled as u8;
|
||||
flags |= structs::nsMediaFeature_RequirementFlags_eWebkitDevicePixelRatioPrefEnabled;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
use gecko_bindings::structs;
|
||||
use gecko_bindings::sugar::ownership::HasArcFFI;
|
||||
use servo_arc::Arc;
|
||||
use std::{mem, ptr};
|
||||
use std::{fmt, mem, ptr};
|
||||
use std::marker::PhantomData;
|
||||
use std::ops::{Deref, DerefMut};
|
||||
|
||||
|
@ -25,12 +25,19 @@ pub unsafe trait ThreadSafeRefCounted: RefCounted {}
|
|||
|
||||
/// A custom RefPtr implementation to take into account Drop semantics and
|
||||
/// a bit less-painful memory management.
|
||||
#[derive(Debug)]
|
||||
pub struct RefPtr<T: RefCounted> {
|
||||
ptr: *mut T,
|
||||
_marker: PhantomData<T>,
|
||||
}
|
||||
|
||||
impl<T: RefCounted> fmt::Debug for RefPtr<T> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
f.write_str("RefPtr { ")?;
|
||||
self.ptr.fmt(f)?;
|
||||
f.write_str("}")
|
||||
}
|
||||
}
|
||||
|
||||
/// A RefPtr that we know is uniquely owned.
|
||||
///
|
||||
/// This is basically Box<T>, with the additional guarantee that the box can be
|
||||
|
|
|
@ -71,7 +71,6 @@ pub mod style_structs {
|
|||
/// FIXME(emilio): This is completely duplicated with the other properties code.
|
||||
pub type ComputedValuesInner = ::gecko_bindings::structs::ServoComputedData;
|
||||
|
||||
#[derive(Debug)]
|
||||
#[repr(C)]
|
||||
pub struct ComputedValues(::gecko_bindings::structs::mozilla::ServoStyleContext);
|
||||
|
||||
|
@ -4487,11 +4486,11 @@ fn static_assert() {
|
|||
}
|
||||
|
||||
pub fn clone_image_orientation(&self) -> longhands::image_orientation::computed_value::T {
|
||||
use gecko_bindings::structs::{nsStyleImageOrientation_Bits, nsStyleImageOrientation_Angles};
|
||||
use gecko_bindings::structs::nsStyleImageOrientation_Angles;
|
||||
use properties::longhands::image_orientation::computed_value::{Orientation, T};
|
||||
|
||||
let gecko_orientation = self.gecko.mImageOrientation.mOrientation;
|
||||
if gecko_orientation & nsStyleImageOrientation_Bits::FROM_IMAGE_MASK as u8 != 0 {
|
||||
if gecko_orientation & structs::nsStyleImageOrientation_Bits_FROM_IMAGE_MASK as u8 != 0 {
|
||||
T::FromImage
|
||||
} else {
|
||||
const ANGLE0: u8 = nsStyleImageOrientation_Angles::ANGLE_0 as u8;
|
||||
|
@ -4499,14 +4498,15 @@ fn static_assert() {
|
|||
const ANGLE180: u8 = nsStyleImageOrientation_Angles::ANGLE_180 as u8;
|
||||
const ANGLE270: u8 = nsStyleImageOrientation_Angles::ANGLE_270 as u8;
|
||||
|
||||
let flip = gecko_orientation & nsStyleImageOrientation_Bits::FLIP_MASK as u8 != 0;
|
||||
let orientation = match gecko_orientation & nsStyleImageOrientation_Bits::ORIENTATION_MASK as u8 {
|
||||
ANGLE0 => Orientation::Angle0,
|
||||
ANGLE90 => Orientation::Angle90,
|
||||
ANGLE180 => Orientation::Angle180,
|
||||
ANGLE270 => Orientation::Angle270,
|
||||
_ => unreachable!()
|
||||
};
|
||||
let flip = gecko_orientation & structs::nsStyleImageOrientation_Bits_FLIP_MASK as u8 != 0;
|
||||
let orientation =
|
||||
match gecko_orientation & structs::nsStyleImageOrientation_Bits_ORIENTATION_MASK as u8 {
|
||||
ANGLE0 => Orientation::Angle0,
|
||||
ANGLE90 => Orientation::Angle90,
|
||||
ANGLE180 => Orientation::Angle180,
|
||||
ANGLE270 => Orientation::Angle270,
|
||||
_ => unreachable!()
|
||||
};
|
||||
T::AngleWithFlipped(orientation, flip)
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче