Bug 1371518 - Move definition of animatable for shorthands to Shorthand object; r?hiro
By moving this definition to the Shorthand object we can more easily re-use it
in subsequent patches in this series.
MozReview-Commit-ID: CVbxq6hlRCK
--- a/servo/components/style/properties/data.py
+++ b/servo/components/style/properties/data.py
@@ -229,16 +229,26 @@ class Shorthand(object):
# https://drafts.csswg.org/css-animations/#keyframes
# > The <declaration-list> inside of <keyframe-block> accepts any CSS property
# > except those defined in this specification,
# > but does accept the `animation-play-state` property and interprets it specially.
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):
self.name = name
self.return_type = return_type
self.arg_types = arg_types or []
self.is_mut = is_mut
--- a/servo/components/style/properties/helpers/animated_properties.mako.rs
+++ b/servo/components/style/properties/helpers/animated_properties.mako.rs
@@ -190,31 +190,21 @@ impl TransitionProperty {
}
}
}
/// Returns true if this nsCSSPropertyID is one of the animatable properties.
#[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
}
}
impl ToCss for TransitionProperty {
fn to_css<W>(&self, dest: &mut W) -> fmt::Result
where W: fmt::Write,
{