Skip to content

Commit

Permalink
Implementing Box Sizing for Stylo
Browse files Browse the repository at this point in the history
  • Loading branch information
shinglyu committed Jun 17, 2016
1 parent 5d86b9b commit 8f97c89
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions ports/geckolib/properties.mako.rs
Expand Up @@ -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"]

Expand Down Expand Up @@ -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,
Expand All @@ -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')}

</%self:impl_trait>

<% skip_outline_longhands = " ".join("outline-color outline-style outline-width".split() +
Expand Down

0 comments on commit 8f97c89

Please sign in to comment.