mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
stylo: Update rust-cssparser; extract more specific error types when reporting (bug 1352669).
This commit is contained in:
parent
a08371e8eb
commit
0b43d0072c
21 changed files with 318 additions and 80 deletions
|
@ -7,7 +7,7 @@
|
|||
use {Namespace, Prefix};
|
||||
use counter_style::{parse_counter_style_body, parse_counter_style_name};
|
||||
use cssparser::{AtRuleParser, AtRuleType, Parser, QualifiedRuleParser, RuleListParser};
|
||||
use cssparser::{CompactCowStr, SourceLocation};
|
||||
use cssparser::{CompactCowStr, SourceLocation, BasicParseError};
|
||||
use error_reporting::ContextualParseError;
|
||||
use font_face::parse_font_face_block;
|
||||
use media_queries::{parse_media_query_list, MediaList};
|
||||
|
@ -184,7 +184,13 @@ impl<'a, 'i> AtRuleParser<'i> for TopLevelRuleParser<'a> {
|
|||
self.state = State::Namespaces;
|
||||
|
||||
let prefix_result = input.try(|input| input.expect_ident());
|
||||
let url = Namespace::from(Cow::from(input.expect_url_or_string()?));
|
||||
let maybe_namespace = match input.expect_url_or_string() {
|
||||
Ok(url_or_string) => url_or_string,
|
||||
Err(BasicParseError::UnexpectedToken(t)) =>
|
||||
return Err(StyleParseError::UnexpectedTokenWithinNamespace(t).into()),
|
||||
Err(e) => return Err(e.into()),
|
||||
};
|
||||
let url = Namespace::from(Cow::from(maybe_namespace));
|
||||
|
||||
let id = register_namespace(&url)
|
||||
.map_err(|()| StyleParseError::UnspecifiedError)?;
|
||||
|
@ -509,7 +515,7 @@ fn get_location_with_offset(
|
|||
offset: u64
|
||||
) -> SourceLocation {
|
||||
SourceLocation {
|
||||
line: location.line + offset as u32 - 1,
|
||||
line: location.line + offset as u32,
|
||||
column: location.column,
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue