Auto merge of #22777 - emilio:gecko-sync, r=emilio

style: Sync changes from mozilla-central.

<!-- 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/22777)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2019-01-29 08:19:14 -05:00 committed by GitHub
commit 65c2fcb460
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
20 changed files with 246 additions and 388 deletions

78
Cargo.lock generated
View file

@ -227,7 +227,7 @@ dependencies = [
"lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
"peeking_take_while 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "peeking_take_while 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"proc-macro2 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro2 0.4.26 (registry+https://github.com/rust-lang/crates.io-index)",
"quote 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)",
"regex 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", "regex 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
"which 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "which 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
@ -811,7 +811,7 @@ dependencies = [
"itoa 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "itoa 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
"matches 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "matches 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"phf 0.7.23 (registry+https://github.com/rust-lang/crates.io-index)", "phf 0.7.23 (registry+https://github.com/rust-lang/crates.io-index)",
"proc-macro2 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro2 0.4.26 (registry+https://github.com/rust-lang/crates.io-index)",
"procedural-masquerade 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "procedural-masquerade 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
"quote 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)",
@ -825,7 +825,7 @@ version = "0.3.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"phf_codegen 0.7.23 (registry+https://github.com/rust-lang/crates.io-index)", "phf_codegen 0.7.23 (registry+https://github.com/rust-lang/crates.io-index)",
"proc-macro2 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro2 0.4.26 (registry+https://github.com/rust-lang/crates.io-index)",
"procedural-masquerade 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "procedural-masquerade 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
"quote 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)",
"syn 0.15.22 (registry+https://github.com/rust-lang/crates.io-index)", "syn 0.15.22 (registry+https://github.com/rust-lang/crates.io-index)",
@ -847,7 +847,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
"ident_case 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "ident_case 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"proc-macro2 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro2 0.4.26 (registry+https://github.com/rust-lang/crates.io-index)",
"quote 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)",
"syn 0.15.22 (registry+https://github.com/rust-lang/crates.io-index)", "syn 0.15.22 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
@ -904,6 +904,17 @@ dependencies = [
"deny_public_fields 0.0.1", "deny_public_fields 0.0.1",
] ]
[[package]]
name = "derive_more"
version = "0.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"proc-macro2 0.4.26 (registry+https://github.com/rust-lang/crates.io-index)",
"quote 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
"syn 0.15.22 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]] [[package]]
name = "device" name = "device"
version = "0.0.1" version = "0.0.1"
@ -994,7 +1005,7 @@ dependencies = [
name = "domobject_derive" name = "domobject_derive"
version = "0.0.1" version = "0.0.1"
dependencies = [ dependencies = [
"proc-macro2 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro2 0.4.26 (registry+https://github.com/rust-lang/crates.io-index)",
"quote 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)",
"syn 0.15.22 (registry+https://github.com/rust-lang/crates.io-index)", "syn 0.15.22 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
@ -1115,7 +1126,7 @@ name = "enum-iterator-derive"
version = "0.2.3" version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"proc-macro2 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro2 0.4.26 (registry+https://github.com/rust-lang/crates.io-index)",
"quote 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)",
"syn 0.15.22 (registry+https://github.com/rust-lang/crates.io-index)", "syn 0.15.22 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
@ -1722,7 +1733,7 @@ name = "headers-derive"
version = "0.0.1" version = "0.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"proc-macro2 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro2 0.4.26 (registry+https://github.com/rust-lang/crates.io-index)",
"quote 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)",
"syn 0.15.22 (registry+https://github.com/rust-lang/crates.io-index)", "syn 0.15.22 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
@ -1780,7 +1791,7 @@ dependencies = [
"log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
"mac 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "mac 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"markup5ever 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)", "markup5ever 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)",
"proc-macro2 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro2 0.4.26 (registry+https://github.com/rust-lang/crates.io-index)",
"quote 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)",
"syn 0.15.22 (registry+https://github.com/rust-lang/crates.io-index)", "syn 0.15.22 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
@ -2026,7 +2037,7 @@ dependencies = [
name = "jstraceable_derive" name = "jstraceable_derive"
version = "0.0.1" version = "0.0.1"
dependencies = [ dependencies = [
"proc-macro2 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro2 0.4.26 (registry+https://github.com/rust-lang/crates.io-index)",
"syn 0.15.22 (registry+https://github.com/rust-lang/crates.io-index)", "syn 0.15.22 (registry+https://github.com/rust-lang/crates.io-index)",
"synstructure 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)", "synstructure 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
@ -2383,7 +2394,7 @@ name = "malloc_size_of_derive"
version = "0.1.0" version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"proc-macro2 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro2 0.4.26 (registry+https://github.com/rust-lang/crates.io-index)",
"syn 0.15.22 (registry+https://github.com/rust-lang/crates.io-index)", "syn 0.15.22 (registry+https://github.com/rust-lang/crates.io-index)",
"synstructure 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)", "synstructure 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
@ -2766,7 +2777,7 @@ version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"num-traits 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
"proc-macro2 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro2 0.4.26 (registry+https://github.com/rust-lang/crates.io-index)",
"quote 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)",
"syn 0.15.22 (registry+https://github.com/rust-lang/crates.io-index)", "syn 0.15.22 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
@ -3056,7 +3067,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]] [[package]]
name = "proc-macro2" name = "proc-macro2"
version = "0.4.6" version = "0.4.26"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
@ -3123,7 +3134,7 @@ name = "quote"
version = "0.6.3" version = "0.6.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"proc-macro2 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro2 0.4.26 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]] [[package]]
@ -3271,6 +3282,14 @@ name = "rustc-demangle"
version = "0.1.4" version = "0.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "rustc_version"
version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]] [[package]]
name = "rusttype" name = "rusttype"
version = "0.7.2" version = "0.7.2"
@ -3491,6 +3510,7 @@ version = "0.21.0"
dependencies = [ dependencies = [
"bitflags 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", "bitflags 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
"cssparser 0.25.1 (registry+https://github.com/rust-lang/crates.io-index)", "cssparser 0.25.1 (registry+https://github.com/rust-lang/crates.io-index)",
"derive_more 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)",
"fxhash 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "fxhash 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
"matches 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "matches 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
@ -3502,6 +3522,19 @@ dependencies = [
"thin-slice 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "thin-slice 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]]
name = "semver"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "semver-parser"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]] [[package]]
name = "serde" name = "serde"
version = "1.0.80" version = "1.0.80"
@ -3523,7 +3556,7 @@ name = "serde_derive"
version = "1.0.80" version = "1.0.80"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"proc-macro2 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro2 0.4.26 (registry+https://github.com/rust-lang/crates.io-index)",
"quote 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)",
"syn 0.15.22 (registry+https://github.com/rust-lang/crates.io-index)", "syn 0.15.22 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
@ -3744,7 +3777,7 @@ name = "servo_media_derive"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/servo/media#4bed1cdc9dc9cc825080ae2d8d1dfa776b042199" source = "git+https://github.com/servo/media#4bed1cdc9dc9cc825080ae2d8d1dfa776b042199"
dependencies = [ dependencies = [
"proc-macro2 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro2 0.4.26 (registry+https://github.com/rust-lang/crates.io-index)",
"quote 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)",
"syn 0.15.22 (registry+https://github.com/rust-lang/crates.io-index)", "syn 0.15.22 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
@ -3949,7 +3982,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"phf_generator 0.7.23 (registry+https://github.com/rust-lang/crates.io-index)", "phf_generator 0.7.23 (registry+https://github.com/rust-lang/crates.io-index)",
"phf_shared 0.7.23 (registry+https://github.com/rust-lang/crates.io-index)", "phf_shared 0.7.23 (registry+https://github.com/rust-lang/crates.io-index)",
"proc-macro2 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro2 0.4.26 (registry+https://github.com/rust-lang/crates.io-index)",
"quote 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache_shared 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "string_cache_shared 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
@ -3976,6 +4009,7 @@ dependencies = [
"byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)", "byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)",
"crossbeam-channel 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "crossbeam-channel 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"cssparser 0.25.1 (registry+https://github.com/rust-lang/crates.io-index)", "cssparser 0.25.1 (registry+https://github.com/rust-lang/crates.io-index)",
"derive_more 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)",
"encoding_rs 0.8.12 (registry+https://github.com/rust-lang/crates.io-index)", "encoding_rs 0.8.12 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.19.4 (registry+https://github.com/rust-lang/crates.io-index)", "euclid 0.19.4 (registry+https://github.com/rust-lang/crates.io-index)",
"fallible 0.0.1", "fallible 0.0.1",
@ -4027,7 +4061,7 @@ name = "style_derive"
version = "0.0.1" version = "0.0.1"
dependencies = [ dependencies = [
"darling 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "darling 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
"proc-macro2 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro2 0.4.26 (registry+https://github.com/rust-lang/crates.io-index)",
"quote 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)",
"syn 0.15.22 (registry+https://github.com/rust-lang/crates.io-index)", "syn 0.15.22 (registry+https://github.com/rust-lang/crates.io-index)",
"synstructure 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)", "synstructure 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)",
@ -4084,7 +4118,7 @@ name = "syn"
version = "0.15.22" version = "0.15.22"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"proc-macro2 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro2 0.4.26 (registry+https://github.com/rust-lang/crates.io-index)",
"quote 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)",
"unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
@ -4094,7 +4128,7 @@ name = "synstructure"
version = "0.10.1" version = "0.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"proc-macro2 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro2 0.4.26 (registry+https://github.com/rust-lang/crates.io-index)",
"quote 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)",
"syn 0.15.22 (registry+https://github.com/rust-lang/crates.io-index)", "syn 0.15.22 (registry+https://github.com/rust-lang/crates.io-index)",
"unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
@ -5014,6 +5048,7 @@ dependencies = [
"checksum darling_macro 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9973050ba46be2a2935a7b316147f41a808ac604b8f0fef6eba77fd47a89daeb" "checksum darling_macro 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9973050ba46be2a2935a7b316147f41a808ac604b8f0fef6eba77fd47a89daeb"
"checksum dbus 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3d975a175aa2dced1a6cd410b89a1bf23918f301eab2b6f7c5e608291b757639" "checksum dbus 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3d975a175aa2dced1a6cd410b89a1bf23918f301eab2b6f7c5e608291b757639"
"checksum deflate 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)" = "ebb02aaf4b775afc96684b8402510a338086974e38570a1f65bea8c202eb77a7" "checksum deflate 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)" = "ebb02aaf4b775afc96684b8402510a338086974e38570a1f65bea8c202eb77a7"
"checksum derive_more 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3f57d78cf3bd45270dad4e70c21ec77a960b36c7a841ff9db76aaa775a8fb871"
"checksum device 0.0.1 (git+https://github.com/servo/devices)" = "<none>" "checksum device 0.0.1 (git+https://github.com/servo/devices)" = "<none>"
"checksum digest 0.7.6 (registry+https://github.com/rust-lang/crates.io-index)" = "03b072242a8cbaf9c145665af9d250c59af3b958f83ed6824e13533cf76d5b90" "checksum digest 0.7.6 (registry+https://github.com/rust-lang/crates.io-index)" = "03b072242a8cbaf9c145665af9d250c59af3b958f83ed6824e13533cf76d5b90"
"checksum digest 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "05f47366984d3ad862010e22c7ce81a7dbcaebbdfb37241a620f8b6596ee135c" "checksum digest 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "05f47366984d3ad862010e22c7ce81a7dbcaebbdfb37241a620f8b6596ee135c"
@ -5194,7 +5229,7 @@ dependencies = [
"checksum png 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f54b9600d584d3b8a739e1662a595fab051329eff43f20e7d8cc22872962145b" "checksum png 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f54b9600d584d3b8a739e1662a595fab051329eff43f20e7d8cc22872962145b"
"checksum podio 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "780fb4b6698bbf9cf2444ea5d22411cef2953f0824b98f33cf454ec5615645bd" "checksum podio 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "780fb4b6698bbf9cf2444ea5d22411cef2953f0824b98f33cf454ec5615645bd"
"checksum precomputed-hash 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c" "checksum precomputed-hash 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c"
"checksum proc-macro2 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "effdb53b25cdad54f8f48843d67398f7ef2e14f12c1b4cb4effc549a6462a4d6" "checksum proc-macro2 0.4.26 (registry+https://github.com/rust-lang/crates.io-index)" = "38fddd23d98b2144d197c0eca5705632d4fe2667d14a6be5df8934f8d74f1978"
"checksum procedural-masquerade 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "9a1574a51c3fd37b26d2c0032b649d08a7d51d4cca9c41bbc5bf7118fa4509d0" "checksum procedural-masquerade 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "9a1574a51c3fd37b26d2c0032b649d08a7d51d4cca9c41bbc5bf7118fa4509d0"
"checksum quick-error 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "eda5fe9b71976e62bc81b781206aaa076401769b2143379d3eb2118388babac4" "checksum quick-error 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "eda5fe9b71976e62bc81b781206aaa076401769b2143379d3eb2118388babac4"
"checksum quote 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)" = "e44651a0dc4cdd99f71c83b561e221f714912d11af1a4dff0631f923d53af035" "checksum quote 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)" = "e44651a0dc4cdd99f71c83b561e221f714912d11af1a4dff0631f923d53af035"
@ -5214,11 +5249,14 @@ dependencies = [
"checksum rust-webvr 0.9.12 (registry+https://github.com/rust-lang/crates.io-index)" = "9355af34c9a072f567d8f3a7e51ef170935b5bf22d8d0450f0e8c41da6df46a2" "checksum rust-webvr 0.9.12 (registry+https://github.com/rust-lang/crates.io-index)" = "9355af34c9a072f567d8f3a7e51ef170935b5bf22d8d0450f0e8c41da6df46a2"
"checksum rust-webvr-api 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)" = "712e22ba3c03a7075b40842ae91029a0ab96a81f95e97c0cf623800ec0cbac07" "checksum rust-webvr-api 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)" = "712e22ba3c03a7075b40842ae91029a0ab96a81f95e97c0cf623800ec0cbac07"
"checksum rustc-demangle 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "3058a43ada2c2d0b92b3ae38007a2d0fa5e9db971be260e0171408a4ff471c95" "checksum rustc-demangle 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "3058a43ada2c2d0b92b3ae38007a2d0fa5e9db971be260e0171408a4ff471c95"
"checksum rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a"
"checksum rusttype 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)" = "b8eb11f5b0a98c8eca2fb1483f42646d8c340e83e46ab416f8a063a0fd0eeb20" "checksum rusttype 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)" = "b8eb11f5b0a98c8eca2fb1483f42646d8c340e83e46ab416f8a063a0fd0eeb20"
"checksum safemem 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e27a8b19b835f7aea908818e871f5cc3a5a186550c30773be987e155e8163d8f" "checksum safemem 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e27a8b19b835f7aea908818e871f5cc3a5a186550c30773be987e155e8163d8f"
"checksum same-file 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "cfb6eded0b06a0b512c8ddbcf04089138c9b4362c2f696f3c3d76039d68f3637" "checksum same-file 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "cfb6eded0b06a0b512c8ddbcf04089138c9b4362c2f696f3c3d76039d68f3637"
"checksum scoped_threadpool 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "3ef399c8893e8cb7aa9696e895427fab3a6bf265977bb96e126f24ddd2cda85a" "checksum scoped_threadpool 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "3ef399c8893e8cb7aa9696e895427fab3a6bf265977bb96e126f24ddd2cda85a"
"checksum scopeguard 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "c79eb2c3ac4bc2507cda80e7f3ac5b88bd8eae4c0914d5663e6a8933994be918" "checksum scopeguard 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "c79eb2c3ac4bc2507cda80e7f3ac5b88bd8eae4c0914d5663e6a8933994be918"
"checksum semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403"
"checksum semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3"
"checksum serde 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)" = "15c141fc7027dd265a47c090bf864cf62b42c4d228bbcf4e51a0c9e2b0d3f7ef" "checksum serde 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)" = "15c141fc7027dd265a47c090bf864cf62b42c4d228bbcf4e51a0c9e2b0d3f7ef"
"checksum serde_bytes 0.10.4 (registry+https://github.com/rust-lang/crates.io-index)" = "adb6e51a6b3696b301bc221d785f898b4457c619b51d7ce195a6d20baecb37b3" "checksum serde_bytes 0.10.4 (registry+https://github.com/rust-lang/crates.io-index)" = "adb6e51a6b3696b301bc221d785f898b4457c619b51d7ce195a6d20baecb37b3"
"checksum serde_derive 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)" = "225de307c6302bec3898c51ca302fc94a7a1697ef0845fcee6448f33c032249c" "checksum serde_derive 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)" = "225de307c6302bec3898c51ca302fc94a7a1697ef0845fcee6448f33c032249c"

View file

@ -209,6 +209,8 @@ partial interface CSSStyleDeclaration {
[CEReactions, SetterThrows, TreatNullAs=EmptyString] attribute DOMString filter; [CEReactions, SetterThrows, TreatNullAs=EmptyString] attribute DOMString filter;
[CEReactions, SetterThrows, TreatNullAs=EmptyString] attribute DOMString inset;
[CEReactions, SetterThrows, TreatNullAs=EmptyString] attribute DOMString lineHeight; [CEReactions, SetterThrows, TreatNullAs=EmptyString] attribute DOMString lineHeight;
[CEReactions, SetterThrows, TreatNullAs=EmptyString] attribute DOMString line-height; [CEReactions, SetterThrows, TreatNullAs=EmptyString] attribute DOMString line-height;

View file

@ -23,6 +23,7 @@ bench = []
bitflags = "1.0" bitflags = "1.0"
matches = "0.1" matches = "0.1"
cssparser = "0.25" cssparser = "0.25"
derive_more = "0.13"
log = "0.4" log = "0.4"
fxhash = "0.2" fxhash = "0.2"
phf = "0.7.18" phf = "0.7.18"

View file

@ -23,7 +23,6 @@ use servo_arc::{Arc, HeaderWithLength, ThinArc};
use smallvec::{self, SmallVec}; use smallvec::{self, SmallVec};
use std::cmp; use std::cmp;
use std::iter; use std::iter;
use std::ops::{Add, AddAssign};
use std::ptr; use std::ptr;
use std::slice; use std::slice;
@ -222,44 +221,13 @@ impl SpecificityAndFlags {
const MAX_10BIT: u32 = (1u32 << 10) - 1; const MAX_10BIT: u32 = (1u32 << 10) - 1;
#[derive(Clone, Copy, Eq, Ord, PartialEq, PartialOrd)] #[derive(Add, AddAssign, Clone, Copy, Default, Eq, Ord, PartialEq, PartialOrd)]
struct Specificity { struct Specificity {
id_selectors: u32, id_selectors: u32,
class_like_selectors: u32, class_like_selectors: u32,
element_selectors: u32, element_selectors: u32,
} }
impl AddAssign for Specificity {
#[inline]
fn add_assign(&mut self, rhs: Self) {
self.id_selectors += rhs.id_selectors;
self.class_like_selectors += rhs.class_like_selectors;
self.element_selectors += rhs.element_selectors;
}
}
impl Add for Specificity {
type Output = Specificity;
fn add(self, rhs: Specificity) -> Specificity {
Specificity {
id_selectors: self.id_selectors + rhs.id_selectors,
class_like_selectors: self.class_like_selectors + rhs.class_like_selectors,
element_selectors: self.element_selectors + rhs.element_selectors,
}
}
}
impl Default for Specificity {
fn default() -> Specificity {
Specificity {
id_selectors: 0,
class_like_selectors: 0,
element_selectors: 0,
}
}
}
impl From<u32> for Specificity { impl From<u32> for Specificity {
#[inline] #[inline]
fn from(value: u32) -> Specificity { fn from(value: u32) -> Specificity {

View file

@ -9,6 +9,8 @@
extern crate bitflags; extern crate bitflags;
#[macro_use] #[macro_use]
extern crate cssparser; extern crate cssparser;
#[macro_use]
extern crate derive_more;
extern crate fxhash; extern crate fxhash;
#[macro_use] #[macro_use]
extern crate log; extern crate log;

View file

@ -31,6 +31,7 @@ bitflags = "1.0"
byteorder = "1.0" byteorder = "1.0"
cssparser = "0.25" cssparser = "0.25"
crossbeam-channel = { version = "0.3", optional = true } crossbeam-channel = { version = "0.3", optional = true }
derive_more = "0.13"
new_debug_unreachable = "1.0" new_debug_unreachable = "1.0"
encoding_rs = {version = "0.8", optional = true} encoding_rs = {version = "0.8", optional = true}
euclid = "0.19" euclid = "0.19"

View file

@ -304,7 +304,7 @@ impl ElementCascadeInputs {
/// Statistics gathered during the traversal. We gather statistics on each /// Statistics gathered during the traversal. We gather statistics on each
/// thread and then combine them after the threads join via the Add /// thread and then combine them after the threads join via the Add
/// implementation below. /// implementation below.
#[derive(Default)] #[derive(AddAssign, Clone, Default)]
pub struct PerThreadTraversalStatistics { pub struct PerThreadTraversalStatistics {
/// The total number of elements traversed. /// The total number of elements traversed.
pub elements_traversed: u32, pub elements_traversed: u32,
@ -319,20 +319,6 @@ pub struct PerThreadTraversalStatistics {
pub styles_reused: u32, pub styles_reused: u32,
} }
/// Implementation of Add to aggregate statistics across different threads.
impl<'a> ops::Add for &'a PerThreadTraversalStatistics {
type Output = PerThreadTraversalStatistics;
fn add(self, other: Self) -> PerThreadTraversalStatistics {
PerThreadTraversalStatistics {
elements_traversed: self.elements_traversed + other.elements_traversed,
elements_styled: self.elements_styled + other.elements_styled,
elements_matched: self.elements_matched + other.elements_matched,
styles_shared: self.styles_shared + other.styles_shared,
styles_reused: self.styles_reused + other.styles_reused,
}
}
}
/// Statistics gathered during the traversal plus some information from /// Statistics gathered during the traversal plus some information from
/// other sources including stylist. /// other sources including stylist.
#[derive(Default)] #[derive(Default)]

View file

@ -161,10 +161,11 @@ pub fn traverse_dom<E, D>(
let parallel = maybe_tls.is_some(); let parallel = maybe_tls.is_some();
if let Some(ref mut tls) = maybe_tls { if let Some(ref mut tls) = maybe_tls {
let slots = unsafe { tls.unsafe_get() }; let slots = unsafe { tls.unsafe_get() };
aggregate = slots.iter().fold(aggregate, |acc, t| match *t.borrow() { for slot in slots {
None => acc, if let Some(ref cx) = *slot.borrow() {
Some(ref cx) => &cx.statistics + &acc, aggregate += cx.statistics.clone();
}); }
}
} }
if report_stats { if report_stats {

View file

@ -38,6 +38,8 @@ extern crate crossbeam_channel;
extern crate cssparser; extern crate cssparser;
#[macro_use] #[macro_use]
extern crate debug_unreachable; extern crate debug_unreachable;
#[macro_use]
extern crate derive_more;
extern crate euclid; extern crate euclid;
extern crate fallible; extern crate fallible;
extern crate fxhash; extern crate fxhash;

View file

@ -793,6 +793,58 @@
% endif % endif
</%def> </%def>
// A shorthand of kind `<property-1> <property-2>?` where both properties have
// the same type.
<%def name="two_properties_shorthand(
name,
first_property,
second_property,
parser_function,
needs_context=True,
**kwargs
)">
<%call expr="self.shorthand(name, sub_properties=' '.join([first_property, second_property]), **kwargs)">
#[allow(unused_imports)]
use crate::parser::Parse;
use crate::values::specified;
pub fn parse_value<'i, 't>(
context: &ParserContext,
input: &mut Parser<'i, 't>,
) -> Result<Longhands, ParseError<'i>> {
let parse_one = |_c: &ParserContext, input: &mut Parser<'i, 't>| {
% if needs_context:
${parser_function}(_c, input)
% else:
${parser_function}(input)
% endif
};
let first = parse_one(context, input)?;
let second =
input.try(|input| parse_one(context, input)).unwrap_or_else(|_| first.clone());
Ok(expanded! {
${to_rust_ident(first_property)}: first,
${to_rust_ident(second_property)}: second,
})
}
impl<'a> ToCss for LonghandsToSerialize<'a> {
fn to_css<W>(&self, dest: &mut CssWriter<W>) -> fmt::Result where W: fmt::Write {
let first = &self.${to_rust_ident(first_property)};
let second = &self.${to_rust_ident(second_property)};
first.to_css(dest)?;
if first != second {
dest.write_str(" ")?;
second.to_css(dest)?;
}
Ok(())
}
}
</%call>
</%def>
<%def name="four_sides_shorthand(name, sub_property_pattern, parser_function, <%def name="four_sides_shorthand(name, sub_property_pattern, parser_function,
needs_context=True, allow_quirks=False, **kwargs)"> needs_context=True, allow_quirks=False, **kwargs)">
<% sub_properties=' '.join(sub_property_pattern % side for side in PHYSICAL_SIDES) %> <% sub_properties=' '.join(sub_property_pattern % side for side in PHYSICAL_SIDES) %>

View file

@ -61,15 +61,6 @@
)} )}
% endfor % endfor
${helpers.gecko_keyword_conversion(
Keyword('border-style',
"none solid double dotted dashed hidden groove ridge inset outset",
gecko_enum_prefix="StyleBorderStyle",
gecko_inexhaustive=True),
type="crate::values::specified::BorderStyle",
)}
// FIXME(#4126): when gfx supports painting it, make this Size2D<LengthPercentage>
% for corner in ALL_CORNERS: % for corner in ALL_CORNERS:
<% <%
corner_name = corner[0] corner_name = corner[0]

View file

@ -4,112 +4,28 @@
<%namespace name="helpers" file="/helpers.mako.rs" /> <%namespace name="helpers" file="/helpers.mako.rs" />
<%helpers:shorthand ${helpers.two_properties_shorthand(
name="overflow" "overflow",
flags="SHORTHAND_IN_GETCS" "overflow-x",
sub_properties="overflow-x overflow-y" "overflow-y",
spec="https://drafts.csswg.org/css-overflow/#propdef-overflow" "specified::Overflow::parse",
> flags="SHORTHAND_IN_GETCS",
use crate::properties::longhands::overflow_x::parse as parse_overflow; needs_context=False,
% if product == "gecko": spec="https://drafts.csswg.org/css-overflow/#propdef-overflow",
use crate::properties::longhands::overflow_x::SpecifiedValue; )}
% endif
pub fn parse_value<'i, 't>( ${helpers.two_properties_shorthand(
context: &ParserContext, "overflow-clip-box",
input: &mut Parser<'i, 't>, "overflow-clip-box-block",
) -> Result<Longhands, ParseError<'i>> { "overflow-clip-box-inline",
% if product == "gecko": "specified::OverflowClipBox::parse",
use crate::gecko_bindings::structs; enabled_in="ua",
let moz_kw_enabled = unsafe { needs_context=False,
structs::StaticPrefs_sVarCache_layout_css_overflow_moz_scrollbars_enabled gecko_pref="layout.css.overflow-clip-box.enabled",
};
if moz_kw_enabled {
let moz_kw_found = input.try(|input| {
try_match_ident_ignore_ascii_case! { input,
"-moz-scrollbars-horizontal" => {
Ok(expanded! {
overflow_x: SpecifiedValue::Scroll,
overflow_y: SpecifiedValue::Hidden,
})
}
"-moz-scrollbars-vertical" => {
Ok(expanded! {
overflow_x: SpecifiedValue::Hidden,
overflow_y: SpecifiedValue::Scroll,
})
}
"-moz-scrollbars-none" => {
Ok(expanded! {
overflow_x: SpecifiedValue::Hidden,
overflow_y: SpecifiedValue::Hidden,
})
}
}
});
if moz_kw_found.is_ok() {
return moz_kw_found
}
}
% endif
let overflow_x = parse_overflow(context, input)?;
let overflow_y =
input.try(|i| parse_overflow(context, i)).unwrap_or(overflow_x);
Ok(expanded! {
overflow_x: overflow_x,
overflow_y: overflow_y,
})
}
impl<'a> ToCss for LonghandsToSerialize<'a> {
fn to_css<W>(&self, dest: &mut CssWriter<W>) -> fmt::Result where W: fmt::Write {
self.overflow_x.to_css(dest)?;
if self.overflow_x != self.overflow_y {
dest.write_char(' ')?;
self.overflow_y.to_css(dest)?;
}
Ok(())
}
}
</%helpers:shorthand>
<%helpers:shorthand
name="overflow-clip-box"
sub_properties="overflow-clip-box-block overflow-clip-box-inline"
enabled_in="ua"
gecko_pref="layout.css.overflow-clip-box.enabled"
spec="Internal, may be standardized in the future " spec="Internal, may be standardized in the future "
"(https://developer.mozilla.org/en-US/docs/Web/CSS/overflow-clip-box)" "(https://developer.mozilla.org/en-US/docs/Web/CSS/overflow-clip-box)",
products="gecko" products="gecko",
> )}
use crate::values::specified::OverflowClipBox;
pub fn parse_value<'i, 't>(
_: &ParserContext,
input: &mut Parser<'i, 't>,
) -> Result<Longhands, ParseError<'i>> {
let block_value = OverflowClipBox::parse(input)?;
let inline_value =
input.try(|input| OverflowClipBox::parse(input)).unwrap_or(block_value);
Ok(expanded! {
overflow_clip_box_block: block_value,
overflow_clip_box_inline: inline_value,
})
}
impl<'a> ToCss for LonghandsToSerialize<'a> {
fn to_css<W>(&self, dest: &mut CssWriter<W>) -> fmt::Result where W: fmt::Write {
self.overflow_clip_box_block.to_css(dest)?;
if self.overflow_clip_box_block != self.overflow_clip_box_inline {
dest.write_str(" ")?;
self.overflow_clip_box_inline.to_css(dest)?;
}
Ok(())
}
}
</%helpers:shorthand>
macro_rules! try_parse_one { macro_rules! try_parse_one {
($context: expr, $input: expr, $var: ident, $prop_module: ident) => { ($context: expr, $input: expr, $var: ident, $prop_module: ident) => {
@ -417,36 +333,16 @@ macro_rules! try_parse_one {
} }
</%helpers:shorthand> </%helpers:shorthand>
<%helpers:shorthand name="overscroll-behavior" products="gecko" ${helpers.two_properties_shorthand(
gecko_pref="layout.css.overscroll-behavior.enabled" "overscroll-behavior",
sub_properties="overscroll-behavior-x overscroll-behavior-y" "overscroll-behavior-x",
spec="https://wicg.github.io/overscroll-behavior/#overscroll-behavior-properties"> "overscroll-behavior-y",
pub fn parse_value<'i, 't>( "specified::OverscrollBehavior::parse",
_: &ParserContext, needs_context=False,
input: &mut Parser<'i, 't>, products="gecko",
) -> Result<Longhands, ParseError<'i>> { gecko_pref="layout.css.overscroll-behavior.enabled",
use crate::values::specified::OverscrollBehavior; spec="https://wicg.github.io/overscroll-behavior/#overscroll-behavior-properties",
let behavior_x = OverscrollBehavior::parse(input)?; )}
let behavior_y = input.try(OverscrollBehavior::parse).unwrap_or(behavior_x);
Ok(expanded! {
overscroll_behavior_x: behavior_x,
overscroll_behavior_y: behavior_y,
})
}
impl<'a> ToCss for LonghandsToSerialize<'a> {
// Serializes into the single keyword value if both overscroll-behavior-x and overscroll-behavior-y are same.
// Otherwise into two values separated by a space.
fn to_css<W>(&self, dest: &mut CssWriter<W>) -> fmt::Result where W: fmt::Write {
self.overscroll_behavior_x.to_css(dest)?;
if self.overscroll_behavior_y != self.overscroll_behavior_x {
dest.write_str(" ")?;
self.overscroll_behavior_y.to_css(dest)?;
}
Ok(())
}
}
</%helpers:shorthand>
<%helpers:shorthand <%helpers:shorthand
name="page-break-before" name="page-break-before"

View file

@ -4,51 +4,27 @@
<%namespace name="helpers" file="/helpers.mako.rs" /> <%namespace name="helpers" file="/helpers.mako.rs" />
${helpers.four_sides_shorthand("margin", "margin-%s", "specified::LengthPercentageOrAuto::parse", ${helpers.four_sides_shorthand(
spec="https://drafts.csswg.org/css-box/#propdef-margin", "margin",
allowed_in_page_rule=True, "margin-%s",
allow_quirks=True)} "specified::LengthPercentageOrAuto::parse",
spec="https://drafts.csswg.org/css-box/#propdef-margin",
allowed_in_page_rule=True,
allow_quirks=True,
)}
% for axis in ["block", "inline"]: ${helpers.two_properties_shorthand(
<% "margin-block",
spec = "https://drafts.csswg.org/css-logical/#propdef-margin-%s" % axis "margin-block-start",
%> "margin-block-end",
<%helpers:shorthand "specified::LengthPercentageOrAuto::parse",
name="margin-${axis}" spec="https://drafts.csswg.org/css-logical/#propdef-margin-block"
sub_properties="${' '.join( )}
'margin-%s-%s' % (axis, side)
for side in ['start', 'end']
)}"
spec="${spec}">
use crate::parser::Parse; ${helpers.two_properties_shorthand(
use crate::values::specified::length::LengthPercentageOrAuto; "margin-inline",
pub fn parse_value<'i, 't>( "margin-inline-start",
context: &ParserContext, "margin-inline-end",
input: &mut Parser<'i, 't>, "specified::LengthPercentageOrAuto::parse",
) -> Result<Longhands, ParseError<'i>> { spec="https://drafts.csswg.org/css-logical/#propdef-margin-inline"
let start_value = LengthPercentageOrAuto::parse(context, input)?; )}
let end_value =
input.try(|input| LengthPercentageOrAuto::parse(context, input))
.unwrap_or_else(|_| start_value.clone());
Ok(expanded! {
margin_${axis}_start: start_value,
margin_${axis}_end: end_value,
})
}
impl<'a> ToCss for LonghandsToSerialize<'a> {
fn to_css<W>(&self, dest: &mut CssWriter<W>) -> fmt::Result where W: fmt::Write {
self.margin_${axis}_start.to_css(dest)?;
if self.margin_${axis}_end != self.margin_${axis}_start {
dest.write_str(" ")?;
self.margin_${axis}_end.to_css(dest)?;
}
Ok(())
}
}
</%helpers:shorthand>
% endfor

View file

@ -4,50 +4,26 @@
<%namespace name="helpers" file="/helpers.mako.rs" /> <%namespace name="helpers" file="/helpers.mako.rs" />
${helpers.four_sides_shorthand("padding", "padding-%s", "specified::NonNegativeLengthPercentage::parse", ${helpers.four_sides_shorthand(
spec="https://drafts.csswg.org/css-box-3/#propdef-padding", "padding",
allow_quirks=True)} "padding-%s",
"specified::NonNegativeLengthPercentage::parse",
spec="https://drafts.csswg.org/css-box-3/#propdef-padding",
allow_quirks=True,
)}
% for axis in ["block", "inline"]: ${helpers.two_properties_shorthand(
<% "padding-block",
spec = "https://drafts.csswg.org/css-logical/#propdef-padding-%s" % axis "padding-block-start",
%> "padding-block-end",
<%helpers:shorthand "specified::NonNegativeLengthPercentage::parse",
name="padding-${axis}" spec="https://drafts.csswg.org/css-logical/#propdef-padding-block"
sub_properties="${' '.join( )}
'padding-%s-%s' % (axis, side)
for side in ['start', 'end']
)}"
spec="${spec}">
use crate::parser::Parse; ${helpers.two_properties_shorthand(
use crate::values::specified::length::NonNegativeLengthPercentage; "padding-inline",
pub fn parse_value<'i, 't>( "padding-inline-start",
context: &ParserContext, "padding-inline-end",
input: &mut Parser<'i, 't>, "specified::NonNegativeLengthPercentage::parse",
) -> Result<Longhands, ParseError<'i>> { spec="https://drafts.csswg.org/css-logical/#propdef-padding-inline"
let start_value = NonNegativeLengthPercentage::parse(context, input)?; )}
let end_value =
input.try(|input| NonNegativeLengthPercentage::parse(context, input))
.unwrap_or_else(|_| start_value.clone());
Ok(expanded! {
padding_${axis}_start: start_value,
padding_${axis}_end: end_value,
})
}
impl<'a> ToCss for LonghandsToSerialize<'a> {
fn to_css<W>(&self, dest: &mut CssWriter<W>) -> fmt::Result where W: fmt::Write {
self.padding_${axis}_start.to_css(dest)?;
if self.padding_${axis}_end != self.padding_${axis}_start {
dest.write_str(" ")?;
self.padding_${axis}_end.to_css(dest)?;
}
Ok(())
}
}
</%helpers:shorthand>
% endfor

View file

@ -763,46 +763,27 @@
} }
</%helpers:shorthand> </%helpers:shorthand>
% for axis in ["block", "inline"]: // See https://github.com/w3c/csswg-drafts/issues/3525 for the quirks stuff.
<% ${helpers.four_sides_shorthand(
spec = "https://drafts.csswg.org/css-logical/#propdef-inset-%s" % axis "inset",
%> "%s",
<%helpers:shorthand "specified::LengthPercentageOrAuto::parse",
name="inset-${axis}" spec="https://drafts.csswg.org/css-logical/#propdef-inset",
sub_properties="${' '.join( allow_quirks=False,
'inset-%s-%s' % (axis, side) )}
for side in ['start', 'end']
)}"
spec="${spec}">
use crate::parser::Parse; ${helpers.two_properties_shorthand(
use crate::values::specified::length::LengthPercentageOrAuto; "inset-block",
pub fn parse_value<'i, 't>( "inset-block-start",
context: &ParserContext, "inset-block-end",
input: &mut Parser<'i, 't>, "specified::LengthPercentageOrAuto::parse",
) -> Result<Longhands, ParseError<'i>> { spec="https://drafts.csswg.org/css-logical/#propdef-inset-block"
let start_value = LengthPercentageOrAuto::parse(context, input)?; )}
let end_value =
input.try(|input| LengthPercentageOrAuto::parse(context, input))
.unwrap_or_else(|_| start_value.clone());
Ok(expanded! { ${helpers.two_properties_shorthand(
inset_${axis}_start: start_value, "inset-inline",
inset_${axis}_end: end_value, "inset-inline-start",
}) "inset-inline-end",
} "specified::LengthPercentageOrAuto::parse",
spec="https://drafts.csswg.org/css-logical/#propdef-inset-inline"
impl<'a> ToCss for LonghandsToSerialize<'a> { )}
fn to_css<W>(&self, dest: &mut CssWriter<W>) -> fmt::Result where W: fmt::Write {
self.inset_${axis}_start.to_css(dest)?;
if self.inset_${axis}_end != self.inset_${axis}_start {
dest.write_str(" ")?;
self.inset_${axis}_end.to_css(dest)?;
}
Ok(())
}
}
</%helpers:shorthand>
% endfor

View file

@ -9,13 +9,12 @@ use crate::values::CSSFloat;
use num_traits::Zero; use num_traits::Zero;
use std::f64::consts::PI; use std::f64::consts::PI;
use std::fmt::{self, Write}; use std::fmt::{self, Write};
use std::ops::Add;
use std::{f32, f64}; use std::{f32, f64};
use style_traits::{CssWriter, ToCss}; use style_traits::{CssWriter, ToCss};
/// A computed angle in degrees. /// A computed angle in degrees.
#[cfg_attr(feature = "servo", derive(Deserialize, Serialize))] #[cfg_attr(feature = "servo", derive(Deserialize, Serialize))]
#[derive(Animate, Clone, Copy, Debug, MallocSizeOf, PartialEq, PartialOrd, ToAnimatedZero)] #[derive(Add, Animate, Clone, Copy, Debug, MallocSizeOf, PartialEq, PartialOrd, ToAnimatedZero)]
pub struct Angle(CSSFloat); pub struct Angle(CSSFloat);
impl ToCss for Angle { impl ToCss for Angle {
@ -66,15 +65,6 @@ impl Angle {
} }
} }
impl Add for Angle {
type Output = Self;
#[inline]
fn add(self, rhs: Self) -> Self {
Angle(self.0 + rhs.0)
}
}
impl Zero for Angle { impl Zero for Angle {
#[inline] #[inline]
fn zero() -> Self { fn zero() -> Self {

View file

@ -38,7 +38,17 @@ pub type Perspective = GenericPerspective<NonNegativeLength>;
#[allow(missing_docs)] #[allow(missing_docs)]
#[cfg_attr(feature = "servo", derive(Deserialize, Serialize))] #[cfg_attr(feature = "servo", derive(Deserialize, Serialize))]
#[derive( #[derive(
Clone, Copy, Debug, Eq, Hash, MallocSizeOf, Parse, PartialEq, SpecifiedValueInfo, ToCss, Clone,
Copy,
Debug,
Eq,
FromPrimitive,
Hash,
MallocSizeOf,
Parse,
PartialEq,
SpecifiedValueInfo,
ToCss,
)] )]
#[repr(u8)] #[repr(u8)]
/// A computed value for the `float` property. /// A computed value for the `float` property.
@ -97,7 +107,17 @@ impl ToComputedValue for SpecifiedFloat {
#[allow(missing_docs)] #[allow(missing_docs)]
#[cfg_attr(feature = "servo", derive(Deserialize, Serialize))] #[cfg_attr(feature = "servo", derive(Deserialize, Serialize))]
#[derive( #[derive(
Clone, Copy, Debug, Eq, Hash, MallocSizeOf, Parse, PartialEq, SpecifiedValueInfo, ToCss, Clone,
Copy,
Debug,
Eq,
FromPrimitive,
Hash,
MallocSizeOf,
Parse,
PartialEq,
SpecifiedValueInfo,
ToCss,
)] )]
/// A computed value for the `clear` property. /// A computed value for the `clear` property.
pub enum Clear { pub enum Clear {

View file

@ -31,7 +31,7 @@ pub trait ComputeSquaredDistance {
} }
/// A distance between two animatable values. /// A distance between two animatable values.
#[derive(Clone, Copy, Debug)] #[derive(Add, Clone, Copy, Debug, From)]
pub struct SquaredDistance { pub struct SquaredDistance {
value: f64, value: f64,
} }
@ -114,24 +114,6 @@ impl SquaredDistance {
} }
} }
impl From<SquaredDistance> for f64 {
#[inline]
fn from(distance: SquaredDistance) -> Self {
distance.value
}
}
impl Add for SquaredDistance {
type Output = Self;
#[inline]
fn add(self, rhs: Self) -> Self {
SquaredDistance {
value: self.value + rhs.value,
}
}
}
impl Sum for SquaredDistance { impl Sum for SquaredDistance {
fn sum<I>(iter: I) -> Self fn sum<I>(iter: I) -> Self
where where

View file

@ -30,6 +30,7 @@ use style_traits::{CssWriter, ParseError, ToCss};
Copy, Copy,
Debug, Debug,
Eq, Eq,
FromPrimitive,
MallocSizeOf, MallocSizeOf,
Ord, Ord,
Parse, Parse,

View file

@ -11,7 +11,6 @@ use crate::values::CSSFloat;
use cssparser::Parser; use cssparser::Parser;
use std::fmt::{self, Write}; use std::fmt::{self, Write};
use std::iter::{Cloned, Peekable}; use std::iter::{Cloned, Peekable};
use std::ops::AddAssign;
use std::slice; use std::slice;
use style_traits::values::SequenceWriter; use style_traits::values::SequenceWriter;
use style_traits::{CssWriter, ParseError, StyleParseErrorKind, ToCss}; use style_traits::{CssWriter, ParseError, StyleParseErrorKind, ToCss};
@ -491,6 +490,7 @@ impl IsAbsolute {
/// The path coord type. /// The path coord type.
#[derive( #[derive(
AddAssign,
Animate, Animate,
Clone, Clone,
ComputeSquaredDistance, ComputeSquaredDistance,
@ -513,14 +513,6 @@ impl CoordPair {
} }
} }
impl AddAssign for CoordPair {
#[inline]
fn add_assign(&mut self, other: Self) {
self.0 += other.0;
self.1 += other.1;
}
}
/// The EllipticalArc flag type. /// The EllipticalArc flag type.
#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo)] #[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo)]
#[repr(C)] #[repr(C)]