mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Report CSS parse errors via enum instead of strings.
This commit is contained in:
parent
e46aa87b4c
commit
fd6e54d9e3
10 changed files with 124 additions and 65 deletions
|
@ -6,7 +6,7 @@
|
|||
|
||||
use cssparser::{AtRuleParser, Parser, QualifiedRuleParser, RuleListParser};
|
||||
use cssparser::{DeclarationListParser, DeclarationParser, parse_one_rule, SourceLocation};
|
||||
use error_reporting::NullReporter;
|
||||
use error_reporting::{NullReporter, ParseError};
|
||||
use parser::{PARSING_MODE_DEFAULT, ParserContext, log_css_error};
|
||||
use properties::{Importance, PropertyDeclaration, PropertyDeclarationBlock, PropertyId};
|
||||
use properties::{PropertyDeclarationId, LonghandId, SourcePropertyDeclaration};
|
||||
|
@ -459,8 +459,8 @@ impl<'a> QualifiedRuleParser for KeyframeListParser<'a> {
|
|||
match KeyframeSelector::parse(input) {
|
||||
Ok(sel) => Ok(sel),
|
||||
Err(()) => {
|
||||
let message = format!("Invalid keyframe rule: '{}'", input.slice_from(start));
|
||||
log_css_error(input, start, &message, self.context);
|
||||
let error = ParseError::InvalidKeyframeRule(input.slice_from(start));
|
||||
log_css_error(input, start, error, self.context);
|
||||
Err(())
|
||||
}
|
||||
}
|
||||
|
@ -483,9 +483,8 @@ impl<'a> QualifiedRuleParser for KeyframeListParser<'a> {
|
|||
Err(range) => {
|
||||
iter.parser.declarations.clear();
|
||||
let pos = range.start;
|
||||
let message = format!("Unsupported keyframe property declaration: '{}'",
|
||||
iter.input.slice(range));
|
||||
log_css_error(iter.input, pos, &*message, &context);
|
||||
let error = ParseError::UnsupportedKeyframePropertyDeclaration(iter.input.slice(range));
|
||||
log_css_error(iter.input, pos, error, &context);
|
||||
}
|
||||
}
|
||||
// `parse_important` is not called here, `!important` is not allowed in keyframe blocks.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue