diff --git a/third_party/rust/cssparser/.cargo-checksum.json b/third_party/rust/cssparser/.cargo-checksum.json index 999eacf07062..513de4e134e0 100644 --- a/third_party/rust/cssparser/.cargo-checksum.json +++ b/third_party/rust/cssparser/.cargo-checksum.json @@ -1 +1 @@ -{"files":{".travis.yml":"f1fb4b65964c81bc1240544267ea334f554ca38ae7a74d57066f4d47d2b5d568","Cargo.toml":"fac23b751b4a88d7102e488a4417d695099287c6c88541e64f11dd8bb52d710f","LICENSE":"fab3dd6bdab226f1c08630b1dd917e11fcb4ec5e1e020e2c16f83a0a13863e85","README.md":"c5781e673335f37ed3d7acb119f8ed33efdf6eb75a7094b7da2abe0c3230adb8","build.rs":"950bcc47a196f07f99f59637c28cc65e02a885130011f90a2b2608248b4724a2","build/match_byte.rs":"2c84b8ca5884347d2007f49aecbd85b4c7582085526e2704399817249996e19b","docs/.nojekyll":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855","docs/404.html":"025861f76f8d1f6d67c20ab624c6e418f4f824385e2dd8ad8732c4ea563c6a2e","docs/index.html":"025861f76f8d1f6d67c20ab624c6e418f4f824385e2dd8ad8732c4ea563c6a2e","src/color.rs":"c92cdb9dcabcc63de005478ca770858b330f02ee712f9fd21b31eeb7472df72d","src/cow_rc_str.rs":"541216f8ef74ee3cc5cbbc1347e5f32ed66588c401851c9a7d68b867aede1de0","src/from_bytes.rs":"331fe63af2123ae3675b61928a69461b5ac77799fff3ce9978c55cf2c558f4ff","src/lib.rs":"a0433a3cf2147e09a8b2471f50ca136d3494d7fc764417b43dc146e2dd5a09ff","src/macros.rs":"adb9773c157890381556ea83d7942dcc676f99eea71abbb6afeffee1e3f28960","src/nth.rs":"0450aa21ecc4639cbe350a143598d570ed9d2b03ac21b9cb795577e0f92f3be6","src/parser.rs":"3533ece7309e694eccf4858435ad090fc6bf98123d443691572931c4323f44d4","src/rules_and_declarations.rs":"eda11baa27c80df932e43460ec6864ff8c3367aaf7673c15410443097efe2506","src/serializer.rs":"3dc1d9441c9602f26d34c0b209f6d3954814815b780c068f9dc3514d808de3d9","src/size_of_tests.rs":"ccbbd8601646798f87b57877135346bc270736560d2c85b5e5ae8cd6492efd65","src/tests.rs":"e8c2593ee6e93e10fd2bb6a9b8b872d280577ba132c04a533f76c58c7233bf70","src/tokenizer.rs":"c46d540cf589de8a2a2a0d918575a257de4d6a55af78e87b0d9c1345032b80ef","src/unicode_range.rs":"c1c4ed2493e09d248c526ce1ef8575a5f8258da3962b64ffc814ef3bdf9780d0"},"package":"44313341610282488e1156ad1fedebca51c54766c87a041d0287b10499c04ba1"} \ No newline at end of file +{"files":{".travis.yml":"f1fb4b65964c81bc1240544267ea334f554ca38ae7a74d57066f4d47d2b5d568","Cargo.toml":"7807f16d417eb1a6ede56cd4ba2da6c5c63e4530289b3f0848f4b154e18eba02","LICENSE":"fab3dd6bdab226f1c08630b1dd917e11fcb4ec5e1e020e2c16f83a0a13863e85","README.md":"c5781e673335f37ed3d7acb119f8ed33efdf6eb75a7094b7da2abe0c3230adb8","build.rs":"b29fc57747f79914d1c2fb541e2bb15a003028bb62751dcb901081ccc174b119","build/match_byte.rs":"2c84b8ca5884347d2007f49aecbd85b4c7582085526e2704399817249996e19b","docs/.nojekyll":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855","docs/404.html":"025861f76f8d1f6d67c20ab624c6e418f4f824385e2dd8ad8732c4ea563c6a2e","docs/index.html":"025861f76f8d1f6d67c20ab624c6e418f4f824385e2dd8ad8732c4ea563c6a2e","src/color.rs":"c60f1b0ab7a2a6213e434604ee33f78e7ef74347f325d86d0b9192d8225ae1cc","src/cow_rc_str.rs":"541216f8ef74ee3cc5cbbc1347e5f32ed66588c401851c9a7d68b867aede1de0","src/from_bytes.rs":"331fe63af2123ae3675b61928a69461b5ac77799fff3ce9978c55cf2c558f4ff","src/lib.rs":"46c377e0c9a75780d5cb0bcf4dfb960f0fb2a996a13e7349bb111b9082252233","src/macros.rs":"adb9773c157890381556ea83d7942dcc676f99eea71abbb6afeffee1e3f28960","src/nth.rs":"5c70fb542d1376cddab69922eeb4c05e4fcf8f413f27563a2af50f72a47c8f8c","src/parser.rs":"9ed4aec998221eb2d2ba99db2f9f82a02399fb0c3b8500627f68f5aab872adde","src/rules_and_declarations.rs":"be2c4f3f3bb673d866575b6cb6084f1879dff07356d583ca9a3595f63b7f916f","src/serializer.rs":"4ccfc9b4fe994aab3803662bbf31cc25052a6a39531073a867b14b224afe42dd","src/size_of_tests.rs":"e5f63c8c18721cc3ff7a5407e84f9889ffa10e66da96e8510a696c3e00ad72d5","src/tests.rs":"80b02c80ab0fd580dad9206615c918e0db7dff63dfed0feeedb66f317d24b24b","src/tokenizer.rs":"429b2cba419cf8b923fbcc32d3bd34c0b39284ebfcb9fc29b8eb8643d8d5f312","src/unicode_range.rs":"c1c4ed2493e09d248c526ce1ef8575a5f8258da3962b64ffc814ef3bdf9780d0"},"package":"8a807ac3ab7a217829c2a3b65732b926b2befe6a35f33b4bf8b503692430f223"} \ No newline at end of file diff --git a/third_party/rust/cssparser/Cargo.toml b/third_party/rust/cssparser/Cargo.toml index bf5b8f3b9a2f..614012644965 100644 --- a/third_party/rust/cssparser/Cargo.toml +++ b/third_party/rust/cssparser/Cargo.toml @@ -12,7 +12,7 @@ [package] name = "cssparser" -version = "0.22.0" +version = "0.23.2" authors = ["Simon Sapin "] build = "build.rs" exclude = ["src/css-parsing-tests/**", "src/big-data-url.css"] @@ -22,48 +22,48 @@ readme = "README.md" keywords = ["css", "syntax", "parser"] license = "MPL-2.0" repository = "https://github.com/servo/rust-cssparser" -[dependencies.itoa] -version = "0.3" - -[dependencies.serde] -version = "1.0" -optional = true - -[dependencies.procedural-masquerade] -version = "0.1" - -[dependencies.matches] -version = "0.1" - -[dependencies.heapsize] -version = ">= 0.3, < 0.5" -optional = true - -[dependencies.smallvec] -version = "0.4.3" - -[dependencies.phf] -version = "0.7" - [dependencies.cssparser-macros] version = "0.3" [dependencies.dtoa-short] version = "0.3" -[dev-dependencies.rustc-serialize] + +[dependencies.heapsize] +version = ">= 0.3, < 0.5" +optional = true + +[dependencies.itoa] version = "0.3" +[dependencies.matches] +version = "0.1" + +[dependencies.phf] +version = "0.7" + +[dependencies.procedural-masquerade] +version = "0.1" + +[dependencies.serde] +version = "1.0" +optional = true + +[dependencies.smallvec] +version = "0.6" [dev-dependencies.difference] version = "1.0" [dev-dependencies.encoding_rs] version = "0.7" -[build-dependencies.syn] -version = "0.11" +[dev-dependencies.rustc-serialize] +version = "0.3" [build-dependencies.quote] version = "0.3" +[build-dependencies.syn] +version = "0.11" + [features] -dummy_match_byte = [] bench = [] +dummy_match_byte = [] diff --git a/third_party/rust/cssparser/build.rs b/third_party/rust/cssparser/build.rs index 322c1790e688..5c06d2981963 100644 --- a/third_party/rust/cssparser/build.rs +++ b/third_party/rust/cssparser/build.rs @@ -33,6 +33,11 @@ mod codegen { } fn main() { + if std::mem::size_of::>() == 1 { + // https://github.com/rust-lang/rust/pull/45225 + println!("cargo:rustc-cfg=rustc_has_pr45225") + } + let manifest_dir = env::var("CARGO_MANIFEST_DIR").unwrap(); let tokenizer_rs = Path::new(&manifest_dir).join("src/tokenizer.rs"); codegen::main(&tokenizer_rs); diff --git a/third_party/rust/cssparser/src/color.rs b/third_party/rust/cssparser/src/color.rs index 9c23d17b67a9..2f4c2f487422 100644 --- a/third_party/rust/cssparser/src/color.rs +++ b/third_party/rust/cssparser/src/color.rs @@ -144,11 +144,134 @@ impl ToCss for Color { } } +/// Either a number or a percentage. +pub enum NumberOrPercentage { + /// ``. + Number { + /// The numeric value parsed, as a float. + value: f32, + }, + /// `` + Percentage { + /// The value as a float, divided by 100 so that the nominal range is + /// 0.0 to 1.0. + unit_value: f32, + }, +} + +impl NumberOrPercentage { + fn unit_value(&self) -> f32 { + match *self { + NumberOrPercentage::Number { value } => value, + NumberOrPercentage::Percentage { unit_value } => unit_value, + } + } +} + +/// Either an angle or a number. +pub enum AngleOrNumber { + /// ``. + Number { + /// The numeric value parsed, as a float. + value: f32, + }, + /// `` + Angle { + /// The value as a number of degrees. + degrees: f32, + }, +} + +impl AngleOrNumber { + fn degrees(&self) -> f32 { + match *self { + AngleOrNumber::Number { value } => value, + AngleOrNumber::Angle { degrees } => degrees, + } + } +} + +/// A trait that can be used to hook into how `cssparser` parses color +/// components, with the intention of implementing more complicated behavior. +/// +/// For example, this is used by Servo to support calc() in color. +pub trait ColorComponentParser<'i> { + /// A custom error type that can be returned from the parsing functions. + type Error: 'i; + + /// Parse an `` or ``. + /// + /// Returns the result in degrees. + fn parse_angle_or_number<'t>( + &self, + input: &mut Parser<'i, 't>, + ) -> Result> { + let location = input.current_source_location(); + Ok(match *input.next()? { + Token::Number { value, .. } => AngleOrNumber::Number { value }, + Token::Dimension { value: v, ref unit, .. } => { + let degrees = match_ignore_ascii_case! { &*unit, + "deg" => v, + "grad" => v * 360. / 400., + "rad" => v * 360. / (2. * PI), + "turn" => v * 360., + _ => return Err(location.new_unexpected_token_error(Token::Ident(unit.clone()))), + }; + + AngleOrNumber::Angle { degrees } + } + ref t => return Err(location.new_unexpected_token_error(t.clone())) + }) + } + + /// Parse a `` value. + /// + /// Returns the result in a number from 0.0 to 1.0. + fn parse_percentage<'t>( + &self, + input: &mut Parser<'i, 't>, + ) -> Result> { + input.expect_percentage().map_err(From::from) + } + + /// Parse a `` value. + fn parse_number<'t>( + &self, + input: &mut Parser<'i, 't>, + ) -> Result> { + input.expect_number().map_err(From::from) + } + + /// Parse a `` value or a `` value. + fn parse_number_or_percentage<'t>( + &self, + input: &mut Parser<'i, 't>, + ) -> Result> { + let location = input.current_source_location(); + Ok(match *input.next()? { + Token::Number { value, .. } => NumberOrPercentage::Number { value }, + Token::Percentage { unit_value, .. } => NumberOrPercentage::Percentage { unit_value }, + ref t => return Err(location.new_unexpected_token_error(t.clone())) + }) + } +} + +struct DefaultComponentParser; +impl<'i> ColorComponentParser<'i> for DefaultComponentParser { + type Error = (); +} + impl Color { /// Parse a value, per CSS Color Module Level 3. /// /// FIXME(#2) Deprecated CSS2 System Colors are not supported yet. - pub fn parse<'i, 't>(input: &mut Parser<'i, 't>) -> Result> { + pub fn parse_with<'i, 't, ComponentParser>( + component_parser: &ComponentParser, + input: &mut Parser<'i, 't>, + ) -> Result> + where + ComponentParser: ColorComponentParser<'i>, + { // FIXME: remove clone() when lifetimes are non-lexical let location = input.current_source_location(); let token = input.next()?.clone(); @@ -159,11 +282,19 @@ impl Color { Token::Ident(ref value) => parse_color_keyword(&*value), Token::Function(ref name) => { return input.parse_nested_block(|arguments| { - parse_color_function(&*name, arguments).map_err(|e| e.into()) - }).map_err(ParseError::<()>::basic); + parse_color_function(component_parser, &*name, arguments) + }) } _ => Err(()) - }.map_err(|()| location.new_basic_unexpected_token_error(token)) + }.map_err(|()| location.new_unexpected_token_error(token)) + } + + /// Parse a value, per CSS Color Module Level 3. + pub fn parse<'i, 't>( + input: &mut Parser<'i, 't>, + ) -> Result> { + let component_parser = DefaultComponentParser; + Self::parse_with(&component_parser, input).map_err(ParseError::basic) } /// Parse a color hash, without the leading '#' character. @@ -195,10 +326,8 @@ impl Color { _ => Err(()) } } - } - #[inline] fn rgb(red: u8, green: u8, blue: u8) -> Color { rgba(red, green, blue, 255) @@ -420,11 +549,18 @@ fn clamp_floor_256_f32(val: f32) -> u8 { } #[inline] -fn parse_color_function<'i, 't>(name: &str, arguments: &mut Parser<'i, 't>) -> Result> { +fn parse_color_function<'i, 't, ComponentParser>( + component_parser: &ComponentParser, + name: &str, + arguments: &mut Parser<'i, 't> +) -> Result> +where + ComponentParser: ColorComponentParser<'i>, +{ let (red, green, blue, uses_commas) = match_ignore_ascii_case! { name, - "rgb" | "rgba" => parse_rgb_components_rgb(arguments)?, - "hsl" | "hsla" => parse_rgb_components_hsl(arguments)?, - _ => return Err(arguments.new_basic_unexpected_token_error(Token::Ident(name.to_owned().into()))), + "rgb" | "rgba" => parse_rgb_components_rgb(component_parser, arguments)?, + "hsl" | "hsla" => parse_rgb_components_hsl(component_parser, arguments)?, + _ => return Err(arguments.new_unexpected_token_error(Token::Ident(name.to_owned().into()))), }; let alpha = if !arguments.is_exhausted() { @@ -433,18 +569,7 @@ fn parse_color_function<'i, 't>(name: &str, arguments: &mut Parser<'i, 't>) -> R } else { arguments.expect_delim('/')?; }; - let location = arguments.current_source_location(); - match *arguments.next()? { - Token::Number { value: v, .. } => { - clamp_unit_f32(v) - } - Token::Percentage { unit_value: v, .. } => { - clamp_unit_f32(v) - } - ref t => { - return Err(location.new_basic_unexpected_token_error(t.clone())) - } - } + clamp_unit_f32(component_parser.parse_number_or_percentage(arguments)?.unit_value()) } else { 255 }; @@ -455,93 +580,73 @@ fn parse_color_function<'i, 't>(name: &str, arguments: &mut Parser<'i, 't>) -> R #[inline] -fn parse_rgb_components_rgb<'i, 't>(arguments: &mut Parser<'i, 't>) -> Result<(u8, u8, u8, bool), BasicParseError<'i>> { - let red: u8; - let green: u8; - let blue: u8; - let mut uses_commas = false; - +fn parse_rgb_components_rgb<'i, 't, ComponentParser>( + component_parser: &ComponentParser, + arguments: &mut Parser<'i, 't> +) -> Result<(u8, u8, u8, bool), ParseError<'i, ComponentParser::Error>> +where + ComponentParser: ColorComponentParser<'i>, +{ // Either integers or percentages, but all the same type. // https://drafts.csswg.org/css-color/#rgb-functions - // FIXME: remove .clone() when lifetimes are non-lexical. - let location = arguments.current_source_location(); - match arguments.next()?.clone() { - Token::Number { value: v, .. } => { - red = clamp_floor_256_f32(v); - green = clamp_floor_256_f32(match arguments.next()?.clone() { - Token::Number { value: v, .. } => v, - Token::Comma => { - uses_commas = true; - arguments.expect_number()? - } - t => return Err(location.new_basic_unexpected_token_error(t)) - }); - if uses_commas { - arguments.expect_comma()?; - } - blue = clamp_floor_256_f32(arguments.expect_number()?); + let (red, is_number) = match component_parser.parse_number_or_percentage(arguments)? { + NumberOrPercentage::Number { value } => { + (clamp_floor_256_f32(value), true) } - Token::Percentage { unit_value, .. } => { - red = clamp_unit_f32(unit_value); - green = clamp_unit_f32(match arguments.next()?.clone() { - Token::Percentage { unit_value, .. } => unit_value, - Token::Comma => { - uses_commas = true; - arguments.expect_percentage()? - } - t => return Err(location.new_basic_unexpected_token_error(t)) - }); - if uses_commas { - arguments.expect_comma()?; - } - blue = clamp_unit_f32(arguments.expect_percentage()?); + NumberOrPercentage::Percentage { unit_value } => { + (clamp_unit_f32(unit_value), false) } - t => return Err(location.new_basic_unexpected_token_error(t)) }; - return Ok((red, green, blue, uses_commas)); + + let uses_commas = arguments.try(|i| i.expect_comma()).is_ok(); + + let green; + let blue; + if is_number { + green = clamp_floor_256_f32(component_parser.parse_number(arguments)?); + if uses_commas { + arguments.expect_comma()?; + } + blue = clamp_floor_256_f32(component_parser.parse_number(arguments)?); + } else { + green = clamp_unit_f32(component_parser.parse_percentage(arguments)?); + if uses_commas { + arguments.expect_comma()?; + } + blue = clamp_unit_f32(component_parser.parse_percentage(arguments)?); + } + + Ok((red, green, blue, uses_commas)) } #[inline] -fn parse_rgb_components_hsl<'i, 't>(arguments: &mut Parser<'i, 't>) -> Result<(u8, u8, u8, bool), BasicParseError<'i>> { - let mut uses_commas = false; +fn parse_rgb_components_hsl<'i, 't, ComponentParser>( + component_parser: &ComponentParser, + arguments: &mut Parser<'i, 't> +) -> Result<(u8, u8, u8, bool), ParseError<'i, ComponentParser::Error>> +where + ComponentParser: ColorComponentParser<'i>, +{ // Hue given as an angle // https://drafts.csswg.org/css-values/#angles - let location = arguments.current_source_location(); - let hue_degrees = match *arguments.next()? { - Token::Number { value: v, .. } => v, - Token::Dimension { value: v, ref unit, .. } => { - match_ignore_ascii_case! { &*unit, - "deg" => v, - "grad" => v * 360. / 400., - "rad" => v * 360. / (2. * PI), - "turn" => v * 360., - _ => return Err(location.new_basic_unexpected_token_error(Token::Ident(unit.clone()))), - } - } - ref t => return Err(location.new_basic_unexpected_token_error(t.clone())) - }; + let hue_degrees = component_parser.parse_angle_or_number(arguments)?.degrees(); + // Subtract an integer before rounding, to avoid some rounding errors: let hue_normalized_degrees = hue_degrees - 360. * (hue_degrees / 360.).floor(); let hue = hue_normalized_degrees / 360.; // Saturation and lightness are clamped to 0% ... 100% // https://drafts.csswg.org/css-color/#the-hsl-notation - let location = arguments.current_source_location(); - let saturation = match arguments.next()?.clone() { - Token::Percentage { unit_value, .. } => unit_value, - Token::Comma => { - uses_commas = true; - arguments.expect_percentage()? - } - t => return Err(location.new_basic_unexpected_token_error(t)) - }; + let uses_commas = arguments.try(|i| i.expect_comma()).is_ok(); + + let saturation = component_parser.parse_percentage(arguments)?; let saturation = saturation.max(0.).min(1.); if uses_commas { arguments.expect_comma()?; } - let lightness = arguments.expect_percentage()?; + let lightness = component_parser.parse_percentage(arguments)?; let lightness = lightness.max(0.).min(1.); // https://drafts.csswg.org/css-color/#hsl-color diff --git a/third_party/rust/cssparser/src/lib.rs b/third_party/rust/cssparser/src/lib.rs index f1a714efd4f3..b21459226fac 100644 --- a/third_party/rust/cssparser/src/lib.rs +++ b/third_party/rust/cssparser/src/lib.rs @@ -89,7 +89,7 @@ pub use rules_and_declarations::{DeclarationParser, DeclarationListParser, parse pub use rules_and_declarations::{RuleListParser, parse_one_rule}; pub use rules_and_declarations::{AtRuleType, QualifiedRuleParser, AtRuleParser}; pub use from_bytes::{stylesheet_encoding, EncodingSupport}; -pub use color::{RGBA, Color, parse_color_keyword}; +pub use color::{RGBA, Color, parse_color_keyword, AngleOrNumber, NumberOrPercentage, ColorComponentParser}; pub use nth::parse_nth; pub use serializer::{ToCss, CssStringWriter, serialize_identifier, serialize_string, TokenSerializationType}; pub use parser::{Parser, Delimiter, Delimiters, ParserState, ParserInput}; diff --git a/third_party/rust/cssparser/src/nth.rs b/third_party/rust/cssparser/src/nth.rs index ea0b9e545f0d..b3a6a600c199 100644 --- a/third_party/rust/cssparser/src/nth.rs +++ b/third_party/rust/cssparser/src/nth.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 std::ascii::AsciiExt; +#[allow(unused_imports)] use std::ascii::AsciiExt; use super::{Token, Parser, ParserInput, BasicParseError}; diff --git a/third_party/rust/cssparser/src/parser.rs b/third_party/rust/cssparser/src/parser.rs index faaa773bb5dd..76736a85b905 100644 --- a/third_party/rust/cssparser/src/parser.rs +++ b/third_party/rust/cssparser/src/parser.rs @@ -5,7 +5,7 @@ use cow_rc_str::CowRcStr; use smallvec::SmallVec; use std::ops::Range; -use std::ascii::AsciiExt; +#[allow(unused_imports)] use std::ascii::AsciiExt; use std::ops::BitOr; use tokenizer::{Token, Tokenizer, SourcePosition, SourceLocation}; diff --git a/third_party/rust/cssparser/src/rules_and_declarations.rs b/third_party/rust/cssparser/src/rules_and_declarations.rs index 320720948c28..f12330de0094 100644 --- a/third_party/rust/cssparser/src/rules_and_declarations.rs +++ b/third_party/rust/cssparser/src/rules_and_declarations.rs @@ -6,7 +6,7 @@ use cow_rc_str::CowRcStr; use parser::{parse_until_before, parse_until_after, parse_nested_block, ParserState}; -use std::ascii::AsciiExt; +#[allow(unused_imports)] use std::ascii::AsciiExt; use super::{Token, Parser, Delimiter, ParseError, BasicParseError, BasicParseErrorKind}; /// Parse `!important`. diff --git a/third_party/rust/cssparser/src/serializer.rs b/third_party/rust/cssparser/src/serializer.rs index 20c64e53d851..1a737946d824 100644 --- a/third_party/rust/cssparser/src/serializer.rs +++ b/third_party/rust/cssparser/src/serializer.rs @@ -4,7 +4,7 @@ use dtoa_short::{self, Notation}; use itoa; -use std::ascii::AsciiExt; +#[allow(unused_imports)] use std::ascii::AsciiExt; use std::fmt::{self, Write}; use std::io; use std::str; @@ -110,7 +110,6 @@ impl<'a> ToCss for Token<'a> { Token::PrefixMatch => dest.write_str("^=")?, Token::SuffixMatch => dest.write_str("$=")?, Token::SubstringMatch => dest.write_str("*=")?, - Token::Column => dest.write_str("||")?, Token::CDO => dest.write_str("")?, @@ -455,7 +454,6 @@ impl<'a> Token<'a> { Token::Comment(_) => DelimSlash, Token::DashMatch => DashMatch, Token::SubstringMatch => SubstringMatch, - Token::Column => DelimBar, Token::CDC => CDC, Token::Function(_) => Function, Token::ParenthesisBlock => OpenParen, diff --git a/third_party/rust/cssparser/src/size_of_tests.rs b/third_party/rust/cssparser/src/size_of_tests.rs index de81172d00fe..b07abc07a1d9 100644 --- a/third_party/rust/cssparser/src/size_of_tests.rs +++ b/third_party/rust/cssparser/src/size_of_tests.rs @@ -37,10 +37,10 @@ size_of_test!(std_cow_str, Cow<'static, str>, 32); size_of_test!(cow_rc_str, CowRcStr, 16); size_of_test!(tokenizer, ::tokenizer::Tokenizer, 72); -size_of_test!(parser_input, ::parser::ParserInput, 144); +size_of_test!(parser_input, ::parser::ParserInput, if cfg!(rustc_has_pr45225) { 136 } else { 144 }); size_of_test!(parser, ::parser::Parser, 16); size_of_test!(source_position, ::SourcePosition, 8); size_of_test!(parser_state, ::ParserState, 24); size_of_test!(basic_parse_error, ::BasicParseError, 48); -size_of_test!(parse_error_lower_bound, ::ParseError<()>, 56); +size_of_test!(parse_error_lower_bound, ::ParseError<()>, if cfg!(rustc_has_pr45225) { 48 } else { 56 }); diff --git a/third_party/rust/cssparser/src/tests.rs b/third_party/rust/cssparser/src/tests.rs index 11a0410b7a2e..f4f4bd40d07d 100644 --- a/third_party/rust/cssparser/src/tests.rs +++ b/third_party/rust/cssparser/src/tests.rs @@ -881,7 +881,6 @@ fn one_component_value_to_json(token: Token, input: &mut Parser) -> Json { Token::PrefixMatch => "^=".to_json(), Token::SuffixMatch => "$=".to_json(), Token::SubstringMatch => "*=".to_json(), - Token::Column => "||".to_json(), Token::CDO => "".to_json(), diff --git a/third_party/rust/cssparser/src/tokenizer.rs b/third_party/rust/cssparser/src/tokenizer.rs index 507d0e724b67..a74d7c2f5937 100644 --- a/third_party/rust/cssparser/src/tokenizer.rs +++ b/third_party/rust/cssparser/src/tokenizer.rs @@ -6,7 +6,7 @@ use std::ops::Range; use std::char; -use std::ascii::AsciiExt; +#[allow(unused_imports)] use std::ascii::AsciiExt; use std::i32; use parser::ParserState; @@ -132,9 +132,6 @@ pub enum Token<'a> { /// A `*=` [``](https://drafts.csswg.org/css-syntax/#substring-match-token-diagram) SubstringMatch, - /// A `||` [``](https://drafts.csswg.org/css-syntax/#column-token-diagram) - Column, - /// A `