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.
This commit is contained in:
Brian Birtles 2017-06-15 10:11:34 +09:00
parent f8e2f85cdc
commit 09c2b1b930
2 changed files with 11 additions and 11 deletions

View file

@ -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):

View file

@ -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
}
}