mirror of
https://github.com/servo/servo.git
synced 2025-08-07 14:35:33 +01:00
Store COW strings in CSS parser errors when possible.
This commit is contained in:
parent
2bb4f65100
commit
bbf3280fef
3 changed files with 3 additions and 3 deletions
|
@ -1478,7 +1478,7 @@ impl PropertyDeclaration {
|
||||||
Ok(keyword) => DeclaredValueOwned::CSSWideKeyword(keyword),
|
Ok(keyword) => DeclaredValueOwned::CSSWideKeyword(keyword),
|
||||||
Err(_) => match ::custom_properties::SpecifiedValue::parse(context, input) {
|
Err(_) => match ::custom_properties::SpecifiedValue::parse(context, input) {
|
||||||
Ok(value) => DeclaredValueOwned::Value(value),
|
Ok(value) => DeclaredValueOwned::Value(value),
|
||||||
Err(_) => return Err(PropertyDeclarationParseError::InvalidValue(name.to_string())),
|
Err(_) => return Err(PropertyDeclarationParseError::InvalidValue(name.to_string().into())),
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
declarations.push(PropertyDeclaration::Custom(name, value));
|
declarations.push(PropertyDeclaration::Custom(name, value));
|
||||||
|
|
|
@ -124,7 +124,7 @@ pub enum PropertyDeclarationParseError<'i> {
|
||||||
/// The property declaration was for a disabled experimental property.
|
/// The property declaration was for a disabled experimental property.
|
||||||
ExperimentalProperty,
|
ExperimentalProperty,
|
||||||
/// The property declaration contained an invalid value.
|
/// The property declaration contained an invalid value.
|
||||||
InvalidValue(String),
|
InvalidValue(CompactCowStr<'i>),
|
||||||
/// The declaration contained an animation property, and we were parsing
|
/// The declaration contained an animation property, and we were parsing
|
||||||
/// this as a keyframe block (so that property should be ignored).
|
/// this as a keyframe block (so that property should be ignored).
|
||||||
///
|
///
|
||||||
|
|
|
@ -224,7 +224,7 @@ impl<'a> ErrorHelpers<'a> for ContextualParseError<'a> {
|
||||||
(_, CssParseError::Custom(SelectorParseError::Custom(
|
(_, CssParseError::Custom(SelectorParseError::Custom(
|
||||||
StyleParseError::PropertyDeclaration(
|
StyleParseError::PropertyDeclaration(
|
||||||
PropertyDeclarationParseError::InvalidValue(property))))) =>
|
PropertyDeclarationParseError::InvalidValue(property))))) =>
|
||||||
ErrorString::Snippet(property.into()),
|
ErrorString::Snippet(property),
|
||||||
|
|
||||||
(_, CssParseError::Custom(SelectorParseError::UnexpectedIdent(ident))) =>
|
(_, CssParseError::Custom(SelectorParseError::UnexpectedIdent(ident))) =>
|
||||||
ErrorString::Ident(ident),
|
ErrorString::Ident(ident),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue