From 09c2b1b93035041287e36696ee0e42f8c3abb865 Mon Sep 17 00:00:00 2001 From: Brian Birtles Date: Thu, 15 Jun 2017 10:11:34 +0900 Subject: [PATCH] Move definition of animatable for shorthands to Shorthand object By moving this definition to the Shorthand object we can more easily re-use it in subsequent patches in this series. --- components/style/properties/data.py | 10 ++++++++++ .../properties/helpers/animated_properties.mako.rs | 12 +----------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/components/style/properties/data.py b/components/style/properties/data.py index 15d9f2fc89a..0822e25e320 100644 --- a/components/style/properties/data.py +++ b/components/style/properties/data.py @@ -234,6 +234,16 @@ class Shorthand(object): self.allowed_in_keyframe_block = allowed_in_keyframe_block \ and allowed_in_keyframe_block != "False" + def get_animatable(self): + animatable = False + for sub in self.sub_properties: + if sub.animatable: + animatable = True + break + return animatable + + animatable = property(get_animatable) + class Method(object): def __init__(self, name, return_type=None, arg_types=None, is_mut=False): diff --git a/components/style/properties/helpers/animated_properties.mako.rs b/components/style/properties/helpers/animated_properties.mako.rs index 857c0b10491..0ac3e4704cf 100644 --- a/components/style/properties/helpers/animated_properties.mako.rs +++ b/components/style/properties/helpers/animated_properties.mako.rs @@ -195,21 +195,11 @@ impl TransitionProperty { #[cfg(feature = "gecko")] pub fn nscsspropertyid_is_animatable(property: nsCSSPropertyID) -> bool { match property { - % for prop in data.longhands: + % for prop in data.longhands + data.shorthands_except_all(): % if prop.animatable: ${helpers.to_nscsspropertyid(prop.ident)} => true, % endif % endfor - % for prop in data.shorthands_except_all(): - <% - animatable = "false" - for sub in prop.sub_properties: - if sub.animatable: - animatable = "true" - break - %> - ${helpers.to_nscsspropertyid(prop.ident)} => ${animatable}, - % endfor _ => false } }