Bug 1341372 - Part 5: Add TransitionProperty::any.

TransitionProperty::any returns true if one of its closure returns true.

MozReview-Commit-ID: 4YsKkHaWCYq
This commit is contained in:
Boris Chiou 2017-04-14 10:41:04 +08:00
parent c88ca7dcd0
commit 2399cde504

View file

@ -66,6 +66,19 @@ impl TransitionProperty {
% endfor
}
/// Iterates over every property that is not TransitionProperty::All, stopping and returning
/// true when the provided callback returns true for the first time.
pub fn any<F: FnMut(TransitionProperty) -> bool>(mut cb: F) -> bool {
% for prop in data.longhands:
% if prop.animatable:
if cb(TransitionProperty::${prop.camel_case}) {
return true;
}
% endif
% endfor
false
}
/// Parse a transition-property value.
pub fn parse(input: &mut Parser) -> Result<Self, ()> {
match_ignore_ascii_case! { &try!(input.expect_ident()),