aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--components/style/properties/data.py12
-rw-r--r--components/style/properties/helpers/animated_properties.mako.rs11
2 files changed, 17 insertions, 6 deletions
diff --git a/components/style/properties/data.py b/components/style/properties/data.py
index ae25fb58e84..f87278f2478 100644
--- a/components/style/properties/data.py
+++ b/components/style/properties/data.py
@@ -229,6 +229,11 @@ class Longhand(object):
def enabled_in_content(self):
return self.enabled_in == "content"
+ def base_type(self):
+ if self.predefined_type and not self.is_vector:
+ return "::values::specified::{}".format(self.predefined_type)
+ return "longhands::{}::SpecifiedValue".format(self.ident)
+
def specified_type(self):
if self.predefined_type and not self.is_vector:
ty = "::values::specified::{}".format(self.predefined_type)
@@ -281,6 +286,13 @@ class Longhand(object):
}
return bool(self.keyword)
+ def animated_type(self):
+ assert self.animatable
+ computed = "<{} as ToComputedValue>::ComputedValue".format(self.base_type())
+ if self.is_animatable_with_computed_value:
+ return computed
+ return "<{} as ToAnimatedValue>::AnimatedValue".format(computed)
+
class Shorthand(object):
def __init__(self, name, sub_properties, spec=None, servo_pref=None, gecko_pref=None,
diff --git a/components/style/properties/helpers/animated_properties.mako.rs b/components/style/properties/helpers/animated_properties.mako.rs
index f47a0cc949d..70bd242b00f 100644
--- a/components/style/properties/helpers/animated_properties.mako.rs
+++ b/components/style/properties/helpers/animated_properties.mako.rs
@@ -4,7 +4,10 @@
<%namespace name="helpers" file="/helpers.mako.rs" />
-<% from data import to_idl_name, SYSTEM_FONT_LONGHANDS %>
+<%
+ from data import to_idl_name, SYSTEM_FONT_LONGHANDS
+ from itertools import groupby
+%>
use cssparser::Parser;
#[cfg(feature = "gecko")] use gecko_bindings::bindings::RawServoAnimationValueMap;
@@ -349,11 +352,7 @@ pub enum AnimationValue {
% for prop in data.longhands:
% if prop.animatable:
/// `${prop.name}`
- % if prop.is_animatable_with_computed_value:
- ${prop.camel_case}(longhands::${prop.ident}::computed_value::T),
- % else:
- ${prop.camel_case}(<longhands::${prop.ident}::computed_value::T as ToAnimatedValue>::AnimatedValue),
- % endif
+ ${prop.camel_case}(${prop.animated_type()}),
% else:
/// `${prop.name}` (not animatable)
${prop.camel_case}(Void),