Add / fix get_initial_specified_value for animation longhands draft
authorXidorn Quan <me@upsuper.org>
Fri, 03 Mar 2017 18:24:05 +1100
changeset 494021 bd61684f07f9cba13a9e31617c5c8cf54628d969
parent 494020 8a6c0ffbe4daa67ebbd7e40000678ff317a75ec1
child 494022 a9607d965d75ae35ede723479ff07462ed984241
push id47899
push userxquan@mozilla.com
push dateMon, 06 Mar 2017 10:53:41 +0000
milestone54.0a1
Add / fix get_initial_specified_value for animation longhands MozReview-Commit-ID: HOapAVuOMYX
servo/components/style/properties/longhand/box.mako.rs
--- a/servo/components/style/properties/longhand/box.mako.rs
+++ b/servo/components/style/properties/longhand/box.mako.rs
@@ -455,16 +455,21 @@
         pub use values::computed::Time as T;
     }
 
     #[inline]
     pub fn get_initial_value() -> Time {
         Time(0.0)
     }
 
+    #[inline]
+    pub fn get_initial_specified_value() -> SpecifiedValue {
+        SpecifiedValue(0.0)
+    }
+
     pub fn parse(context: &ParserContext, input: &mut Parser) -> Result<SpecifiedValue,()> {
         Time::parse(context, input)
     }
 </%helpers:vector_longhand>
 
 // TODO(pcwalton): Lots more timing functions.
 <%helpers:vector_longhand name="transition-timing-function"
                           need_index="True"
@@ -722,17 +727,17 @@
 
     #[inline]
     pub fn get_initial_value() -> computed_value::T {
         ease()
     }
 
     #[inline]
     pub fn get_initial_specified_value() -> SpecifiedValue {
-        ToComputedValue::from_computed_value(&ease())
+        SpecifiedValue::Keyword(FunctionKeyword::Ease)
     }
 
     pub fn parse(context: &ParserContext, input: &mut Parser) -> Result<SpecifiedValue,()> {
         SpecifiedValue::parse(context, input)
     }
 </%helpers:vector_longhand>
 
 <%helpers:vector_longhand name="transition-property"
@@ -848,16 +853,17 @@
 
 <%helpers:vector_longhand name="animation-duration"
                           need_index="True"
                           animatable="False",
                           extra_prefixes="moz webkit"
                           spec="https://drafts.csswg.org/css-animations/#propdef-animation-duration",
                           allowed_in_keyframe_block="False">
     pub use properties::longhands::transition_duration::single_value::computed_value;
+    pub use properties::longhands::transition_duration::single_value::get_initial_specified_value;
     pub use properties::longhands::transition_duration::single_value::{get_initial_value, parse};
     pub use properties::longhands::transition_duration::single_value::SpecifiedValue;
 </%helpers:vector_longhand>
 
 <%helpers:vector_longhand name="animation-timing-function"
                           need_index="True"
                           animatable="False",
                           extra_prefixes="moz webkit"
@@ -916,17 +922,22 @@
             }
         }
     }
 
     no_viewport_percentage!(SpecifiedValue);
 
     #[inline]
     pub fn get_initial_value() -> computed_value::T {
-        computed_value::T::Number(1.0)
+        get_initial_specified_value()
+    }
+
+    #[inline]
+    pub fn get_initial_specified_value() -> SpecifiedValue {
+        SpecifiedValue::Number(1.0)
     }
 
     #[inline]
     pub fn parse(context: &ParserContext, input: &mut Parser) -> Result<SpecifiedValue, ()> {
         SpecifiedValue::parse(context, input)
     }
 
     impl ComputedValueAsSpecified for SpecifiedValue {}
@@ -968,16 +979,17 @@
 
 <%helpers:vector_longhand name="animation-delay"
                           need_index="True"
                           animatable="False",
                           extra_prefixes="moz webkit",
                           spec="https://drafts.csswg.org/css-animations/#propdef-animation-delay",
                           allowed_in_keyframe_block="False">
     pub use properties::longhands::transition_duration::single_value::computed_value;
+    pub use properties::longhands::transition_duration::single_value::get_initial_specified_value;
     pub use properties::longhands::transition_duration::single_value::{get_initial_value, parse};
     pub use properties::longhands::transition_duration::single_value::SpecifiedValue;
 </%helpers:vector_longhand>
 
 <%helpers:longhand products="gecko" name="scroll-snap-points-y" animatable="False"
                    spec="Nonstandard (https://www.w3.org/TR/2015/WD-css-snappoints-1-20150326/#scroll-snap-points)">
     use std::fmt;
     use style_traits::ToCss;