mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Update to cssparser 0.19, count line numbers during tokenization
This commit is contained in:
parent
32f835260c
commit
7382dad939
33 changed files with 145 additions and 196 deletions
|
@ -12,7 +12,7 @@ use cssparser::{Parser, Token, serialize_identifier, BasicParseError, CowRcStr};
|
|||
use error_reporting::ContextualParseError;
|
||||
#[cfg(feature = "gecko")] use gecko::rules::CounterStyleDescriptors;
|
||||
#[cfg(feature = "gecko")] use gecko_bindings::structs::nsCSSCounterDesc;
|
||||
use parser::{ParserContext, log_css_error, Parse};
|
||||
use parser::{ParserContext, Parse};
|
||||
use selectors::parser::SelectorParseError;
|
||||
use shared_lock::{SharedRwLockReadGuard, ToCssWithGuard};
|
||||
use std::ascii::AsciiExt;
|
||||
|
@ -52,7 +52,7 @@ pub fn parse_counter_style_name<'i, 't>(input: &mut Parser<'i, 't>) -> Result<Cu
|
|||
/// Parse the body (inside `{}`) of an @counter-style rule
|
||||
pub fn parse_counter_style_body<'i, 't>(name: CustomIdent, context: &ParserContext, input: &mut Parser<'i, 't>)
|
||||
-> Result<CounterStyleRuleData, ParseError<'i>> {
|
||||
let start = input.position();
|
||||
let start = input.current_source_location();
|
||||
let mut rule = CounterStyleRuleData::empty(name);
|
||||
{
|
||||
let parser = CounterStyleRuleParser {
|
||||
|
@ -62,10 +62,8 @@ pub fn parse_counter_style_body<'i, 't>(name: CustomIdent, context: &ParserConte
|
|||
let mut iter = DeclarationListParser::new(input, parser);
|
||||
while let Some(declaration) = iter.next() {
|
||||
if let Err(err) = declaration {
|
||||
let pos = err.span.start;
|
||||
let error = ContextualParseError::UnsupportedCounterStyleDescriptorDeclaration(
|
||||
iter.input.slice(err.span), err.error);
|
||||
log_css_error(iter.input, pos, error, context);
|
||||
let error = ContextualParseError::UnsupportedCounterStyleDescriptorDeclaration(err.slice, err.error);
|
||||
context.log_css_error(err.location, error)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -97,7 +95,7 @@ pub fn parse_counter_style_body<'i, 't>(name: CustomIdent, context: &ParserConte
|
|||
_ => None
|
||||
};
|
||||
if let Some(error) = error {
|
||||
log_css_error(input, start, error, context);
|
||||
context.log_css_error(start, error);
|
||||
Err(StyleParseError::UnspecifiedError.into())
|
||||
} else {
|
||||
Ok(rule)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue