Bug 1367283 - Part 7: Implements position related properties. r?hiro draft
authorDaisuke Akatsuka <dakatsuka@mozilla.com>
Mon, 29 May 2017 22:37:17 +0900
changeset 585972 40235fc27da24c0eabfcf8076628801fa9099218
parent 585971 59093730349c881dbc0ae26be753a0e19d0e634d
child 585973 e95aa2c365aedab307d8c8d4954cba57ef84ca9d
push id61246
push userbmo:dakatsuka@mozilla.com
push dateMon, 29 May 2017 13:44:07 +0000
reviewershiro
bugs1367283, 1166728
milestone55.0a1
Bug 1367283 - Part 7: Implements position related properties. r?hiro In this patch, implements following position related properties that type is single keyword. * box-sizing MEMO: box-sizing: padding-box has been removed in bug 1166728. MozReview-Commit-ID: 8XxGVtRwij6
servo/components/style/properties/gecko.mako.rs
servo/components/style/properties/longhand/position.mako.rs
--- a/servo/components/style/properties/gecko.mako.rs
+++ b/servo/components/style/properties/gecko.mako.rs
@@ -1067,17 +1067,17 @@ fn static_assert() {
                               "mPadding",
                               side.index,
                               need_clone=True) %>
     % endfor
 </%self:impl_trait>
 
 <% skip_position_longhands = " ".join(x.ident for x in SIDES + GRID_LINES) %>
 <%self:impl_trait style_struct_name="Position"
-                  skip_longhands="${skip_position_longhands} z-index box-sizing order align-content
+                  skip_longhands="${skip_position_longhands} z-index order align-content
                                   justify-content align-self justify-self align-items
                                   justify-items grid-auto-rows grid-auto-columns grid-auto-flow
                                   grid-template-areas grid-template-rows grid-template-columns">
     % for side in SIDES:
     <% impl_split_style_coord("%s" % side.ident,
                               "mOffset",
                               side.index,
                               need_clone=True) %>
@@ -1154,27 +1154,16 @@ fn static_assert() {
     ${impl_simple_copy('justify_items', 'mJustifyItems')}
 
     pub fn clone_justify_items(&self) -> longhands::justify_items::computed_value::T {
         use values::specified::align::{AlignFlags, JustifyItems};
         JustifyItems(AlignFlags::from_bits(self.gecko.mJustifyItems)
                                           .expect("mJustifyItems contains valid flags"))
     }
 
-    pub fn set_box_sizing(&mut self, v: longhands::box_sizing::computed_value::T) {
-        use computed_values::box_sizing::T;
-        use gecko_bindings::structs::StyleBoxSizing;
-        // TODO: guess what to do with box-sizing: padding-box
-        self.gecko.mBoxSizing = match v {
-            T::content_box => StyleBoxSizing::Content,
-            T::border_box => StyleBoxSizing::Border
-        }
-    }
-    ${impl_simple_copy('box_sizing', 'mBoxSizing')}
-
     pub fn set_order(&mut self, v: longhands::order::computed_value::T) {
         self.gecko.mOrder = v;
     }
 
     pub fn clone_order(&self) -> longhands::order::computed_value::T {
         self.gecko.mOrder
     }
 
--- a/servo/components/style/properties/longhand/position.mako.rs
+++ b/servo/components/style/properties/longhand/position.mako.rs
@@ -200,17 +200,20 @@
                                   allow_quirks=not logical)}
     % endif
 % endfor
 
 ${helpers.single_keyword("box-sizing",
                          "content-box border-box",
                          extra_prefixes="moz webkit",
                          spec="https://drafts.csswg.org/css-ui/#propdef-box-sizing",
-                         animation_value_type="none")}
+                         gecko_enum_prefix="StyleBoxSizing",
+                         custom_consts={ "content-box": "Content", "border-box": "Border" },
+                         gecko_inexhaustive=True,
+                         animation_value_type="discrete")}
 
 ${helpers.single_keyword("object-fit", "fill contain cover none scale-down",
                          products="gecko", animation_value_type="discrete",
                          spec="https://drafts.csswg.org/css-images/#propdef-object-fit")}
 
 ${helpers.predefined_type("object-position",
                           "Position",
                           "computed::Position::zero()",