Update cssparser to 0.18

https://github.com/servo/rust-cssparser/pull/171
This commit is contained in:
Simon Sapin 2017-07-20 21:03:53 +02:00
parent 30d6d6024b
commit eb98ae6e04
64 changed files with 541 additions and 512 deletions

View file

@ -16,7 +16,7 @@ gecko = []
[dependencies]
app_units = "0.5"
bitflags = "0.7"
cssparser = "0.17.0"
cssparser = "0.18"
euclid = "0.15"
heapsize = {version = "0.4", optional = true}
heapsize_derive = {version = "0.1", optional = true}

View file

@ -22,7 +22,7 @@ extern crate euclid;
extern crate selectors;
#[cfg(feature = "servo")] #[macro_use] extern crate serde;
use cssparser::{CompactCowStr, Token};
use cssparser::{CowRcStr, Token};
use selectors::parser::SelectorParseError;
/// Opaque type stored in type-unsafe work queues for parallel layout.
@ -87,9 +87,9 @@ pub type ParseError<'i> = cssparser::ParseError<'i, SelectorParseError<'i, Style
/// Errors that can be encountered while parsing CSS values.
pub enum StyleParseError<'i> {
/// A bad URL token in a DVB.
BadUrlInDeclarationValueBlock(CompactCowStr<'i>),
BadUrlInDeclarationValueBlock(CowRcStr<'i>),
/// A bad string token in a DVB.
BadStringInDeclarationValueBlock(CompactCowStr<'i>),
BadStringInDeclarationValueBlock(CowRcStr<'i>),
/// Unexpected closing parenthesis in a DVB.
UnbalancedCloseParenthesisInDeclarationValueBlock,
/// Unexpected closing bracket in a DVB.
@ -101,11 +101,11 @@ pub enum StyleParseError<'i> {
/// A property declaration value had input remaining after successfully parsing.
PropertyDeclarationValueNotExhausted,
/// An unexpected dimension token was encountered.
UnexpectedDimension(CompactCowStr<'i>),
UnexpectedDimension(CowRcStr<'i>),
/// A media query using a ranged expression with no value was encountered.
RangedExpressionWithNoValue,
/// A function was encountered that was not expected.
UnexpectedFunction(CompactCowStr<'i>),
UnexpectedFunction(CowRcStr<'i>),
/// @namespace must be before any rule but @charset and @import
UnexpectedNamespaceRule,
/// @import must be before any rule but @charset
@ -113,7 +113,7 @@ pub enum StyleParseError<'i> {
/// Unexpected @charset rule encountered.
UnexpectedCharsetRule,
/// Unsupported @ rule
UnsupportedAtRule(CompactCowStr<'i>),
UnsupportedAtRule(CowRcStr<'i>),
/// A placeholder for many sources of errors that require more specific variants.
UnspecifiedError,
/// An unexpected token was found within a namespace rule.
@ -124,13 +124,13 @@ pub enum StyleParseError<'i> {
#[derive(Eq, PartialEq, Clone, Debug)]
pub enum PropertyDeclarationParseError<'i> {
/// The property declaration was for an unknown property.
UnknownProperty(CompactCowStr<'i>),
UnknownProperty(CowRcStr<'i>),
/// An unknown vendor-specific identifier was encountered.
UnknownVendorProperty,
/// The property declaration was for a disabled experimental property.
ExperimentalProperty,
/// The property declaration contained an invalid value.
InvalidValue(CompactCowStr<'i>),
InvalidValue(CowRcStr<'i>),
/// The declaration contained an animation property, and we were parsing
/// this as a keyframe block (so that property should be ignored).
///

View file

@ -409,7 +409,7 @@ macro_rules! __define_css_keyword_enum__actual {
Self::from_ident(&ident)
.map_err(|()| ::cssparser::ParseError::Basic(
::cssparser::BasicParseError::UnexpectedToken(
::cssparser::Token::Ident(ident))))
::cssparser::Token::Ident(ident.clone()))))
}
/// Parse this property from an already-tokenized identifier.

View file

@ -154,7 +154,7 @@ impl Zoom {
use cssparser::Token;
use values::specified::AllowedLengthType::NonNegative;
match input.next()? {
match *input.next()? {
// TODO: This parse() method should take ParserContext as an
// argument, and pass ParsingMode owned by the ParserContext to
// is_ok() instead of using PARSING_MODE_DEFAULT directly.
@ -168,7 +168,7 @@ impl Zoom {
Token::Ident(ref value) if value.eq_ignore_ascii_case("auto") => {
Ok(Zoom::Auto)
}
t => Err(CssParseError::Basic(BasicParseError::UnexpectedToken(t)))
ref t => Err(CssParseError::Basic(BasicParseError::UnexpectedToken(t.clone())))
}
}