Auto merge of #15735 - servo:cssparserup, r=emilio

Update cssparser to 0.11

<!-- Please describe your changes on the following line: -->

<s>Depends on https://github.com/servo/rust-cssparser/pull/122.</s>

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [ ] These changes fix #__ (github issue number if applicable).

<!-- Either: -->
- [ ] There are tests for these changes OR
- [ ] These changes do not require tests because _____

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

<!-- 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/15735)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2017-02-26 02:19:32 -08:00 committed by GitHub
commit 94e563e4d9
42 changed files with 143 additions and 175 deletions

48
Cargo.lock generated
View file

@ -275,7 +275,7 @@ version = "0.0.1"
dependencies = [ dependencies = [
"azure 0.14.0 (git+https://github.com/servo/rust-azure)", "azure 0.14.0 (git+https://github.com/servo/rust-azure)",
"canvas_traits 0.0.1", "canvas_traits 0.0.1",
"cssparser 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", "cssparser 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", "euclid 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)",
"gleam 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)", "gleam 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)",
"ipc-channel 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "ipc-channel 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
@ -290,7 +290,7 @@ dependencies = [
name = "canvas_traits" name = "canvas_traits"
version = "0.0.1" version = "0.0.1"
dependencies = [ dependencies = [
"cssparser 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", "cssparser 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", "euclid 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize_derive 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize_derive 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
@ -516,14 +516,26 @@ dependencies = [
[[package]] [[package]]
name = "cssparser" name = "cssparser"
version = "0.10.0" version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"cssparser-macros 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize 0.3.8 (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.21 (registry+https://github.com/rust-lang/crates.io-index)",
"quote 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 0.9.7 (registry+https://github.com/rust-lang/crates.io-index)", "serde 0.9.7 (registry+https://github.com/rust-lang/crates.io-index)",
"syn 0.10.8 (registry+https://github.com/rust-lang/crates.io-index)", "syn 0.11.6 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "cssparser-macros"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"phf_codegen 0.7.21 (registry+https://github.com/rust-lang/crates.io-index)",
"quote 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)",
"syn 0.11.6 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]] [[package]]
@ -905,7 +917,7 @@ version = "0.0.1"
dependencies = [ dependencies = [
"app_units 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "app_units 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"atomic_refcell 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "atomic_refcell 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"cssparser 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", "cssparser 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)",
"env_logger 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "env_logger 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", "euclid 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1316,7 +1328,7 @@ dependencies = [
"atomic_refcell 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "atomic_refcell 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"canvas_traits 0.0.1", "canvas_traits 0.0.1",
"cssparser 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", "cssparser 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", "euclid 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)",
"fnv 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", "fnv 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
"gfx 0.0.1", "gfx 0.0.1",
@ -1629,7 +1641,7 @@ name = "msg"
version = "0.0.1" version = "0.0.1"
dependencies = [ dependencies = [
"bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"cssparser 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", "cssparser 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize_derive 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize_derive 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 0.9.7 (registry+https://github.com/rust-lang/crates.io-index)", "serde 0.9.7 (registry+https://github.com/rust-lang/crates.io-index)",
@ -2208,7 +2220,8 @@ dependencies = [
"caseless 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "caseless 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
"cmake 0.1.20 (registry+https://github.com/rust-lang/crates.io-index)", "cmake 0.1.20 (registry+https://github.com/rust-lang/crates.io-index)",
"cookie 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", "cookie 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
"cssparser 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", "cssparser 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)",
"cssparser-macros 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"deny_public_fields 0.0.1", "deny_public_fields 0.0.1",
"devtools_traits 0.0.1", "devtools_traits 0.0.1",
"dom_struct 0.0.1", "dom_struct 0.0.1",
@ -2278,7 +2291,7 @@ dependencies = [
"app_units 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "app_units 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"atomic_refcell 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "atomic_refcell 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"canvas_traits 0.0.1", "canvas_traits 0.0.1",
"cssparser 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", "cssparser 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", "euclid 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)",
"gfx_traits 0.0.1", "gfx_traits 0.0.1",
"heapsize 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
@ -2347,7 +2360,8 @@ name = "selectors"
version = "0.18.0" version = "0.18.0"
dependencies = [ dependencies = [
"bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"cssparser 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", "cssparser 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)",
"cssparser-macros 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"fnv 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", "fnv 1.0.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)",
] ]
@ -2716,7 +2730,8 @@ dependencies = [
"bindgen 0.22.0 (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)", "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)", "cfg-if 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"cssparser 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", "cssparser 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)",
"cssparser-macros 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"encoding 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", "encoding 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", "euclid 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)",
"fnv 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", "fnv 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
@ -2735,7 +2750,6 @@ dependencies = [
"parking_lot 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
"pdqsort 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "pdqsort 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"phf 0.7.21 (registry+https://github.com/rust-lang/crates.io-index)", "phf 0.7.21 (registry+https://github.com/rust-lang/crates.io-index)",
"phf_codegen 0.7.21 (registry+https://github.com/rust-lang/crates.io-index)",
"rayon 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "rayon 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
"regex 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "regex 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"selectors 0.18.0", "selectors 0.18.0",
@ -2756,7 +2770,7 @@ name = "style_tests"
version = "0.0.1" version = "0.0.1"
dependencies = [ dependencies = [
"app_units 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "app_units 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"cssparser 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", "cssparser 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", "euclid 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)",
"html5ever-atoms 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "html5ever-atoms 0.2.0 (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)",
@ -2777,7 +2791,8 @@ name = "style_traits"
version = "0.0.1" version = "0.0.1"
dependencies = [ dependencies = [
"app_units 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "app_units 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"cssparser 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", "cssparser 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)",
"cssparser-macros 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", "euclid 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize_derive 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize_derive 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
@ -2791,7 +2806,7 @@ version = "0.0.1"
dependencies = [ dependencies = [
"app_units 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "app_units 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"atomic_refcell 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "atomic_refcell 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"cssparser 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", "cssparser 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)",
"env_logger 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "env_logger 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", "euclid 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)",
"geckoservo 0.0.1", "geckoservo 0.0.1",
@ -3377,7 +3392,8 @@ dependencies = [
"checksum core-foundation-sys 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "41115a6aa5d3e1e5ef98148373f25971d1fad53818553f216495f9e67e90a624" "checksum core-foundation-sys 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "41115a6aa5d3e1e5ef98148373f25971d1fad53818553f216495f9e67e90a624"
"checksum core-graphics 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ead017dcf77f503dc991f6b52de6084eeea60a94b0a652baa9bf88654a28e83f" "checksum core-graphics 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ead017dcf77f503dc991f6b52de6084eeea60a94b0a652baa9bf88654a28e83f"
"checksum core-text 4.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0e9719616a10f717628e074744f8c55df7b450f7a34d29c196d14f4498aad05d" "checksum core-text 4.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0e9719616a10f717628e074744f8c55df7b450f7a34d29c196d14f4498aad05d"
"checksum cssparser 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "693cc9c8d3d0779ff60ff6b8b73497bda2c7151b6489c3a9c1f95f5d4f4497e5" "checksum cssparser 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d8352ccd22c5ebab558d179e32f6d3dd26eed30252f8420d636bfae5052eb50e"
"checksum cssparser-macros 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a85e1452f40a50777c8424fa7fcaa7dd7074c7bc5419014fbffe7ea3d750dee8"
"checksum dbghelp-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "97590ba53bcb8ac28279161ca943a924d1fd4a8fb3fa63302591647c4fc5b850" "checksum dbghelp-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "97590ba53bcb8ac28279161ca943a924d1fd4a8fb3fa63302591647c4fc5b850"
"checksum dbus 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "94d266a872aaf68b50d02083c429a3686935ab6ab54824290509cdc422673eaf" "checksum dbus 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "94d266a872aaf68b50d02083c429a3686935ab6ab54824290509cdc422673eaf"
"checksum debug_unreachable 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "9a032eac705ca39214d169f83e3d3da290af06d8d1d344d1baad2fd002dca4b3" "checksum debug_unreachable 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "9a032eac705ca39214d169f83e3d3da290af06d8d1d344d1baad2fd002dca4b3"

View file

@ -12,7 +12,7 @@ path = "lib.rs"
[dependencies] [dependencies]
azure = {git = "https://github.com/servo/rust-azure"} azure = {git = "https://github.com/servo/rust-azure"}
canvas_traits = {path = "../canvas_traits"} canvas_traits = {path = "../canvas_traits"}
cssparser = {version = "0.10", features = ["heapsize", "serde"]} cssparser = {version = "0.11", features = ["heapsize", "serde"]}
euclid = "0.11" euclid = "0.11"
gleam = "0.2.8" gleam = "0.2.8"
ipc-channel = "0.7" ipc-channel = "0.7"

View file

@ -10,7 +10,7 @@ name = "canvas_traits"
path = "lib.rs" path = "lib.rs"
[dependencies] [dependencies]
cssparser = {version = "0.10", features = ["heapsize", "serde"]} cssparser = {version = "0.11", features = ["heapsize", "serde"]}
euclid = "0.11" euclid = "0.11"
heapsize = "0.3.0" heapsize = "0.3.0"
heapsize_derive = "0.1" heapsize_derive = "0.1"

View file

@ -14,7 +14,7 @@ app_units = "0.4"
atomic_refcell = "0.1" atomic_refcell = "0.1"
bitflags = "0.7" bitflags = "0.7"
canvas_traits = {path = "../canvas_traits"} canvas_traits = {path = "../canvas_traits"}
cssparser = {version = "0.10", features = ["heapsize", "serde"]} cssparser = {version = "0.11", features = ["heapsize", "serde"]}
euclid = "0.11" euclid = "0.11"
fnv = "1.0" fnv = "1.0"
gfx = {path = "../gfx"} gfx = {path = "../gfx"}

View file

@ -11,7 +11,7 @@ path = "lib.rs"
[dependencies] [dependencies]
bitflags = "0.7" bitflags = "0.7"
cssparser = {version = "0.10", features = ["heapsize", "serde"]} cssparser = {version = "0.11", features = ["heapsize", "serde"]}
heapsize = "0.3.0" heapsize = "0.3.0"
heapsize_derive = "0.1" heapsize_derive = "0.1"
serde = "0.9" serde = "0.9"

View file

@ -34,7 +34,8 @@ byteorder = "1.0"
canvas_traits = {path = "../canvas_traits"} canvas_traits = {path = "../canvas_traits"}
caseless = "0.1.0" caseless = "0.1.0"
cookie = "0.2.5" cookie = "0.2.5"
cssparser = {version = "0.10", features = ["heapsize", "serde"]} cssparser = {version = "0.11", features = ["heapsize", "serde"]}
cssparser-macros = "0.1.0"
deny_public_fields = {path = "../deny_public_fields"} deny_public_fields = {path = "../deny_public_fields"}
devtools_traits = {path = "../devtools_traits"} devtools_traits = {path = "../devtools_traits"}
dom_struct = {path = "../dom_struct"} dom_struct = {path = "../dom_struct"}

View file

@ -115,7 +115,7 @@ impl CSSKeyframesRuleMethods for CSSKeyframesRule {
// https://github.com/w3c/csswg-drafts/issues/801 // https://github.com/w3c/csswg-drafts/issues/801
// Setting this property to a CSS-wide keyword or `none` will // Setting this property to a CSS-wide keyword or `none` will
// throw a Syntax Error. // throw a Syntax Error.
match_ignore_ascii_case! { value, match_ignore_ascii_case! { &value,
"initial" => return Err(Error::Syntax), "initial" => return Err(Error::Syntax),
"inherit" => return Err(Error::Syntax), "inherit" => return Err(Error::Syntax),
"unset" => return Err(Error::Syntax), "unset" => return Err(Error::Syntax),

View file

@ -36,10 +36,9 @@ extern crate canvas_traits;
extern crate caseless; extern crate caseless;
extern crate cookie as cookie_rs; extern crate cookie as cookie_rs;
extern crate core; extern crate core;
#[macro_use] #[macro_use] extern crate cssparser;
extern crate cssparser; #[macro_use] extern crate cssparser_macros;
#[macro_use] #[macro_use] extern crate deny_public_fields;
extern crate deny_public_fields;
extern crate devtools_traits; extern crate devtools_traits;
extern crate dom_struct; extern crate dom_struct;
#[macro_use] #[macro_use]

View file

@ -13,7 +13,7 @@ path = "lib.rs"
app_units = "0.4" app_units = "0.4"
atomic_refcell = "0.1" atomic_refcell = "0.1"
canvas_traits = {path = "../canvas_traits"} canvas_traits = {path = "../canvas_traits"}
cssparser = {version = "0.10", features = ["heapsize", "serde"]} cssparser = {version = "0.11", features = ["heapsize", "serde"]}
euclid = "0.11" euclid = "0.11"
gfx_traits = {path = "../gfx_traits"} gfx_traits = {path = "../gfx_traits"}
heapsize = "0.3.0" heapsize = "0.3.0"

View file

@ -18,5 +18,6 @@ path = "lib.rs"
[dependencies] [dependencies]
bitflags = "0.7" bitflags = "0.7"
matches = "0.1" matches = "0.1"
cssparser = "0.10" cssparser = "0.11"
cssparser-macros = "0.1.0"
fnv = "1.0" fnv = "1.0"

View file

@ -4,6 +4,7 @@
#[macro_use] extern crate bitflags; #[macro_use] extern crate bitflags;
#[macro_use] extern crate cssparser; #[macro_use] extern crate cssparser;
#[macro_use] extern crate cssparser_macros;
#[macro_use] extern crate matches; #[macro_use] extern crate matches;
extern crate fnv; extern crate fnv;

View file

@ -26,7 +26,8 @@ app_units = "0.4"
atomic_refcell = "0.1" atomic_refcell = "0.1"
bitflags = "0.7" bitflags = "0.7"
cfg-if = "0.1.0" cfg-if = "0.1.0"
cssparser = "0.10" cssparser = "0.11"
cssparser-macros = "0.1.0"
encoding = "0.2" encoding = "0.2"
euclid = "0.11" euclid = "0.11"
fnv = "1.0" fnv = "1.0"
@ -62,6 +63,5 @@ kernel32-sys = "0.2"
[build-dependencies] [build-dependencies]
lazy_static = "0.2" lazy_static = "0.2"
bindgen = { version = "0.22", optional = true } bindgen = { version = "0.22", optional = true }
phf_codegen = "0.7.20"
regex = {version = "0.2", optional = true} regex = {version = "0.2", optional = true}
walkdir = "1.0" walkdir = "1.0"

View file

@ -10,11 +10,8 @@ extern crate bindgen;
#[cfg(feature = "bindgen")] #[cfg(feature = "bindgen")]
extern crate regex; extern crate regex;
extern crate walkdir; extern crate walkdir;
extern crate phf_codegen;
use std::env; use std::env;
use std::fs::File;
use std::io::{BufWriter, BufReader, BufRead, Write};
use std::path::Path; use std::path::Path;
use std::process::{Command, exit}; use std::process::{Command, exit};
use walkdir::WalkDir; use walkdir::WalkDir;
@ -78,23 +75,6 @@ fn generate_properties() {
if !status.success() { if !status.success() {
exit(1) exit(1)
} }
let path = Path::new(&env::var("OUT_DIR").unwrap()).join("static_ids.rs");
let static_ids = Path::new(&env::var("OUT_DIR").unwrap()).join("static_ids.txt");
let mut file = BufWriter::new(File::create(&path).unwrap());
let static_ids = BufReader::new(File::open(&static_ids).unwrap());
write!(&mut file, "static STATIC_IDS: ::phf::Map<&'static str, StaticId> = ").unwrap();
let mut map = phf_codegen::Map::new();
for result in static_ids.lines() {
let line = result.unwrap();
let mut split = line.split('\t');
let key = split.next().unwrap().to_owned();
let value = split.next().unwrap();
map.entry(key, value);
}
map.build(&mut file).unwrap();
write!(&mut file, ";\n").unwrap();
} }
fn main() { fn main() {

View file

@ -165,7 +165,7 @@ impl Resolution {
_ => return Err(()), _ => return Err(()),
}; };
Ok(match_ignore_ascii_case! { unit, Ok(match_ignore_ascii_case! { &unit,
"dpi" => Resolution::Dpi(value), "dpi" => Resolution::Dpi(value),
"dppx" => Resolution::Dppx(value), "dppx" => Resolution::Dppx(value),
"dpcm" => Resolution::Dpcm(value), "dpcm" => Resolution::Dpcm(value),

View file

@ -42,8 +42,8 @@ extern crate atomic_refcell;
#[macro_use] #[macro_use]
extern crate bitflags; extern crate bitflags;
#[cfg(feature = "gecko")] #[macro_use] #[no_link] extern crate cfg_if; #[cfg(feature = "gecko")] #[macro_use] #[no_link] extern crate cfg_if;
#[macro_use] #[macro_use] extern crate cssparser;
extern crate cssparser; #[macro_use] extern crate cssparser_macros;
extern crate encoding; extern crate encoding;
extern crate euclid; extern crate euclid;
extern crate fnv; extern crate fnv;

View file

@ -33,7 +33,6 @@ def main():
rust = render(template, product=product, data=properties, __file__=template) rust = render(template, product=product, data=properties, __file__=template)
if output == "style-crate": if output == "style-crate":
write(os.environ["OUT_DIR"], "properties.rs", rust) write(os.environ["OUT_DIR"], "properties.rs", rust)
write(os.environ["OUT_DIR"], "static_ids.txt", static_ids(properties))
if product == "gecko": if product == "gecko":
template = os.path.join(BASE, "gecko.mako.rs") template = os.path.join(BASE, "gecko.mako.rs")
rust = render(template, data=properties) rust = render(template, data=properties)
@ -72,19 +71,6 @@ def write(directory, filename, content):
open(os.path.join(directory, filename), "wb").write(content) open(os.path.join(directory, filename), "wb").write(content)
def static_id_generator(properties):
for kind, props in [("Longhand", properties.longhands),
("Shorthand", properties.shorthands)]:
for p in props:
yield "%s\tStaticId::%s(%sId::%s)" % (p.name, kind, kind, p.camel_case)
for alias in p.alias:
yield "%s\tStaticId::%s(%sId::%s)" % (alias, kind, kind, p.camel_case)
def static_ids(properties):
return '\n'.join(static_id_generator(properties))
def write_html(properties): def write_html(properties):
properties = dict( properties = dict(
(p.name, { (p.name, {

View file

@ -69,7 +69,7 @@ impl TransitionProperty {
/// Parse a transition-property value. /// Parse a transition-property value.
pub fn parse(input: &mut Parser) -> Result<Self, ()> { pub fn parse(input: &mut Parser) -> Result<Self, ()> {
match_ignore_ascii_case! { try!(input.expect_ident()), match_ignore_ascii_case! { &try!(input.expect_ident()),
"all" => Ok(TransitionProperty::All), "all" => Ok(TransitionProperty::All),
% for prop in data.longhands: % for prop in data.longhands:
% if prop.animatable: % if prop.animatable:

View file

@ -68,7 +68,7 @@
/// Parse a display value. /// Parse a display value.
pub fn parse(_context: &ParserContext, input: &mut Parser) pub fn parse(_context: &ParserContext, input: &mut Parser)
-> Result<SpecifiedValue, ()> { -> Result<SpecifiedValue, ()> {
match_ignore_ascii_case! { try!(input.expect_ident()), match_ignore_ascii_case! { &try!(input.expect_ident()),
% for value in values: % for value in values:
"${value}" => { "${value}" => {
Ok(computed_value::T::${to_rust_ident(value)}) Ok(computed_value::T::${to_rust_ident(value)})
@ -299,7 +299,7 @@ ${helpers.single_keyword("-moz-top-layer", "none top",
input.try(|i| specified::LengthOrPercentage::parse(context, i)) input.try(|i| specified::LengthOrPercentage::parse(context, i))
.map(SpecifiedValue::LengthOrPercentage) .map(SpecifiedValue::LengthOrPercentage)
.or_else(|_| { .or_else(|_| {
match_ignore_ascii_case! { try!(input.expect_ident()), match_ignore_ascii_case! { &try!(input.expect_ident()),
% for keyword in vertical_align_keywords: % for keyword in vertical_align_keywords:
"${keyword}" => Ok(SpecifiedValue::${to_rust_ident(keyword)}), "${keyword}" => Ok(SpecifiedValue::${to_rust_ident(keyword)}),
% endfor % endfor
@ -588,7 +588,7 @@ ${helpers.single_keyword("overflow-x", "visible hidden scroll auto",
impl Parse for SpecifiedValue { impl Parse for SpecifiedValue {
fn parse(_context: &ParserContext, input: &mut ::cssparser::Parser) -> Result<Self, ()> { fn parse(_context: &ParserContext, input: &mut ::cssparser::Parser) -> Result<Self, ()> {
if let Ok(function_name) = input.try(|input| input.expect_function()) { if let Ok(function_name) = input.try(|input| input.expect_function()) {
return match_ignore_ascii_case! { function_name, return match_ignore_ascii_case! { &function_name,
"cubic-bezier" => { "cubic-bezier" => {
let (mut p1x, mut p1y, mut p2x, mut p2y) = (0.0, 0.0, 0.0, 0.0); let (mut p1x, mut p1y, mut p2x, mut p2y) = (0.0, 0.0, 0.0, 0.0);
try!(input.parse_nested_block(|input| { try!(input.parse_nested_block(|input| {
@ -618,7 +618,7 @@ ${helpers.single_keyword("overflow-x", "visible hidden scroll auto",
if input.try(|input| input.expect_comma()).is_ok() { if input.try(|input| input.expect_comma()).is_ok() {
start_end = try!(match_ignore_ascii_case! { start_end = try!(match_ignore_ascii_case! {
try!(input.expect_ident()), &try!(input.expect_ident()),
"start" => Ok(StartEnd::Start), "start" => Ok(StartEnd::Start),
"end" => Ok(StartEnd::End), "end" => Ok(StartEnd::End),
_ => Err(()) _ => Err(())
@ -1319,7 +1319,7 @@ ${helpers.predefined_type("scroll-snap-coordinate",
Err(_) => break, Err(_) => break,
}; };
match_ignore_ascii_case! { match_ignore_ascii_case! {
name, &name,
"matrix" => { "matrix" => {
try!(input.parse_nested_block(|input| { try!(input.parse_nested_block(|input| {
let values = try!(input.parse_comma_separated(|input| { let values = try!(input.parse_comma_separated(|input| {

View file

@ -140,7 +140,7 @@
content.push(ContentItem::String(value.into_owned())) content.push(ContentItem::String(value.into_owned()))
} }
Ok(Token::Function(name)) => { Ok(Token::Function(name)) => {
content.push(try!(match_ignore_ascii_case! { name, content.push(try!(match_ignore_ascii_case! { &name,
"counter" => input.parse_nested_block(|input| { "counter" => input.parse_nested_block(|input| {
let name = try!(input.expect_ident()).into_owned(); let name = try!(input.expect_ident()).into_owned();
let style = input.try(|input| { let style = input.try(|input| {
@ -163,7 +163,7 @@
})); }));
} }
Ok(Token::Ident(ident)) => { Ok(Token::Ident(ident)) => {
match_ignore_ascii_case! { ident, match_ignore_ascii_case! { &ident,
"open-quote" => content.push(ContentItem::OpenQuote), "open-quote" => content.push(ContentItem::OpenQuote),
"close-quote" => content.push(ContentItem::CloseQuote), "close-quote" => content.push(ContentItem::CloseQuote),
"no-open-quote" => content.push(ContentItem::NoOpenQuote), "no-open-quote" => content.push(ContentItem::NoOpenQuote),

View file

@ -339,7 +339,7 @@ ${helpers.predefined_type("clip",
% endif % endif
if let Ok(function_name) = input.try(|input| input.expect_function()) { if let Ok(function_name) = input.try(|input| input.expect_function()) {
filters.push(try!(input.parse_nested_block(|input| { filters.push(try!(input.parse_nested_block(|input| {
match_ignore_ascii_case! { function_name, match_ignore_ascii_case! { &function_name,
"blur" => specified::Length::parse_non_negative(input).map(SpecifiedFilter::Blur), "blur" => specified::Length::parse_non_negative(input).map(SpecifiedFilter::Blur),
"brightness" => parse_factor(input).map(SpecifiedFilter::Brightness), "brightness" => parse_factor(input).map(SpecifiedFilter::Brightness),
"contrast" => parse_factor(input).map(SpecifiedFilter::Contrast), "contrast" => parse_factor(input).map(SpecifiedFilter::Contrast),
@ -445,7 +445,7 @@ pub fn parse_origin(context: &ParserContext, input: &mut Parser) -> Result<Origi
if let Err(_) = input.try(|input| { if let Err(_) = input.try(|input| {
let token = try!(input.expect_ident()); let token = try!(input.expect_ident());
match_ignore_ascii_case! { match_ignore_ascii_case! {
token, &token,
"left" => { "left" => {
if horizontal.is_none() { if horizontal.is_none() {
horizontal = Some(LengthOrPercentage::Percentage(Percentage(0.0))) horizontal = Some(LengthOrPercentage::Percentage(Percentage(0.0)))

View file

@ -63,7 +63,7 @@
} }
_ => {} _ => {}
} }
match_ignore_ascii_case! { input, match_ignore_ascii_case! { &input,
"serif" => return FontFamily::Generic(atom!("serif")), "serif" => return FontFamily::Generic(atom!("serif")),
"sans-serif" => return FontFamily::Generic(atom!("sans-serif")), "sans-serif" => return FontFamily::Generic(atom!("sans-serif")),
"cursive" => return FontFamily::Generic(atom!("cursive")), "cursive" => return FontFamily::Generic(atom!("cursive")),
@ -85,7 +85,7 @@
// string (as lowercase) in the static atoms table. We don't have an // string (as lowercase) in the static atoms table. We don't have an
// API to do that yet though, so we do the simple thing for now. // API to do that yet though, so we do the simple thing for now.
let mut css_wide_keyword = false; let mut css_wide_keyword = false;
match_ignore_ascii_case! { first_ident, match_ignore_ascii_case! { &first_ident,
"serif" => return Ok(FontFamily::Generic(atom!("serif"))), "serif" => return Ok(FontFamily::Generic(atom!("serif"))),
"sans-serif" => return Ok(FontFamily::Generic(atom!("sans-serif"))), "sans-serif" => return Ok(FontFamily::Generic(atom!("sans-serif"))),
"cursive" => return Ok(FontFamily::Generic(atom!("cursive"))), "cursive" => return Ok(FontFamily::Generic(atom!("cursive"))),
@ -254,7 +254,7 @@ ${helpers.single_keyword("font-variant-caps",
/// normal | bold | bolder | lighter | 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900 /// normal | bold | bolder | lighter | 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900
pub fn parse(_context: &ParserContext, input: &mut Parser) -> Result<SpecifiedValue, ()> { pub fn parse(_context: &ParserContext, input: &mut Parser) -> Result<SpecifiedValue, ()> {
input.try(|input| { input.try(|input| {
match_ignore_ascii_case! { try!(input.expect_ident()), match_ignore_ascii_case! { &try!(input.expect_ident()),
"normal" => Ok(SpecifiedValue::Normal), "normal" => Ok(SpecifiedValue::Normal),
"bold" => Ok(SpecifiedValue::Bold), "bold" => Ok(SpecifiedValue::Bold),
"bolder" => Ok(SpecifiedValue::Bolder), "bolder" => Ok(SpecifiedValue::Bolder),
@ -557,7 +557,7 @@ ${helpers.single_keyword("font-variant-caps",
pub fn parse(_context: &ParserContext, input: &mut Parser) -> Result<SpecifiedValue, ()> { pub fn parse(_context: &ParserContext, input: &mut Parser) -> Result<SpecifiedValue, ()> {
let mut result = SpecifiedValue { weight: false, style: false }; let mut result = SpecifiedValue { weight: false, style: false };
match_ignore_ascii_case! {try!(input.expect_ident()), match_ignore_ascii_case! { &try!(input.expect_ident()),
"none" => Ok(result), "none" => Ok(result),
"weight" => { "weight" => {
result.weight = true; result.weight = true;

View file

@ -22,12 +22,12 @@ ${helpers.single_keyword("text-anchor",
// Section 11 - Painting: Filling, Stroking and Marker Symbols // Section 11 - Painting: Filling, Stroking and Marker Symbols
${helpers.single_keyword("color-interpolation", ${helpers.single_keyword("color-interpolation",
"auto sRGB linearRGB", "auto srgb linearrgb",
products="gecko", products="gecko",
animatable=False, animatable=False,
spec="https://www.w3.org/TR/SVG11/painting.html#ColorInterpolationProperty")} spec="https://www.w3.org/TR/SVG11/painting.html#ColorInterpolationProperty")}
${helpers.single_keyword("color-interpolation-filters", "auto sRGB linearRGB", ${helpers.single_keyword("color-interpolation-filters", "auto srgb linearrgb",
products="gecko", products="gecko",
gecko_constant_prefix="NS_STYLE_COLOR_INTERPOLATION", gecko_constant_prefix="NS_STYLE_COLOR_INTERPOLATION",
animatable=False, animatable=False,
@ -52,7 +52,7 @@ ${helpers.single_keyword("fill-rule", "nonzero evenodd",
spec="https://www.w3.org/TR/SVG11/painting.html#FillRuleProperty")} spec="https://www.w3.org/TR/SVG11/painting.html#FillRuleProperty")}
${helpers.single_keyword("shape-rendering", ${helpers.single_keyword("shape-rendering",
"auto optimizeSpeed crispEdges geometricPrecision", "auto optimizespeed crispedges geometricprecision",
products="gecko", products="gecko",
animatable=False, animatable=False,
spec="https://www.w3.org/TR/SVG11/painting.html#ShapeRenderingProperty")} spec="https://www.w3.org/TR/SVG11/painting.html#ShapeRenderingProperty")}
@ -196,7 +196,7 @@ ${helpers.predefined_type("marker-end", "UrlOrNone", "Either::Second(None_)",
loop { loop {
let result = input.try(|i| { let result = input.try(|i| {
match_ignore_ascii_case! { i.expect_ident()?, match_ignore_ascii_case! { &i.expect_ident()?,
"fill" => Ok(FILL), "fill" => Ok(FILL),
"stroke" => Ok(STROKE), "stroke" => Ok(STROKE),
"markers" => Ok(MARKERS), "markers" => Ok(MARKERS),

View file

@ -60,7 +60,7 @@
impl Parse for Side { impl Parse for Side {
fn parse(_context: &ParserContext, input: &mut Parser) -> Result<Side, ()> { fn parse(_context: &ParserContext, input: &mut Parser) -> Result<Side, ()> {
if let Ok(ident) = input.try(|input| input.expect_ident()) { if let Ok(ident) = input.try(|input| input.expect_ident()) {
match_ignore_ascii_case! { ident, match_ignore_ascii_case! { &ident,
"clip" => Ok(Side::Clip), "clip" => Ok(Side::Clip),
"ellipsis" => Ok(Side::Ellipsis), "ellipsis" => Ok(Side::Ellipsis),
_ => Err(()) _ => Err(())
@ -179,7 +179,7 @@ ${helpers.single_keyword("unicode-bidi",
while input.try(|input| { while input.try(|input| {
if let Ok(ident) = input.expect_ident() { if let Ok(ident) = input.expect_ident() {
match_ignore_ascii_case! { ident, match_ignore_ascii_case! { &ident,
"underline" => if result.contains(UNDERLINE) { return Err(()) } "underline" => if result.contains(UNDERLINE) { return Err(()) }
else { empty = false; result.insert(UNDERLINE) }, else { empty = false; result.insert(UNDERLINE) },
"overline" => if result.contains(OVERLINE) { return Err(()) } "overline" => if result.contains(OVERLINE) { return Err(()) }

View file

@ -455,7 +455,7 @@ impl Parse for CSSWideKeyword {
fn parse(_context: &ParserContext, input: &mut Parser) -> Result<Self, ()> { fn parse(_context: &ParserContext, input: &mut Parser) -> Result<Self, ()> {
let ident = input.expect_ident()?; let ident = input.expect_ident()?;
input.expect_exhausted()?; input.expect_exhausted()?;
match_ignore_ascii_case! { ident, match_ignore_ascii_case! { &ident,
"initial" => Ok(CSSWideKeyword::InitialKeyword), "initial" => Ok(CSSWideKeyword::InitialKeyword),
"inherit" => Ok(CSSWideKeyword::InheritKeyword), "inherit" => Ok(CSSWideKeyword::InheritKeyword),
"unset" => Ok(CSSWideKeyword::UnsetKeyword), "unset" => Ok(CSSWideKeyword::UnsetKeyword),
@ -731,24 +731,33 @@ impl ToCss for PropertyId {
} }
} }
// FIXME(https://github.com/rust-lang/rust/issues/33156): remove this enum and use PropertyId
// when stable Rust allows destructors in statics.
enum StaticId {
Longhand(LonghandId),
Shorthand(ShorthandId),
}
include!(concat!(env!("OUT_DIR"), "/static_ids.rs"));
impl PropertyId { impl PropertyId {
/// Returns a given property from the string `s`. /// Returns a given property from the string `s`.
/// ///
/// Returns Err(()) for unknown non-custom properties /// Returns Err(()) for unknown non-custom properties
pub fn parse(s: Cow<str>) -> Result<Self, ()> { pub fn parse(property_name: Cow<str>) -> Result<Self, ()> {
if let Ok(name) = ::custom_properties::parse_name(&s) { if let Ok(name) = ::custom_properties::parse_name(&property_name) {
return Ok(PropertyId::Custom(::custom_properties::Name::from(name))) return Ok(PropertyId::Custom(::custom_properties::Name::from(name)))
} }
let lower_case = ::str::cow_into_ascii_lowercase(s); // FIXME(https://github.com/rust-lang/rust/issues/33156): remove this enum and use PropertyId
match STATIC_IDS.get(&*lower_case) { // when stable Rust allows destructors in statics.
enum StaticId {
Longhand(LonghandId),
Shorthand(ShorthandId),
}
ascii_case_insensitive_phf_map! {
StaticIds: Map<StaticId> = {
% for (kind, properties) in [("Longhand", data.longhands), ("Shorthand", data.shorthands)]:
% for property in properties:
% for name in [property.name] + property.alias:
"${name}" => "StaticId::${kind}(${kind}Id::${property.camel_case})",
% endfor
% endfor
% endfor
}
}
match StaticIds::get(&property_name) {
Some(&StaticId::Longhand(id)) => Ok(PropertyId::Longhand(id)), Some(&StaticId::Longhand(id)) => Ok(PropertyId::Longhand(id)),
Some(&StaticId::Shorthand(id)) => Ok(PropertyId::Shorthand(id)), Some(&StaticId::Shorthand(id)) => Ok(PropertyId::Shorthand(id)),
None => Err(()), None => Err(()),

View file

@ -106,7 +106,7 @@ impl Expression {
let name = try!(input.expect_ident()); let name = try!(input.expect_ident());
try!(input.expect_colon()); try!(input.expect_colon());
// TODO: Handle other media features // TODO: Handle other media features
Ok(Expression(match_ignore_ascii_case! { name, Ok(Expression(match_ignore_ascii_case! { &name,
"min-width" => { "min-width" => {
ExpressionKind::Width(Range::Min(try!(specified::Length::parse_non_negative(input)))) ExpressionKind::Width(Range::Min(try!(specified::Length::parse_non_negative(input))))
}, },

View file

@ -7,8 +7,6 @@
#![deny(missing_docs)] #![deny(missing_docs)]
use num_traits::ToPrimitive; use num_traits::ToPrimitive;
use std::ascii::AsciiExt;
use std::borrow::Cow;
use std::convert::AsRef; use std::convert::AsRef;
use std::iter::{Filter, Peekable}; use std::iter::{Filter, Peekable};
use std::str::Split; use std::str::Split;
@ -146,12 +144,3 @@ pub fn str_join<I, T>(strs: I, join: &str) -> String
acc acc
}) })
} }
/// Like AsciiExt::to_ascii_lowercase, but avoids allocating when the input is already lower-case.
pub fn cow_into_ascii_lowercase<'a, S: Into<Cow<'a, str>>>(s: S) -> Cow<'a, str> {
let mut cow = s.into();
if let Some(first_uppercase) = cow.bytes().position(|byte| byte >= b'A' && byte <= b'Z') {
cow.to_mut()[first_uppercase..].make_ascii_lowercase();
}
cow
}

View file

@ -47,7 +47,7 @@ impl SupportsCondition {
return Ok(in_parens) return Ok(in_parens)
} }
Ok(Token::Ident(ident)) => { Ok(Token::Ident(ident)) => {
match_ignore_ascii_case! { ident, match_ignore_ascii_case! { &ident,
"and" => ("and", SupportsCondition::And as fn(_) -> _), "and" => ("and", SupportsCondition::And as fn(_) -> _),
"or" => ("or", SupportsCondition::Or as fn(_) -> _), "or" => ("or", SupportsCondition::Or as fn(_) -> _),
_ => return Err(()) _ => return Err(())

View file

@ -28,7 +28,7 @@ macro_rules! define_numbered_css_keyword_enum {
impl Parse for $name { impl Parse for $name {
#[allow(missing_docs)] #[allow(missing_docs)]
fn parse(_context: &ParserContext, input: &mut ::cssparser::Parser) -> Result<$name, ()> { fn parse(_context: &ParserContext, input: &mut ::cssparser::Parser) -> Result<$name, ()> {
match_ignore_ascii_case! { try!(input.expect_ident()), match_ignore_ascii_case! { &try!(input.expect_ident()),
$( $css => Ok($name::$variant), )+ $( $css => Ok($name::$variant), )+
_ => Err(()) _ => Err(())
} }

View file

@ -323,7 +323,7 @@ impl Parse for JustifyItems {
// auto | normal | stretch | <baseline-position> // auto | normal | stretch | <baseline-position>
fn parse_auto_normal_stretch_baseline(input: &mut Parser) -> Result<AlignFlags, ()> { fn parse_auto_normal_stretch_baseline(input: &mut Parser) -> Result<AlignFlags, ()> {
let ident = input.expect_ident()?; let ident = input.expect_ident()?;
match_ignore_ascii_case! { ident, match_ignore_ascii_case! { &ident,
"auto" => Ok(ALIGN_AUTO), "auto" => Ok(ALIGN_AUTO),
"normal" => Ok(ALIGN_NORMAL), "normal" => Ok(ALIGN_NORMAL),
"stretch" => Ok(ALIGN_STRETCH), "stretch" => Ok(ALIGN_STRETCH),
@ -335,7 +335,7 @@ fn parse_auto_normal_stretch_baseline(input: &mut Parser) -> Result<AlignFlags,
// normal | stretch | <baseline-position> // normal | stretch | <baseline-position>
fn parse_normal_stretch_baseline(input: &mut Parser) -> Result<AlignFlags, ()> { fn parse_normal_stretch_baseline(input: &mut Parser) -> Result<AlignFlags, ()> {
let ident = input.expect_ident()?; let ident = input.expect_ident()?;
match_ignore_ascii_case! { ident, match_ignore_ascii_case! { &ident,
"normal" => Ok(ALIGN_NORMAL), "normal" => Ok(ALIGN_NORMAL),
"stretch" => Ok(ALIGN_STRETCH), "stretch" => Ok(ALIGN_STRETCH),
"baseline" => Ok(ALIGN_BASELINE), "baseline" => Ok(ALIGN_BASELINE),
@ -346,7 +346,7 @@ fn parse_normal_stretch_baseline(input: &mut Parser) -> Result<AlignFlags, ()> {
// normal | <baseline-position> // normal | <baseline-position>
fn parse_normal_or_baseline(input: &mut Parser) -> Result<AlignFlags, ()> { fn parse_normal_or_baseline(input: &mut Parser) -> Result<AlignFlags, ()> {
let ident = input.expect_ident()?; let ident = input.expect_ident()?;
match_ignore_ascii_case! { ident, match_ignore_ascii_case! { &ident,
"normal" => Ok(ALIGN_NORMAL), "normal" => Ok(ALIGN_NORMAL),
"baseline" => Ok(ALIGN_BASELINE), "baseline" => Ok(ALIGN_BASELINE),
_ => Err(()) _ => Err(())
@ -356,7 +356,7 @@ fn parse_normal_or_baseline(input: &mut Parser) -> Result<AlignFlags, ()> {
// <content-distribution> // <content-distribution>
fn parse_content_distribution(input: &mut Parser) -> Result<AlignFlags, ()> { fn parse_content_distribution(input: &mut Parser) -> Result<AlignFlags, ()> {
let ident = input.expect_ident()?; let ident = input.expect_ident()?;
match_ignore_ascii_case! { ident, match_ignore_ascii_case! { &ident,
"stretch" => Ok(ALIGN_STRETCH), "stretch" => Ok(ALIGN_STRETCH),
"space_between" => Ok(ALIGN_SPACE_BETWEEN), "space_between" => Ok(ALIGN_SPACE_BETWEEN),
"space_around" => Ok(ALIGN_SPACE_AROUND), "space_around" => Ok(ALIGN_SPACE_AROUND),
@ -386,7 +386,7 @@ fn parse_overflow_content_position(input: &mut Parser) -> Result<AlignFlags, ()>
// <content-position> // <content-position>
fn parse_content_position(input: &mut Parser) -> Result<AlignFlags, ()> { fn parse_content_position(input: &mut Parser) -> Result<AlignFlags, ()> {
let ident = input.expect_ident()?; let ident = input.expect_ident()?;
match_ignore_ascii_case! { ident, match_ignore_ascii_case! { &ident,
"start" => Ok(ALIGN_START), "start" => Ok(ALIGN_START),
"end" => Ok(ALIGN_END), "end" => Ok(ALIGN_END),
"flex-start" => Ok(ALIGN_FLEX_START), "flex-start" => Ok(ALIGN_FLEX_START),
@ -401,7 +401,7 @@ fn parse_content_position(input: &mut Parser) -> Result<AlignFlags, ()> {
// <overflow-position> // <overflow-position>
fn parse_overflow_position(input: &mut Parser) -> Result<AlignFlags, ()> { fn parse_overflow_position(input: &mut Parser) -> Result<AlignFlags, ()> {
let ident = input.expect_ident()?; let ident = input.expect_ident()?;
match_ignore_ascii_case! { ident, match_ignore_ascii_case! { &ident,
"safe" => Ok(ALIGN_SAFE), "safe" => Ok(ALIGN_SAFE),
"unsafe" => Ok(ALIGN_UNSAFE), "unsafe" => Ok(ALIGN_UNSAFE),
_ => Err(()) _ => Err(())
@ -429,7 +429,7 @@ fn parse_overflow_self_position(input: &mut Parser) -> Result<AlignFlags, ()> {
// <self-position> // <self-position>
fn parse_self_position(input: &mut Parser) -> Result<AlignFlags, ()> { fn parse_self_position(input: &mut Parser) -> Result<AlignFlags, ()> {
let ident = input.expect_ident()?; let ident = input.expect_ident()?;
match_ignore_ascii_case! { ident, match_ignore_ascii_case! { &ident,
"start" => Ok(ALIGN_START), "start" => Ok(ALIGN_START),
"end" => Ok(ALIGN_END), "end" => Ok(ALIGN_END),
"flex-start" => Ok(ALIGN_FLEX_START), "flex-start" => Ok(ALIGN_FLEX_START),
@ -448,14 +448,14 @@ fn parse_legacy(input: &mut Parser) -> Result<AlignFlags, ()> {
let a = input.expect_ident()?; let a = input.expect_ident()?;
let b = input.expect_ident()?; let b = input.expect_ident()?;
if a.eq_ignore_ascii_case("legacy") { if a.eq_ignore_ascii_case("legacy") {
match_ignore_ascii_case! { b, match_ignore_ascii_case! { &b,
"left" => Ok(ALIGN_LEGACY | ALIGN_LEFT), "left" => Ok(ALIGN_LEGACY | ALIGN_LEFT),
"right" => Ok(ALIGN_LEGACY | ALIGN_RIGHT), "right" => Ok(ALIGN_LEGACY | ALIGN_RIGHT),
"center" => Ok(ALIGN_LEGACY | ALIGN_CENTER), "center" => Ok(ALIGN_LEGACY | ALIGN_CENTER),
_ => Err(()) _ => Err(())
} }
} else if b.eq_ignore_ascii_case("legacy") { } else if b.eq_ignore_ascii_case("legacy") {
match_ignore_ascii_case! { a, match_ignore_ascii_case! { &a,
"left" => Ok(ALIGN_LEGACY | ALIGN_LEFT), "left" => Ok(ALIGN_LEGACY | ALIGN_LEFT),
"right" => Ok(ALIGN_LEGACY | ALIGN_RIGHT), "right" => Ok(ALIGN_LEGACY | ALIGN_RIGHT),
"center" => Ok(ALIGN_LEGACY | ALIGN_CENTER), "center" => Ok(ALIGN_LEGACY | ALIGN_CENTER),

View file

@ -141,7 +141,7 @@ pub enum BasicShape {
impl Parse for BasicShape { impl Parse for BasicShape {
fn parse(context: &ParserContext, input: &mut Parser) -> Result<BasicShape, ()> { fn parse(context: &ParserContext, input: &mut Parser) -> Result<BasicShape, ()> {
match_ignore_ascii_case! { try!(input.expect_function()), match_ignore_ascii_case! { &try!(input.expect_function()),
"inset" => { "inset" => {
Ok(BasicShape::Inset( Ok(BasicShape::Inset(
try!(input.parse_nested_block(|i| InsetRect::parse_function_arguments(context, i))))) try!(input.parse_nested_block(|i| InsetRect::parse_function_arguments(context, i)))))
@ -237,7 +237,7 @@ impl InsetRect {
impl Parse for InsetRect { impl Parse for InsetRect {
fn parse(context: &ParserContext, input: &mut Parser) -> Result<Self, ()> { fn parse(context: &ParserContext, input: &mut Parser) -> Result<Self, ()> {
match_ignore_ascii_case! { try!(input.expect_function()), match_ignore_ascii_case! { &try!(input.expect_function()),
"inset" => { "inset" => {
input.parse_nested_block(|i| InsetRect::parse_function_arguments(context, i)) input.parse_nested_block(|i| InsetRect::parse_function_arguments(context, i))
}, },
@ -413,7 +413,7 @@ impl Circle {
impl Parse for Circle { impl Parse for Circle {
fn parse(context: &ParserContext, input: &mut Parser) -> Result<Self, ()> { fn parse(context: &ParserContext, input: &mut Parser) -> Result<Self, ()> {
match_ignore_ascii_case! { try!(input.expect_function()), match_ignore_ascii_case! { &try!(input.expect_function()),
"circle" => { "circle" => {
input.parse_nested_block(|i| Circle::parse_function_arguments(context, i)) input.parse_nested_block(|i| Circle::parse_function_arguments(context, i))
}, },
@ -497,7 +497,7 @@ impl Ellipse {
impl Parse for Ellipse { impl Parse for Ellipse {
fn parse(context: &ParserContext, input: &mut Parser) -> Result<Self, ()> { fn parse(context: &ParserContext, input: &mut Parser) -> Result<Self, ()> {
match_ignore_ascii_case! { try!(input.expect_function()), match_ignore_ascii_case! { &try!(input.expect_function()),
"ellipse" => { "ellipse" => {
input.parse_nested_block(|i| Ellipse::parse_function_arguments(context, i)) input.parse_nested_block(|i| Ellipse::parse_function_arguments(context, i))
}, },
@ -575,7 +575,7 @@ impl Polygon {
impl Parse for Polygon { impl Parse for Polygon {
fn parse(context: &ParserContext, input: &mut Parser) -> Result<Self, ()> { fn parse(context: &ParserContext, input: &mut Parser) -> Result<Self, ()> {
match_ignore_ascii_case! { try!(input.expect_function()), match_ignore_ascii_case! { &try!(input.expect_function()),
"polygon" => { "polygon" => {
input.parse_nested_block(|i| Polygon::parse_function_arguments(context, i)) input.parse_nested_block(|i| Polygon::parse_function_arguments(context, i))
}, },
@ -664,7 +664,7 @@ impl Default for ShapeRadius {
impl Parse for ShapeRadius { impl Parse for ShapeRadius {
fn parse(_: &ParserContext, input: &mut Parser) -> Result<Self, ()> { fn parse(_: &ParserContext, input: &mut Parser) -> Result<Self, ()> {
input.try(|i| LengthOrPercentage::parse_non_negative(i)).map(ShapeRadius::Length).or_else(|_| { input.try(|i| LengthOrPercentage::parse_non_negative(i)).map(ShapeRadius::Length).or_else(|_| {
match_ignore_ascii_case! { try!(input.expect_ident()), match_ignore_ascii_case! { &try!(input.expect_ident()),
"closest-side" => Ok(ShapeRadius::ClosestSide), "closest-side" => Ok(ShapeRadius::ClosestSide),
"farthest-side" => Ok(ShapeRadius::FarthestSide), "farthest-side" => Ok(ShapeRadius::FarthestSide),
_ => Err(()) _ => Err(())
@ -832,7 +832,7 @@ impl ComputedValueAsSpecified for FillRule {}
impl Parse for FillRule { impl Parse for FillRule {
fn parse(_context: &ParserContext, input: &mut Parser) -> Result<FillRule, ()> { fn parse(_context: &ParserContext, input: &mut Parser) -> Result<FillRule, ()> {
match_ignore_ascii_case! { try!(input.expect_ident()), match_ignore_ascii_case! { &try!(input.expect_ident()),
"nonzero" => Ok(FillRule::NonZero), "nonzero" => Ok(FillRule::NonZero),
"evenodd" => Ok(FillRule::EvenOdd), "evenodd" => Ok(FillRule::EvenOdd),
_ => Err(()) _ => Err(())
@ -871,7 +871,7 @@ impl Parse for GeometryBox {
if let Ok(shape_box) = input.try(|i| ShapeBox::parse(context, i)) { if let Ok(shape_box) = input.try(|i| ShapeBox::parse(context, i)) {
Ok(GeometryBox::ShapeBox(shape_box)) Ok(GeometryBox::ShapeBox(shape_box))
} else { } else {
match_ignore_ascii_case! { try!(input.expect_ident()), match_ignore_ascii_case! { &try!(input.expect_ident()),
"fill-box" => Ok(GeometryBox::Fill), "fill-box" => Ok(GeometryBox::Fill),
"stroke-box" => Ok(GeometryBox::Stroke), "stroke-box" => Ok(GeometryBox::Stroke),
"view-box" => Ok(GeometryBox::View), "view-box" => Ok(GeometryBox::View),
@ -908,7 +908,7 @@ pub enum ShapeBox {
impl Parse for ShapeBox { impl Parse for ShapeBox {
fn parse(_context: &ParserContext, input: &mut Parser) -> Result<Self, ()> { fn parse(_context: &ParserContext, input: &mut Parser) -> Result<Self, ()> {
match_ignore_ascii_case! { try!(input.expect_ident()), match_ignore_ascii_case! { &try!(input.expect_ident()),
"margin-box" => Ok(ShapeBox::Margin), "margin-box" => Ok(ShapeBox::Margin),
"border-box" => Ok(ShapeBox::Border), "border-box" => Ok(ShapeBox::Border),
"padding-box" => Ok(ShapeBox::Padding), "padding-box" => Ok(ShapeBox::Padding),

View file

@ -103,7 +103,7 @@ impl Gradient {
/// Parses a gradient from the given arguments. /// Parses a gradient from the given arguments.
pub fn parse_function(context: &ParserContext, input: &mut Parser) -> Result<Gradient, ()> { pub fn parse_function(context: &ParserContext, input: &mut Parser) -> Result<Gradient, ()> {
let mut repeating = false; let mut repeating = false;
let (gradient_kind, stops) = match_ignore_ascii_case! { try!(input.expect_function()), let (gradient_kind, stops) = match_ignore_ascii_case! { &try!(input.expect_function()),
"linear-gradient" => { "linear-gradient" => {
try!(input.parse_nested_block(|input| { try!(input.parse_nested_block(|input| {
let kind = try!(GradientKind::parse_linear(context, input)); let kind = try!(GradientKind::parse_linear(context, input));

View file

@ -1344,13 +1344,7 @@ impl Parse for MinLength {
fn parse(_context: &ParserContext, input: &mut Parser) -> Result<Self, ()> { fn parse(_context: &ParserContext, input: &mut Parser) -> Result<Self, ()> {
input.try(ExtremumLength::parse).map(MinLength::ExtremumLength) input.try(ExtremumLength::parse).map(MinLength::ExtremumLength)
.or_else(|()| input.try(LengthOrPercentage::parse_non_negative).map(MinLength::LengthOrPercentage)) .or_else(|()| input.try(LengthOrPercentage::parse_non_negative).map(MinLength::LengthOrPercentage))
.or_else(|()| { .or_else(|()| input.expect_ident_matching("auto").map(|()| MinLength::Auto))
match_ignore_ascii_case! { try!(input.expect_ident()),
"auto" =>
Ok(MinLength::Auto),
_ => Err(())
}
})
} }
} }
@ -1391,7 +1385,7 @@ impl Parse for MaxLength {
input.try(ExtremumLength::parse).map(MaxLength::ExtremumLength) input.try(ExtremumLength::parse).map(MaxLength::ExtremumLength)
.or_else(|()| input.try(LengthOrPercentage::parse_non_negative).map(MaxLength::LengthOrPercentage)) .or_else(|()| input.try(LengthOrPercentage::parse_non_negative).map(MaxLength::LengthOrPercentage))
.or_else(|()| { .or_else(|()| {
match_ignore_ascii_case! { try!(input.expect_ident()), match_ignore_ascii_case! { &try!(input.expect_ident()),
"none" => "none" =>
Ok(MaxLength::None), Ok(MaxLength::None),
_ => Err(()) _ => Err(())

View file

@ -297,7 +297,7 @@ impl Angle {
#[allow(missing_docs)] #[allow(missing_docs)]
pub fn parse_border_radius(context: &ParserContext, input: &mut Parser) -> Result<BorderRadiusSize, ()> { pub fn parse_border_radius(context: &ParserContext, input: &mut Parser) -> Result<BorderRadiusSize, ()> {
input.try(|i| BorderRadiusSize::parse(context, i)).or_else(|_| { input.try(|i| BorderRadiusSize::parse(context, i)).or_else(|_| {
match_ignore_ascii_case! { try!(input.expect_ident()), match_ignore_ascii_case! { &try!(input.expect_ident()),
"thin" => Ok(BorderRadiusSize::circle( "thin" => Ok(BorderRadiusSize::circle(
LengthOrPercentage::Length(NoCalcLength::from_px(1.)))), LengthOrPercentage::Length(NoCalcLength::from_px(1.)))),
"medium" => Ok(BorderRadiusSize::circle( "medium" => Ok(BorderRadiusSize::circle(
@ -312,7 +312,7 @@ pub fn parse_border_radius(context: &ParserContext, input: &mut Parser) -> Resul
#[allow(missing_docs)] #[allow(missing_docs)]
pub fn parse_border_width(input: &mut Parser) -> Result<Length, ()> { pub fn parse_border_width(input: &mut Parser) -> Result<Length, ()> {
input.try(Length::parse_non_negative).or_else(|()| { input.try(Length::parse_non_negative).or_else(|()| {
match_ignore_ascii_case! { try!(input.expect_ident()), match_ignore_ascii_case! { &try!(input.expect_ident()),
"thin" => Ok(Length::from_px(1.)), "thin" => Ok(Length::from_px(1.)),
"medium" => Ok(Length::from_px(3.)), "medium" => Ok(Length::from_px(3.)),
"thick" => Ok(Length::from_px(5.)), "thick" => Ok(Length::from_px(5.)),
@ -335,7 +335,7 @@ impl Parse for BorderWidth {
fn parse(_context: &ParserContext, input: &mut Parser) -> Result<BorderWidth, ()> { fn parse(_context: &ParserContext, input: &mut Parser) -> Result<BorderWidth, ()> {
match input.try(Length::parse_non_negative) { match input.try(Length::parse_non_negative) {
Ok(length) => Ok(BorderWidth::Width(length)), Ok(length) => Ok(BorderWidth::Width(length)),
Err(_) => match_ignore_ascii_case! { try!(input.expect_ident()), Err(_) => match_ignore_ascii_case! { &try!(input.expect_ident()),
"thin" => Ok(BorderWidth::Thin), "thin" => Ok(BorderWidth::Thin),
"medium" => Ok(BorderWidth::Medium), "medium" => Ok(BorderWidth::Medium),
"thick" => Ok(BorderWidth::Thick), "thick" => Ok(BorderWidth::Thick),
@ -714,7 +714,7 @@ pub enum SVGPaintKind {
impl SVGPaintKind { impl SVGPaintKind {
fn parse_ident(input: &mut Parser) -> Result<Self, ()> { fn parse_ident(input: &mut Parser) -> Result<Self, ()> {
Ok(match_ignore_ascii_case! { input.expect_ident()?, Ok(match_ignore_ascii_case! { &input.expect_ident()?,
"none" => SVGPaintKind::None, "none" => SVGPaintKind::None,
"context-fill" => SVGPaintKind::ContextFill, "context-fill" => SVGPaintKind::ContextFill,
"context-stroke" => SVGPaintKind::ContextStroke, "context-stroke" => SVGPaintKind::ContextStroke,

View file

@ -595,17 +595,17 @@ impl Parse for PositionComponent {
.or_else(|()| { .or_else(|()| {
match try!(input.next()) { match try!(input.next()) {
Token::Ident(value) => { Token::Ident(value) => {
match_ignore_ascii_case! { value, match_ignore_ascii_case! { &value,
"center" => Ok(PositionComponent::Keyword(Keyword::Center)), "center" => Ok(PositionComponent::Keyword(Keyword::Center)),
"left" => Ok(PositionComponent::Keyword(Keyword::Left)), "left" => Ok(PositionComponent::Keyword(Keyword::Left)),
"right" => Ok(PositionComponent::Keyword(Keyword::Right)), "right" => Ok(PositionComponent::Keyword(Keyword::Right)),
"top" => Ok(PositionComponent::Keyword(Keyword::Top)), "top" => Ok(PositionComponent::Keyword(Keyword::Top)),
"bottom" => Ok(PositionComponent::Keyword(Keyword::Bottom)), "bottom" => Ok(PositionComponent::Keyword(Keyword::Bottom)),
"x-start" => Ok(PositionComponent::Keyword(Keyword::XStart)), "x-start" => Ok(PositionComponent::Keyword(Keyword::XStart)),
"x-end" => Ok(PositionComponent::Keyword(Keyword::XEnd)), "x-end" => Ok(PositionComponent::Keyword(Keyword::XEnd)),
"y-start" => Ok(PositionComponent::Keyword(Keyword::YStart)), "y-start" => Ok(PositionComponent::Keyword(Keyword::YStart)),
"y-end" => Ok(PositionComponent::Keyword(Keyword::YEnd)), "y-end" => Ok(PositionComponent::Keyword(Keyword::YEnd)),
_ => Err(()) _ => Err(())
} }
}, },
_ => Err(()) _ => Err(())

View file

@ -15,7 +15,8 @@ servo = ["heapsize", "heapsize_derive", "serde", "serde_derive",
[dependencies] [dependencies]
app_units = "0.4" app_units = "0.4"
cssparser = "0.10" cssparser = "0.11"
cssparser-macros = "0.1.0"
euclid = "0.11" euclid = "0.11"
heapsize = {version = "0.3.0", optional = true} heapsize = {version = "0.3.0", optional = true}
heapsize_derive = {version = "0.1", optional = true} heapsize_derive = {version = "0.1", optional = true}

View file

@ -20,8 +20,8 @@ macro_rules! define_cursor {
impl Cursor { impl Cursor {
/// Given a CSS keyword, get the corresponding cursor enum. /// Given a CSS keyword, get the corresponding cursor enum.
pub fn from_css_keyword(keyword: &str) -> Result<Cursor, ()> { pub fn from_css_keyword(keyword: &str) -> Result<Cursor, ()> {
match_ignore_ascii_case! { keyword, match_ignore_ascii_case! { &keyword,
$( concat!($css) => Ok(Cursor::$variant), )+ $( $css => Ok(Cursor::$variant), )+
_ => Err(()) _ => Err(())
} }
} }

View file

@ -14,8 +14,8 @@
#![cfg_attr(feature = "servo", feature(plugin))] #![cfg_attr(feature = "servo", feature(plugin))]
extern crate app_units; extern crate app_units;
#[macro_use] #[macro_use] extern crate cssparser;
extern crate cssparser; #[macro_use] extern crate cssparser_macros;
extern crate euclid; extern crate euclid;
#[cfg(feature = "servo")] extern crate heapsize; #[cfg(feature = "servo")] extern crate heapsize;
#[cfg(feature = "servo")] #[macro_use] extern crate heapsize_derive; #[cfg(feature = "servo")] #[macro_use] extern crate heapsize_derive;

View file

@ -116,7 +116,8 @@ macro_rules! __define_css_keyword_enum__actual {
impl $name { impl $name {
/// Parse this property from a CSS input stream. /// Parse this property from a CSS input stream.
pub fn parse(input: &mut ::cssparser::Parser) -> Result<$name, ()> { pub fn parse(input: &mut ::cssparser::Parser) -> Result<$name, ()> {
match_ignore_ascii_case! { try!(input.expect_ident()), let ident = input.expect_ident()?;
match_ignore_ascii_case! { &ident,
$( $css => Ok($name::$variant), )+ $( $css => Ok($name::$variant), )+
_ => Err(()) _ => Err(())
} }

View file

@ -15,7 +15,7 @@ bindgen = ["style/use_bindgen"]
[dependencies] [dependencies]
app_units = "0.4" app_units = "0.4"
atomic_refcell = "0.1" atomic_refcell = "0.1"
cssparser = "0.10" cssparser = "0.11"
env_logger = {version = "0.4", default-features = false} # disable `regex` to reduce code size env_logger = {version = "0.4", default-features = false} # disable `regex` to reduce code size
euclid = "0.11" euclid = "0.11"
lazy_static = "0.2" lazy_static = "0.2"

View file

@ -14,7 +14,7 @@ testing = ["style/testing"]
[dependencies] [dependencies]
app_units = "0.4" app_units = "0.4"
cssparser = {version = "0.10", features = ["heapsize"]} cssparser = {version = "0.11", features = ["heapsize"]}
euclid = "0.11" euclid = "0.11"
html5ever-atoms = "0.2" html5ever-atoms = "0.2"
matches = "0.1" matches = "0.1"

View file

@ -3,7 +3,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use std::borrow::Cow; use std::borrow::Cow;
use style::str::{split_html_space_chars, str_join, cow_into_ascii_lowercase}; use style::str::{split_html_space_chars, str_join};
#[test] #[test]
pub fn split_html_space_chars_whitespace() { pub fn split_html_space_chars_whitespace() {
@ -34,13 +34,3 @@ pub fn test_str_join_many() {
let expected = "-alpha--beta-gamma-"; let expected = "-alpha--beta-gamma-";
assert_eq!(actual, expected); assert_eq!(actual, expected);
} }
#[test]
pub fn test_cow_into_ascii_lowercase() {
assert!(matches!(cow_into_ascii_lowercase("abc.d"), Cow::Borrowed("abc.d")));
let string = String::from("abc.d");
assert!(matches!(cow_into_ascii_lowercase(string), Cow::Owned(ref s) if s == "abc.d"));
assert!(matches!(cow_into_ascii_lowercase("Abc.d"), Cow::Owned(ref s) if s == "abc.d"));
assert!(matches!(cow_into_ascii_lowercase("aBC.D"), Cow::Owned(ref s) if s == "abc.d"));
assert!(matches!(cow_into_ascii_lowercase("abc.D"), Cow::Owned(ref s) if s == "abc.d"));
}

View file

@ -14,7 +14,7 @@ doctest = false
[dependencies] [dependencies]
app_units = "0.4" app_units = "0.4"
atomic_refcell = "0.1" atomic_refcell = "0.1"
cssparser = "0.10" cssparser = "0.11"
env_logger = "0.4" env_logger = "0.4"
euclid = "0.11" euclid = "0.11"
lazy_static = "0.2" lazy_static = "0.2"