mirror of
https://github.com/servo/servo.git
synced 2025-08-05 13:40:08 +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
|
% 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.
|
/// Parse a transition-property value.
|
||||||
pub fn parse(input: &mut Parser) -> Result<Self, ()> {
|
pub fn parse(input: &mut Parser) -> Result<Self, ()> {
|
||||||
match_ignore_ascii_case! { &try!(input.expect_ident()),
|
match_ignore_ascii_case! { &try!(input.expect_ident()),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue