Bug 1387939 - Make assertion for colum-count more accurate. r?mantaroh draft
authorHiroyuki Ikezoe <hikezoe@mozilla.com>
Tue, 15 Aug 2017 06:11:20 +0900
changeset 646175 7c548ff7e79b2147102fab662cf4bf5c70804d98
parent 646174 331c394d0fb31327595b01b561fca6ad0660b0a0
child 646176 e05208304a28e525b94b21e52d98eb6345eebfc8
push id74015
push userhikezoe@mozilla.com
push dateMon, 14 Aug 2017 22:32:49 +0000
reviewersmantaroh
bugs1387939
milestone57.0a1
Bug 1387939 - Make assertion for colum-count more accurate. r?mantaroh column-count should be greater than or equal to 1. Also it should be less than or equal to nsStyleColumn_kMaxColumnCount since we limit it in set_column_count(). MozReview-Commit-ID: 6sx8Suotz0W
servo/components/style/properties/gecko.mako.rs
--- a/servo/components/style/properties/gecko.mako.rs
+++ b/servo/components/style/properties/gecko.mako.rs
@@ -5429,20 +5429,20 @@ clip-path
             },
             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;
+        use gecko_bindings::structs::{NS_STYLE_COLUMN_COUNT_AUTO, nsStyleColumn_kMaxColumnCount};
         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());
+            debug_assert!(self.gecko.mColumnCount >= 1 &&
+                          self.gecko.mColumnCount <= nsStyleColumn_kMaxColumnCount);
             Either::First((self.gecko.mColumnCount as i32).into())
         } else {
             Either::Second(Auto)
         }
     }
 
     <% impl_non_negative_app_units("column_rule_width", "mColumnRuleWidth", need_clone=True,
                                    round_to_pixels=True) %>