From 8f97c89e69177226bbfc3b41d3fe185591bbdff8 Mon Sep 17 00:00:00 2001 From: Shing Lyu Date: Tue, 14 Jun 2016 23:38:18 +0800 Subject: [PATCH] Implementing Box Sizing for Stylo --- ports/geckolib/properties.mako.rs | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/ports/geckolib/properties.mako.rs b/ports/geckolib/properties.mako.rs index 8a8a25c1b70..d33f083db1a 100644 --- a/ports/geckolib/properties.mako.rs +++ b/ports/geckolib/properties.mako.rs @@ -379,8 +379,6 @@ impl Debug for ${style_struct.gecko_struct_name} { force_stub += ["font-kerning", "font-stretch", "font-variant"] # These have unusual representations in gecko. force_stub += ["list-style-type", "text-overflow"] - # Enum class instead of NS_STYLE_... - force_stub += ["box-sizing"] # These are booleans. force_stub += ["page-break-after", "page-break-before"] @@ -541,7 +539,7 @@ fn static_assert() { <% skip_position_longhands = " ".join(x.ident for x in SIDES) %> <%self:impl_trait style_struct_name="Position" - skip_longhands="${skip_position_longhands} z-index"> + skip_longhands="${skip_position_longhands} z-index box-sizing"> % for side in SIDES: <% impl_split_style_coord("%s" % side.ident, @@ -556,11 +554,24 @@ fn static_assert() { T::Number(n) => self.gecko.mZIndex.set_int(n), } } + fn copy_z_index_from(&mut self, other: &Self) { debug_assert_unit_is_safe_to_copy(self.gecko.mZIndex.mUnit); self.gecko.mZIndex.mUnit = other.gecko.mZIndex.mUnit; self.gecko.mZIndex.mValue = other.gecko.mZIndex.mValue; } + + fn set_box_sizing(&mut self, v: longhands::box_sizing::computed_value::T) { + use style::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')} + <% skip_outline_longhands = " ".join("outline-color outline-style outline-width".split() +