style: Implement 'align-self' and 'justify-self'

This commit is contained in:
Matt Brubeck 2017-02-15 10:57:18 -08:00
parent 34fb10bd40
commit 4de480ec9b
5 changed files with 124 additions and 11 deletions

View file

@ -864,7 +864,7 @@ fn static_assert() {
<% 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
justify-content">
justify-content align-self justify-self">
% for side in SIDES:
<% impl_split_style_coord("%s" % side.ident,
"mOffset",
@ -914,6 +914,18 @@ fn static_assert() {
${impl_simple_copy('justify_content', 'mJustifyContent')}
pub fn set_align_self(&mut self, v: longhands::align_self::computed_value::T) {
self.gecko.mAlignSelf = v.0.bits()
}
${impl_simple_copy('align_self', 'mAlignSelf')}
pub fn set_justify_self(&mut self, v: longhands::justify_self::computed_value::T) {
self.gecko.mJustifySelf = v.0.bits()
}
${impl_simple_copy('justify_self', 'mJustifySelf')}
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;

View file

@ -140,14 +140,27 @@ ${helpers.predefined_type("flex-shrink", "Number",
animatable=True)}
// https://drafts.csswg.org/css-align/#align-self-property
// FIXME: We don't support the Gecko value 'normal' yet.
${helpers.single_keyword("align-self", "auto stretch flex-start flex-end center baseline",
need_clone=True,
extra_prefixes="webkit",
extra_gecko_values="normal",
gecko_constant_prefix="NS_STYLE_ALIGN",
spec="https://drafts.csswg.org/css-flexbox/#propdef-align-self",
animatable=False)}
% if product == "servo":
// FIXME: Update Servo to support the same syntax as Gecko.
${helpers.single_keyword("align-self", "auto stretch flex-start flex-end center baseline",
need_clone=True,
extra_prefixes="webkit",
spec="https://drafts.csswg.org/css-flexbox/#propdef-align-self",
animatable=False)}
% else:
${helpers.predefined_type(name="align-self",
type="AlignJustifySelf",
initial_value="specified::AlignJustifySelf::auto()",
spec="https://drafts.csswg.org/css-align/#align-self-property",
extra_prefixes="webkit",
animatable=False)}
${helpers.predefined_type(name="justify-self",
type="AlignJustifySelf",
initial_value="specified::AlignJustifySelf::auto()",
spec="https://drafts.csswg.org/css-align/#justify-self-property",
animatable=False)}
% endif
// https://drafts.csswg.org/css-flexbox/#propdef-order
<%helpers:longhand name="order" animatable="True" extra_prefixes="webkit"