Bug 1341372 - Part 5: Add TransitionProperty::any.
TransitionProperty::any returns true if one of its closure returns true.
MozReview-Commit-ID: 4YsKkHaWCYq
--- a/servo/components/style/properties/helpers/animated_properties.mako.rs
+++ b/servo/components/style/properties/helpers/animated_properties.mako.rs
@@ -61,16 +61,29 @@ impl TransitionProperty {
pub fn each<F: FnMut(TransitionProperty) -> ()>(mut cb: F) {
% for prop in data.longhands:
% if prop.animatable:
cb(TransitionProperty::${prop.camel_case});
% endif
% endfor
}
+ /// Iterates over each property that is not `All`, and will return true if any of the cb
+ /// returns true.
+ 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()),
"all" => Ok(TransitionProperty::All),
% for prop in data.longhands:
% if prop.animatable:
"${prop.name}" => Ok(TransitionProperty::${prop.camel_case}),
% endif