diff --git a/components/servo/Cargo.lock b/components/servo/Cargo.lock index 64b32314511..7121519301f 100644 --- a/components/servo/Cargo.lock +++ b/components/servo/Cargo.lock @@ -137,7 +137,7 @@ version = "0.0.1" dependencies = [ "azure 0.1.0 (git+https://github.com/servo/rust-azure)", "canvas_traits 0.0.1", - "cssparser 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "cssparser 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", "euclid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "gfx_traits 0.0.1", "gleam 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", @@ -154,7 +154,7 @@ name = "canvas_traits" version = "0.0.1" dependencies = [ "azure 0.1.0 (git+https://github.com/servo/rust-azure)", - "cssparser 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "cssparser 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", "euclid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "gfx_traits 0.0.1", "ipc-channel 0.1.0 (git+https://github.com/pcwalton/ipc-channel)", @@ -290,7 +290,7 @@ dependencies = [ [[package]] name = "cssparser" -version = "0.3.6" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "encoding 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)", @@ -929,7 +929,7 @@ dependencies = [ "canvas 0.0.1", "canvas_traits 0.0.1", "clock_ticks 0.0.6 (git+https://github.com/tomaka/clock_ticks)", - "cssparser 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "cssparser 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", "encoding 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)", "euclid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "fnv 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1414,7 +1414,7 @@ dependencies = [ "bitflags 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "canvas 0.0.1", "canvas_traits 0.0.1", - "cssparser 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "cssparser 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", "devtools_traits 0.0.1", "encoding 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)", "euclid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1480,7 +1480,7 @@ version = "0.1.0" source = "git+https://github.com/servo/rust-selectors#572353b3209af040cd3e6261978b09c7f8122844" dependencies = [ "bitflags 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", - "cssparser 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "cssparser 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", "fnv 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "matches 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "quickersort 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1622,7 +1622,7 @@ name = "style" version = "0.0.1" dependencies = [ "bitflags 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", - "cssparser 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "cssparser 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", "encoding 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)", "euclid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "fnv 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1647,7 +1647,7 @@ dependencies = [ name = "style_tests" version = "0.0.1" dependencies = [ - "cssparser 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "cssparser 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", "euclid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "selectors 0.1.0 (git+https://github.com/servo/rust-selectors)", "string_cache 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1662,7 +1662,7 @@ dependencies = [ name = "style_traits" version = "0.0.1" dependencies = [ - "cssparser 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "cssparser 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", "euclid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1784,7 +1784,7 @@ version = "0.0.1" dependencies = [ "azure 0.1.0 (git+https://github.com/servo/rust-azure)", "bitflags 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", - "cssparser 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "cssparser 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", "euclid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "getopts 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", "html5ever 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", diff --git a/components/style/Cargo.toml b/components/style/Cargo.toml index c67bf713616..ce0553f95f9 100644 --- a/components/style/Cargo.toml +++ b/components/style/Cargo.toml @@ -23,7 +23,7 @@ git = "https://github.com/servo/rust-selectors" features = ["unstable"] [dependencies.cssparser] -version = "0.3.6" +version = "0.3.8" features = [ "serde-serialization" ] [dependencies.url] diff --git a/components/style/custom_properties.rs b/components/style/custom_properties.rs index 7a8ce7c2c67..057b7c27ce4 100644 --- a/components/style/custom_properties.rs +++ b/components/style/custom_properties.rs @@ -2,7 +2,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -use cssparser::{Parser, Token, SourcePosition}; +use cssparser::{Parser, Token, SourcePosition, Delimiter}; use properties::DeclaredValue; use std::collections::{HashMap, HashSet}; use std::sync::Arc; @@ -37,8 +37,6 @@ pub struct BorrowedValue<'a> { pub fn parse(input: &mut Parser) -> Result { let start = input.position(); let mut references = Some(HashSet::new()); - // FIXME: don’t consume a top-level `!` as that would prevent parsing `!important`. - // Maybe using Parser::parse_until_before? try!(parse_declaration_value(input, &mut references)); Ok(Value { value: input.slice_from(start).to_owned(), @@ -49,42 +47,13 @@ pub fn parse(input: &mut Parser) -> Result { /// https://drafts.csswg.org/css-syntax-3/#typedef-declaration-value pub fn parse_declaration_value(input: &mut Parser, references: &mut Option>) -> Result<(), ()> { - if input.is_exhausted() { - // Need at least one token - return Err(()) - } - while let Ok(token) = input.next() { - match token { - Token::BadUrl | - Token::BadString | - Token::CloseParenthesis | - Token::CloseSquareBracket | - Token::CloseCurlyBracket | - - Token::Semicolon | - Token::Delim('!') => { - return Err(()) - } - - Token::Function(ref name) if name == "var" => { - try!(input.parse_nested_block(|input| { - parse_var_function(input, references) - })); - } - - Token::Function(_) | - Token::ParenthesisBlock | - Token::CurlyBracketBlock | - Token::SquareBracketBlock => { - try!(input.parse_nested_block(|input| { - parse_declaration_value_block(input, references) - })); - } - - _ => {} + input.parse_until_before(Delimiter::Bang | Delimiter::Semicolon, |input| { + if input.is_exhausted() { + // Need at least one token + return Err(()) } - } - Ok(()) + parse_declaration_value_block(input, references) + }) } /// Like parse_declaration_value, @@ -312,11 +281,11 @@ fn substitute_block(input: &mut Parser, -> Result<(), ()> where F: FnMut(&Name, &mut String) -> Result<(), ()> { loop { - let input_slice = input.slice_from(*start); + let before_this_token = input.position(); let token = if let Ok(token) = input.next() { token } else { break }; match token { Token::Function(ref name) if name == "var" => { - substituted.push_str(input_slice); + substituted.push_str(input.slice(*start..before_this_token)); try!(input.parse_nested_block(|input| { // parse_var_function() ensures neither .unwrap() will fail. let name = input.expect_ident().unwrap(); diff --git a/ports/cef/Cargo.lock b/ports/cef/Cargo.lock index c10a232265b..2328d2d2111 100644 --- a/ports/cef/Cargo.lock +++ b/ports/cef/Cargo.lock @@ -129,7 +129,7 @@ version = "0.0.1" dependencies = [ "azure 0.1.0 (git+https://github.com/servo/rust-azure)", "canvas_traits 0.0.1", - "cssparser 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "cssparser 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", "euclid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "gfx_traits 0.0.1", "gleam 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", @@ -146,7 +146,7 @@ name = "canvas_traits" version = "0.0.1" dependencies = [ "azure 0.1.0 (git+https://github.com/servo/rust-azure)", - "cssparser 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "cssparser 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", "euclid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "gfx_traits 0.0.1", "ipc-channel 0.1.0 (git+https://github.com/pcwalton/ipc-channel)", @@ -282,7 +282,7 @@ dependencies = [ [[package]] name = "cssparser" -version = "0.3.6" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "encoding 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)", @@ -880,7 +880,7 @@ dependencies = [ "canvas 0.0.1", "canvas_traits 0.0.1", "clock_ticks 0.0.6 (git+https://github.com/tomaka/clock_ticks)", - "cssparser 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "cssparser 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", "encoding 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)", "euclid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "fnv 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1348,7 +1348,7 @@ dependencies = [ "bitflags 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "canvas 0.0.1", "canvas_traits 0.0.1", - "cssparser 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "cssparser 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", "devtools_traits 0.0.1", "encoding 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)", "euclid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1406,7 +1406,7 @@ version = "0.1.0" source = "git+https://github.com/servo/rust-selectors#572353b3209af040cd3e6261978b09c7f8122844" dependencies = [ "bitflags 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", - "cssparser 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "cssparser 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", "fnv 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "matches 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "quickersort 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1581,7 +1581,7 @@ name = "style" version = "0.0.1" dependencies = [ "bitflags 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", - "cssparser 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "cssparser 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", "encoding 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)", "euclid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "fnv 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1606,7 +1606,7 @@ dependencies = [ name = "style_traits" version = "0.0.1" dependencies = [ - "cssparser 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "cssparser 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", "euclid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1728,7 +1728,7 @@ version = "0.0.1" dependencies = [ "azure 0.1.0 (git+https://github.com/servo/rust-azure)", "bitflags 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", - "cssparser 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "cssparser 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", "euclid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "getopts 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", "html5ever 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", diff --git a/ports/gonk/Cargo.lock b/ports/gonk/Cargo.lock index 2974aa69209..65b3d3a1a4f 100644 --- a/ports/gonk/Cargo.lock +++ b/ports/gonk/Cargo.lock @@ -110,7 +110,7 @@ version = "0.0.1" dependencies = [ "azure 0.1.0 (git+https://github.com/servo/rust-azure)", "canvas_traits 0.0.1", - "cssparser 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "cssparser 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", "euclid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "gfx_traits 0.0.1", "gleam 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", @@ -127,7 +127,7 @@ name = "canvas_traits" version = "0.0.1" dependencies = [ "azure 0.1.0 (git+https://github.com/servo/rust-azure)", - "cssparser 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "cssparser 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", "euclid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "gfx_traits 0.0.1", "ipc-channel 0.1.0 (git+https://github.com/pcwalton/ipc-channel)", @@ -252,7 +252,7 @@ dependencies = [ [[package]] name = "cssparser" -version = "0.3.6" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "encoding 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)", @@ -764,7 +764,7 @@ dependencies = [ "canvas 0.0.1", "canvas_traits 0.0.1", "clock_ticks 0.0.6 (git+https://github.com/tomaka/clock_ticks)", - "cssparser 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "cssparser 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", "encoding 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)", "euclid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "fnv 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1214,7 +1214,7 @@ dependencies = [ "bitflags 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "canvas 0.0.1", "canvas_traits 0.0.1", - "cssparser 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "cssparser 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", "devtools_traits 0.0.1", "encoding 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)", "euclid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1272,7 +1272,7 @@ version = "0.1.0" source = "git+https://github.com/servo/rust-selectors#572353b3209af040cd3e6261978b09c7f8122844" dependencies = [ "bitflags 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", - "cssparser 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "cssparser 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", "fnv 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "matches 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "quickersort 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1427,7 +1427,7 @@ name = "style" version = "0.0.1" dependencies = [ "bitflags 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", - "cssparser 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "cssparser 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", "encoding 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)", "euclid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "fnv 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1452,7 +1452,7 @@ dependencies = [ name = "style_traits" version = "0.0.1" dependencies = [ - "cssparser 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "cssparser 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", "euclid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1563,7 +1563,7 @@ version = "0.0.1" dependencies = [ "azure 0.1.0 (git+https://github.com/servo/rust-azure)", "bitflags 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", - "cssparser 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "cssparser 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", "euclid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "getopts 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", "html5ever 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", diff --git a/tests/wpt/metadata-css/css-variables-1_dev/html/css-vars-custom-property-inheritance.htm.ini b/tests/wpt/metadata-css/css-variables-1_dev/html/css-vars-custom-property-inheritance.htm.ini deleted file mode 100644 index 87fee1c5ce8..00000000000 --- a/tests/wpt/metadata-css/css-variables-1_dev/html/css-vars-custom-property-inheritance.htm.ini +++ /dev/null @@ -1,3 +0,0 @@ -[css-vars-custom-property-inheritance.htm] - type: reftest - expected: FAIL diff --git a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-declaration-20.htm.ini b/tests/wpt/metadata-css/css-variables-1_dev/html/variable-declaration-20.htm.ini deleted file mode 100644 index e3de1be4109..00000000000 --- a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-declaration-20.htm.ini +++ /dev/null @@ -1,3 +0,0 @@ -[variable-declaration-20.htm] - type: reftest - expected: FAIL diff --git a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-reference-13.htm.ini b/tests/wpt/metadata-css/css-variables-1_dev/html/variable-reference-13.htm.ini deleted file mode 100644 index 7f832f8cdac..00000000000 --- a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-reference-13.htm.ini +++ /dev/null @@ -1,3 +0,0 @@ -[variable-reference-13.htm] - type: reftest - expected: FAIL diff --git a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-reference-14.htm.ini b/tests/wpt/metadata-css/css-variables-1_dev/html/variable-reference-14.htm.ini deleted file mode 100644 index dd849805038..00000000000 --- a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-reference-14.htm.ini +++ /dev/null @@ -1,3 +0,0 @@ -[variable-reference-14.htm] - type: reftest - expected: FAIL