mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
Stylo: Implement align-content and justify-content
This commit is contained in:
parent
1dbc538589
commit
c70167d17c
5 changed files with 316 additions and 16 deletions
|
@ -867,8 +867,8 @@ 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">
|
||||
|
||||
skip_longhands="${skip_position_longhands} z-index box-sizing order align-content
|
||||
justify-content">
|
||||
% for side in SIDES:
|
||||
<% impl_split_style_coord("%s" % side.ident,
|
||||
"mOffset",
|
||||
|
@ -906,6 +906,18 @@ fn static_assert() {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn set_align_content(&mut self, v: longhands::align_content::computed_value::T) {
|
||||
self.gecko.mAlignContent = v.bits()
|
||||
}
|
||||
|
||||
${impl_simple_copy('align_content', 'mAlignContent')}
|
||||
|
||||
pub fn set_justify_content(&mut self, v: longhands::justify_content::computed_value::T) {
|
||||
self.gecko.mJustifyContent = v.bits()
|
||||
}
|
||||
|
||||
${impl_simple_copy('justify_content', 'mJustifyContent')}
|
||||
|
||||
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;
|
||||
|
|
|
@ -84,14 +84,20 @@ ${helpers.single_keyword("flex-wrap", "nowrap wrap wrap-reverse",
|
|||
spec="https://drafts.csswg.org/css-flexbox/#flex-wrap-property",
|
||||
extra_prefixes="webkit", animatable=False)}
|
||||
|
||||
// FIXME(stshine): The type of 'justify-content' and 'align-content' is uint16_t in gecko
|
||||
// FIXME(stshine): Its higher bytes are used to store fallback value. Disable them in geckolib for now
|
||||
${helpers.single_keyword("justify-content", "flex-start flex-end center space-between space-around",
|
||||
gecko_constant_prefix="NS_STYLE_JUSTIFY",
|
||||
products="servo",
|
||||
extra_prefixes="webkit",
|
||||
spec="https://drafts.csswg.org/css-flexbox/#justify-content-property",
|
||||
animatable=False)}
|
||||
% if product == "servo":
|
||||
// FIXME: Update Servo to support the same Syntax as Gecko.
|
||||
${helpers.single_keyword("justify-content", "stretch flex-start flex-end center space-between space-around",
|
||||
extra_prefixes="webkit",
|
||||
spec="https://drafts.csswg.org/css-flexbox/#justify-content-property",
|
||||
animatable=False)}
|
||||
% else:
|
||||
${helpers.predefined_type(name="justify-content",
|
||||
type="AlignJustifyContent",
|
||||
initial_value="specified::AlignJustifyContent::auto()",
|
||||
spec="https://drafts.csswg.org/css-flexbox/#justify-content-property",
|
||||
extra_prefixes="webkit",
|
||||
animatable=False)}
|
||||
% endif
|
||||
|
||||
// https://drafts.csswg.org/css-flexbox/#propdef-align-items
|
||||
// FIXME: This is a workaround for 'normal' value. We don't support the Gecko initial value 'normal' yet.
|
||||
|
@ -103,12 +109,20 @@ ${helpers.single_keyword("align-items", "stretch flex-start flex-end center base
|
|||
spec="https://drafts.csswg.org/css-flexbox/#align-items-property",
|
||||
animatable=False)}
|
||||
|
||||
${helpers.single_keyword("align-content", "stretch flex-start flex-end center space-between space-around",
|
||||
gecko_constant_prefix="NS_STYLE_ALIGN",
|
||||
products="servo",
|
||||
extra_prefixes="webkit",
|
||||
spec="https://drafts.csswg.org/css-flexbox/#align-content-property",
|
||||
animatable=False)}
|
||||
% if product == "servo":
|
||||
// FIXME: Update Servo to support the same Syntax as Gecko.
|
||||
${helpers.single_keyword("align-content", "stretch flex-start flex-end center space-between space-around",
|
||||
extra_prefixes="webkit",
|
||||
spec="https://drafts.csswg.org/css-flexbox/#align-content-property",
|
||||
animatable=False)}
|
||||
% else:
|
||||
${helpers.predefined_type(name="align-content",
|
||||
type="AlignJustifyContent",
|
||||
initial_value="specified::AlignJustifyContent::auto()",
|
||||
spec="https://drafts.csswg.org/css-flexbox/#align-content-property",
|
||||
extra_prefixes="webkit",
|
||||
animatable=False)}
|
||||
% endif
|
||||
|
||||
// Flex item properties
|
||||
${helpers.predefined_type("flex-grow", "Number",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue