mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
Simplify transition-property parser.
This commit is contained in:
parent
2b73735539
commit
42873abe84
1 changed files with 5 additions and 11 deletions
|
@ -247,21 +247,15 @@ impl TransitionProperty {
|
|||
/// Parse a transition-property value.
|
||||
pub fn parse<'i, 't>(input: &mut Parser<'i, 't>) -> Result<Self, ParseError<'i>> {
|
||||
let ident = input.expect_ident()?;
|
||||
let supported = match_ignore_ascii_case! { &ident,
|
||||
"all" => Ok(Some(TransitionProperty::All)),
|
||||
match_ignore_ascii_case! { &ident,
|
||||
"all" => Ok(TransitionProperty::All),
|
||||
% for prop in data.longhands + data.shorthands_except_all():
|
||||
% if prop.transitionable:
|
||||
"${prop.name}" => Ok(Some(TransitionProperty::${prop.camel_case})),
|
||||
"${prop.name}" => Ok(TransitionProperty::${prop.camel_case}),
|
||||
% endif
|
||||
% endfor
|
||||
"none" => Err(()),
|
||||
_ => Ok(None),
|
||||
};
|
||||
|
||||
match supported {
|
||||
Ok(Some(property)) => Ok(property),
|
||||
Ok(None) => CustomIdent::from_ident(ident, &[]).map(TransitionProperty::Unsupported),
|
||||
Err(()) => Err(SelectorParseError::UnexpectedIdent(ident.clone()).into()),
|
||||
"none" => Err(SelectorParseError::UnexpectedIdent(ident.clone()).into()),
|
||||
_ => CustomIdent::from_ident(ident, &[]).map(TransitionProperty::Unsupported),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue