mirror of
https://github.com/servo/servo.git
synced 2025-07-22 14:53:49 +01:00
Reduce code duplication in TransitionProperty::from.
This commit is contained in:
parent
9dd0513647
commit
ecd8abb178
1 changed files with 6 additions and 5 deletions
|
@ -316,19 +316,20 @@ impl<'a> From< &'a TransitionProperty> for nsCSSPropertyID {
|
|||
#[allow(non_upper_case_globals)]
|
||||
impl From<nsCSSPropertyID> for TransitionProperty {
|
||||
fn from(property: nsCSSPropertyID) -> TransitionProperty {
|
||||
match property {
|
||||
let unsupported = match property {
|
||||
% for prop in data.longhands + data.shorthands_except_all():
|
||||
% if prop.transitionable:
|
||||
${helpers.to_nscsspropertyid(prop.ident)}
|
||||
=> TransitionProperty::${prop.camel_case},
|
||||
=> return TransitionProperty::${prop.camel_case},
|
||||
% else:
|
||||
${helpers.to_nscsspropertyid(prop.ident)}
|
||||
=> TransitionProperty::Unsupported(CustomIdent(Atom::from("${prop.ident}"))),
|
||||
=> "${prop.ident}",
|
||||
% endif
|
||||
% endfor
|
||||
nsCSSPropertyID::eCSSPropertyExtra_all_properties => TransitionProperty::All,
|
||||
nsCSSPropertyID::eCSSPropertyExtra_all_properties => return TransitionProperty::All,
|
||||
_ => panic!("Unconvertable nsCSSPropertyID: {:?}", property),
|
||||
}
|
||||
};
|
||||
TransitionProperty::Unsupported(CustomIdent(Atom::from(unsupported)))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue