Bug 1355732 part 1 - Make column-* animatable on stylo. r?hiro draft
authorMantaroh Yoshinaga <mantaroh@gmail.com>
Mon, 17 Apr 2017 13:13:17 +0900
changeset 563471 f6acb0155b5da61156f804d5325c88e388a23851
parent 563410 c697e756f738ce37abc56f31bfbc48f55625d617
child 563472 1da7d57d53bbe89dd3ece88182498227075c8664
child 563473 0e84fd24acf200c20bd64469c82092baca0eff56
push id54313
push userbmo:mantaroh@gmail.com
push dateMon, 17 Apr 2017 04:40:15 +0000
reviewershiro
bugs1355732
milestone55.0a1
Bug 1355732 part 1 - Make column-* animatable on stylo. r?hiro MozReview-Commit-ID: DEmrnpUElnS
servo/components/style/properties/gecko.mako.rs
servo/components/style/properties/helpers/animated_properties.mako.rs
servo/components/style/properties/longhand/column.mako.rs
--- a/servo/components/style/properties/gecko.mako.rs
+++ b/servo/components/style/properties/gecko.mako.rs
@@ -674,16 +674,17 @@ impl Debug for ${style_struct.gecko_stru
         "length::LengthOrAuto": impl_style_coord,
         "length::LengthOrNormal": impl_style_coord,
         "Length": impl_absolute_length,
         "Position": impl_position,
         "LengthOrPercentage": impl_style_coord,
         "LengthOrPercentageOrAuto": impl_style_coord,
         "LengthOrPercentageOrNone": impl_style_coord,
         "LengthOrNone": impl_style_coord,
+	"LengthOrNormal": impl_style_coord,
         "MaxLength": impl_style_coord,
         "MinLength": impl_style_coord,
         "Number": impl_simple,
         "Integer": impl_simple,
         "Opacity": impl_simple,
         "CSSColor": impl_color,
         "SVGPaint": impl_svg_paint,
         "UrlOrNone": impl_css_url,
@@ -3594,16 +3595,27 @@ clip-path
                 cmp::min(number as u32, nsStyleColumn_kMaxColumnCount)
             },
             Either::Second(Auto) => NS_STYLE_COLUMN_COUNT_AUTO
         };
     }
 
     ${impl_simple_copy('column_count', 'mColumnCount')}
 
+    pub fn clone_column_count(&self) -> longhands::column_count::computed_value::T {
+        use gecko_bindings::structs::NS_STYLE_COLUMN_COUNT_AUTO;
+        if self.gecko.mColumnCount != NS_STYLE_COLUMN_COUNT_AUTO {
+            debug_assert!((self.gecko.mColumnCount as i32) >= 0 &&
+                          (self.gecko.mColumnCount as i32) < i32::max_value());
+            Either::First(self.gecko.mColumnCount as i32)
+        } else {
+            Either::Second(Auto)
+        }
+    }
+
     <% impl_app_units("column_rule_width", "mColumnRuleWidth", need_clone=True,
                       round_to_pixels=True) %>
 </%self:impl_trait>
 
 <%self:impl_trait style_struct_name="Counters"
                   skip_longhands="content counter-increment counter-reset">
     pub fn set_content(&mut self, v: longhands::content::computed_value::T) {
         use properties::longhands::content::computed_value::T;
--- a/servo/components/style/properties/helpers/animated_properties.mako.rs
+++ b/servo/components/style/properties/helpers/animated_properties.mako.rs
@@ -24,17 +24,17 @@ use properties::longhands::vertical_alig
 use properties::longhands::visibility::computed_value::T as Visibility;
 #[cfg(feature = "gecko")] use properties::{PropertyDeclarationId, LonghandId};
 use std::cmp;
 #[cfg(feature = "gecko")] use std::collections::HashMap;
 use std::fmt;
 use style_traits::ToCss;
 use super::ComputedValues;
 use values::CSSFloat;
-use values::{Auto, Either};
+use values::{Auto, Either, Normal};
 use values::computed::{Angle, LengthOrPercentageOrAuto, LengthOrPercentageOrNone};
 use values::computed::{BorderRadiusSize, ClipRect, LengthOrNone};
 use values::computed::{CalcLengthOrPercentage, Context, LengthOrPercentage};
 use values::computed::{MaxLength, MinLength};
 use values::computed::position::{HorizontalPosition, Position, VerticalPosition};
 use values::computed::ToComputedValue;
 
 
@@ -510,16 +510,23 @@ impl Interpolate for Au {
 
 impl Interpolate for Auto {
     #[inline]
     fn interpolate(&self, _other: &Self, _progress: f64) -> Result<Self, ()> {
         Ok(Auto)
     }
 }
 
+impl Interpolate for Normal {
+    #[inline]
+    fn interpolate(&self, _other: &Self, _progress: f64) -> Result<Self, ()> {
+        Ok(Normal)
+    }
+}
+
 impl <T> Interpolate for Option<T>
     where T: Interpolate,
 {
     #[inline]
     fn interpolate(&self, other: &Option<T>, progress: f64) -> Result<Option<T>, ()> {
         match (self, other) {
             (&Some(ref this), &Some(ref other)) => {
                 Ok(this.interpolate(other, progress).ok())
--- a/servo/components/style/properties/longhand/column.mako.rs
+++ b/servo/components/style/properties/longhand/column.mako.rs
@@ -1,46 +1,44 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 <%namespace name="helpers" file="/helpers.mako.rs" />
 
 <% data.new_style_struct("Column", inherited=False) %>
 
-// FIXME: This prop should be animatable.
 ${helpers.predefined_type("column-width",
                           "length::LengthOrAuto",
                           "Either::Second(Auto)",
                           initial_specified_value="Either::Second(Auto)",
                           parse_method="parse_non_negative_length",
                           extra_prefixes="moz",
-                          animation_type="none",
+                          animation_type="normal",
                           experimental=True,
                           spec="https://drafts.csswg.org/css-multicol/#propdef-column-width")}
 
 
-// FIXME: This prop should be animatable.
-${helpers.predefined_type("column-count", "IntegerOrAuto",
+${helpers.predefined_type("column-count",
+                          "IntegerOrAuto",
                           "Either::Second(Auto)",
                           parse_method="parse_positive",
                           initial_specified_value="Either::Second(Auto)",
                           experimental="True",
                           animation_type="none",
                           extra_prefixes="moz",
                           spec="https://drafts.csswg.org/css-multicol/#propdef-column-count")}
 
-// FIXME: This prop should be animatable.
 ${helpers.predefined_type("column-gap",
                           "length::LengthOrNormal",
                           "Either::Second(Normal)",
                           parse_method='parse_non_negative_length',
                           extra_prefixes="moz",
                           experimental=True,
-                          animation_type="none",
+                          animation_type="normal",
                           spec="https://drafts.csswg.org/css-multicol/#propdef-column-gap")}
 
 ${helpers.single_keyword("column-fill", "balance auto", extra_prefixes="moz",
                          products="gecko", animation_type="none",
                          spec="https://drafts.csswg.org/css-multicol/#propdef-column-fill")}
 
 // https://drafts.csswg.org/css-multicol-1/#propdef-column-rule-width
 <%helpers:longhand name="column-rule-width" products="gecko" animation_type="normal" extra_prefixes="moz"