Auto merge of #11743 - shinglyu:stylo-box-sizing, r=emilio

Implementing Box Sizing for Stylo

<!-- Please describe your changes on the following line: -->
Implementing box-sizing for Stylo
---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [ ] These changes fix #__ (github issue number if applicable).

<!-- Either: -->
- [ ] There are tests for these changes OR
- [ ] These changes do not require tests because _____

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/11743)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2016-06-23 10:09:11 -05:00 committed by GitHub
commit c04d245bf2

View file

@ -387,8 +387,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"]
@ -554,7 +552,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,
@ -569,11 +567,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() +