mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Update cssparser to 0.18
https://github.com/servo/rust-cssparser/pull/171
This commit is contained in:
parent
30d6d6024b
commit
eb98ae6e04
64 changed files with 541 additions and 512 deletions
|
@ -16,7 +16,7 @@ gecko_debug = ["style/gecko_debug"]
|
|||
|
||||
[dependencies]
|
||||
atomic_refcell = "0.1"
|
||||
cssparser = "0.17.0"
|
||||
cssparser = "0.18"
|
||||
env_logger = {version = "0.4", default-features = false} # disable `regex` to reduce code size
|
||||
libc = "0.2"
|
||||
log = {version = "0.3.5", features = ["release_max_level_info"]}
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
#![allow(unsafe_code)]
|
||||
|
||||
use cssparser::{Parser, SourcePosition, ParseError as CssParseError, Token, BasicParseError};
|
||||
use cssparser::CompactCowStr;
|
||||
use cssparser::CowRcStr;
|
||||
use selectors::parser::SelectorParseError;
|
||||
use style::error_reporting::{ParseErrorReporter, ContextualParseError};
|
||||
use style::gecko_bindings::bindings::{Gecko_CreateCSSErrorReporter, Gecko_DestroyCSSErrorReporter};
|
||||
|
@ -43,15 +43,15 @@ impl Drop for ErrorReporter {
|
|||
}
|
||||
|
||||
enum ErrorString<'a> {
|
||||
Snippet(CompactCowStr<'a>),
|
||||
Ident(CompactCowStr<'a>),
|
||||
Snippet(CowRcStr<'a>),
|
||||
Ident(CowRcStr<'a>),
|
||||
UnexpectedToken(Token<'a>),
|
||||
}
|
||||
|
||||
impl<'a> ErrorString<'a> {
|
||||
fn into_str(self) -> String {
|
||||
match self {
|
||||
ErrorString::Snippet(s) => s.into_owned(),
|
||||
ErrorString::Snippet(s) => s.as_ref().to_owned(),
|
||||
ErrorString::Ident(i) => escape_css_ident(&i),
|
||||
ErrorString::UnexpectedToken(t) => token_to_str(t),
|
||||
}
|
||||
|
@ -186,13 +186,13 @@ fn token_to_str<'a>(t: Token<'a>) -> String {
|
|||
}
|
||||
|
||||
trait ErrorHelpers<'a> {
|
||||
fn error_data(self) -> (CompactCowStr<'a>, ParseError<'a>);
|
||||
fn error_data(self) -> (CowRcStr<'a>, ParseError<'a>);
|
||||
fn error_param(self) -> ErrorString<'a>;
|
||||
fn to_gecko_message(&self) -> &'static [u8];
|
||||
}
|
||||
|
||||
impl<'a> ErrorHelpers<'a> for ContextualParseError<'a> {
|
||||
fn error_data(self) -> (CompactCowStr<'a>, ParseError<'a>) {
|
||||
fn error_data(self) -> (CowRcStr<'a>, ParseError<'a>) {
|
||||
match self {
|
||||
ContextualParseError::UnsupportedPropertyDeclaration(s, err) |
|
||||
ContextualParseError::UnsupportedFontFaceDescriptor(s, err) |
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue