mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
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:
parent
c88ca7dcd0
commit
2399cde504
1 changed files with 13 additions and 0 deletions
|
@ -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()),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue