mirror of
https://github.com/servo/servo.git
synced 2025-08-05 13:40:08 +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.
|
/// Parse a transition-property value.
|
||||||
pub fn parse<'i, 't>(input: &mut Parser<'i, 't>) -> Result<Self, ParseError<'i>> {
|
pub fn parse<'i, 't>(input: &mut Parser<'i, 't>) -> Result<Self, ParseError<'i>> {
|
||||||
let ident = input.expect_ident()?;
|
let ident = input.expect_ident()?;
|
||||||
let supported = match_ignore_ascii_case! { &ident,
|
match_ignore_ascii_case! { &ident,
|
||||||
"all" => Ok(Some(TransitionProperty::All)),
|
"all" => Ok(TransitionProperty::All),
|
||||||
% for prop in data.longhands + data.shorthands_except_all():
|
% for prop in data.longhands + data.shorthands_except_all():
|
||||||
% if prop.transitionable:
|
% if prop.transitionable:
|
||||||
"${prop.name}" => Ok(Some(TransitionProperty::${prop.camel_case})),
|
"${prop.name}" => Ok(TransitionProperty::${prop.camel_case}),
|
||||||
% endif
|
% endif
|
||||||
% endfor
|
% endfor
|
||||||
"none" => Err(()),
|
"none" => Err(SelectorParseError::UnexpectedIdent(ident.clone()).into()),
|
||||||
_ => Ok(None),
|
_ => CustomIdent::from_ident(ident, &[]).map(TransitionProperty::Unsupported),
|
||||||
};
|
|
||||||
|
|
||||||
match supported {
|
|
||||||
Ok(Some(property)) => Ok(property),
|
|
||||||
Ok(None) => CustomIdent::from_ident(ident, &[]).map(TransitionProperty::Unsupported),
|
|
||||||
Err(()) => Err(SelectorParseError::UnexpectedIdent(ident.clone()).into()),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue