mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
style: Augment CSS errors with the CSS selector.
Differential Revision: https://phabricator.services.mozilla.com/D24894
This commit is contained in:
parent
4fbbcdddbe
commit
5a55978478
3 changed files with 13 additions and 7 deletions
|
@ -10,12 +10,14 @@ use crate::stylesheets::UrlExtraData;
|
|||
use cssparser::{BasicParseErrorKind, ParseErrorKind, SourceLocation, Token};
|
||||
use std::fmt;
|
||||
use style_traits::ParseError;
|
||||
use crate::selector_parser::{SelectorImpl};
|
||||
use selectors::SelectorList;
|
||||
|
||||
/// Errors that can be encountered while parsing CSS.
|
||||
#[derive(Debug)]
|
||||
pub enum ContextualParseError<'a> {
|
||||
/// A property declaration was not recognized.
|
||||
UnsupportedPropertyDeclaration(&'a str, ParseError<'a>),
|
||||
UnsupportedPropertyDeclaration(&'a str, ParseError<'a>, Option<&'a SelectorList<SelectorImpl>>),
|
||||
/// A font face descriptor was not recognized.
|
||||
UnsupportedFontFaceDescriptor(&'a str, ParseError<'a>),
|
||||
/// A font feature values descriptor was not recognized.
|
||||
|
@ -121,7 +123,7 @@ impl<'a> fmt::Display for ContextualParseError<'a> {
|
|||
}
|
||||
|
||||
match *self {
|
||||
ContextualParseError::UnsupportedPropertyDeclaration(decl, ref err) => {
|
||||
ContextualParseError::UnsupportedPropertyDeclaration(decl, ref err, _selectors) => {
|
||||
write!(f, "Unsupported property declaration: '{}', ", decl)?;
|
||||
parse_error_to_str(err, f)
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue