mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
style: Add a new CSS error type for lone value parsing errors.
This allows us to report errors in functions that want to just parse a single CSS value, rather than a value for a particular property declaration. The one value type that we need to support for now is <color> value parsing errors, so just add formatting/support for that.
This commit is contained in:
parent
7940061c9a
commit
7015d5b22e
2 changed files with 28 additions and 2 deletions
|
@ -46,6 +46,8 @@ pub enum ContextualParseError<'a> {
|
|||
InvalidCounterStyleExtendsWithAdditiveSymbols,
|
||||
/// A media rule was invalid for some reason.
|
||||
InvalidMediaRule(&'a str, ParseError<'a>),
|
||||
/// A value was not recognized.
|
||||
UnsupportedValue(&'a str, ParseError<'a>),
|
||||
}
|
||||
|
||||
impl<'a> fmt::Display for ContextualParseError<'a> {
|
||||
|
@ -173,6 +175,9 @@ impl<'a> fmt::Display for ContextualParseError<'a> {
|
|||
write!(f, "Invalid media rule: {}, ", media_rule)?;
|
||||
parse_error_to_str(err, f)
|
||||
}
|
||||
ContextualParseError::UnsupportedValue(_value, ref err) => {
|
||||
parse_error_to_str(err, f)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue