servo: Merge #13674 - Implement column-count in stylo (from Manishearth:column_count); r=emilio
authorManish Goregaokar <manishsmail@gmail.com>
Mon, 10 Oct 2016 09:37:29 -0500
changeset 339874 671d3032398a9f25c563bb1f0f00d33b4170b15d
parent 339873 8fe6fbd181136b1db84728edf9ac157913219ea7
child 339875 058da893151506587793f4159a4af7b840c41d82
push id31307
push usergszorc@mozilla.com
push dateSat, 04 Feb 2017 00:59:06 +0000
treeherdermozilla-central@94079d43835f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersemilio
servo: Merge #13674 - Implement column-count in stylo (from Manishearth:column_count); r=emilio Unblocks column-fill easy property r? @emilio Source-Repo: https://github.com/servo/servo Source-Revision: aef6054dc64043860e90ca962b60c51c683789f2
servo/components/style/properties/gecko.mako.rs
--- a/servo/components/style/properties/gecko.mako.rs
+++ b/servo/components/style/properties/gecko.mako.rs
@@ -463,18 +463,16 @@ impl Debug for ${style_struct.gecko_stru
     # but we haven't implemented the stylo glue for the longhand
     # so we generate a stub
     force_stub += ["list-style-image", # box
                    "flex-basis", # position
 
                    # transition
                    "transition-duration", "transition-timing-function",
                    "transition-property", "transition-delay",
-
-                   "column-count", # column
                    ]
 
     # Types used with predefined_type()-defined properties that we can auto-generate.
     predefined_types = {
        "LengthOrPercentage": impl_style_coord,
        "LengthOrPercentageOrAuto": impl_style_coord,
        "LengthOrPercentageOrNone": impl_style_coord,
        "Number": impl_simple,
@@ -1906,26 +1904,37 @@ clip-path
             }
         } as u8;
     }
 
     ${impl_simple_copy('cursor', 'mCursor')}
 </%self:impl_trait>
 
 <%self:impl_trait style_struct_name="Column"
-                  skip_longhands="column-width">
+                  skip_longhands="column-width column-count">
 
     pub fn set_column_width(&mut self, v: longhands::column_width::computed_value::T) {
         match v.0 {
             Some(au) => self.gecko.mColumnWidth.set(au),
             None => self.gecko.mColumnWidth.set_value(CoordDataValue::Auto),
         }
     }
 
     ${impl_coord_copy('column_width', 'mColumnWidth')}
+
+    pub fn set_column_count(&mut self, v: longhands::column_count::computed_value::T) {
+        use gecko_bindings::structs::{NS_STYLE_COLUMN_COUNT_AUTO, nsStyleColumn_kMaxColumnCount};
+
+        self.gecko.mColumnCount = match v.0 {
+            Some(number) => cmp::min(number, nsStyleColumn_kMaxColumnCount),
+            None => NS_STYLE_COLUMN_COUNT_AUTO
+        };
+    }
+
+    ${impl_simple_copy('column_count', 'mColumnCount')}
 </%self:impl_trait>
 
 <%self:impl_trait style_struct_name="Counters"
                   skip_longhands="content">
     pub fn set_content(&mut self, v: longhands::content::computed_value::T) {
         use properties::longhands::content::computed_value::T;
         use properties::longhands::content::computed_value::ContentItem;
         use gecko_bindings::structs::nsStyleContentData;