From 2399cde5048d8eedd5683bf9c30268755846112e Mon Sep 17 00:00:00 2001 From: Boris Chiou Date: Fri, 14 Apr 2017 10:41:04 +0800 Subject: [PATCH] Bug 1341372 - Part 5: Add TransitionProperty::any. TransitionProperty::any returns true if one of its closure returns true. MozReview-Commit-ID: 4YsKkHaWCYq --- .../properties/helpers/animated_properties.mako.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/components/style/properties/helpers/animated_properties.mako.rs b/components/style/properties/helpers/animated_properties.mako.rs index ff11c9d5930..51f2dc69393 100644 --- a/components/style/properties/helpers/animated_properties.mako.rs +++ b/components/style/properties/helpers/animated_properties.mako.rs @@ -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 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 { match_ignore_ascii_case! { &try!(input.expect_ident()),