style: Implement style system support for Masonry layout.

This implements support for this CSS Masonry layout proposal:
https://github.com/w3c/csswg-drafts/issues/4650

I've intentionally left out a shorthand (place-tracks?) for now until
we have a draft CSS spec for this.

Differential Revision: https://phabricator.services.mozilla.com/D67061
This commit is contained in:
Mats Palmgren 2020-04-28 01:18:44 +00:00 committed by Emilio Cobos Álvarez
parent 21d48e00cc
commit 6f58c66589
11 changed files with 295 additions and 30 deletions

View file

@ -356,6 +356,7 @@ class Longhand(object):
"JustifyItems",
"JustifySelf",
"LineBreak",
"MasonryAutoFlow",
"MozForceBrokenImageIcon",
"MozListReversed",
"MozScriptLevel",

View file

@ -802,7 +802,8 @@ 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}">
skip_longhands="${skip_position_longhands}
masonry-auto-flow">
% for side in SIDES:
<% impl_split_style_coord(side.ident, "mOffset", side.index) %>
% endfor
@ -811,6 +812,7 @@ fn static_assert() {
self.gecko.mJustifyItems.computed = v;
}
${impl_simple_type_with_conversion("masonry_auto_flow", "mMasonryAutoFlow")}
</%self:impl_trait>
<% skip_outline_longhands = " ".join("outline-style outline-width".split() +

View file

@ -114,6 +114,17 @@ ${helpers.single_keyword(
animation_value_type="discrete",
servo_restyle_damage="reflow",
)}
${helpers.predefined_type(
"justify-tracks",
"JustifyTracks",
"specified::JustifyTracks::default()",
engines="gecko",
gecko_pref="layout.css.grid-template-masonry-value.enabled",
animation_value_type="discrete",
servo_restyle_damage="reflow",
spec="https://github.com/w3c/csswg-drafts/issues/4650",
)}
% endif
% if engine in ["servo-2013", "servo-2020"]:
@ -151,6 +162,17 @@ ${helpers.single_keyword(
servo_restyle_damage="reflow",
)}
${helpers.predefined_type(
"align-tracks",
"AlignTracks",
"specified::AlignTracks::default()",
engines="gecko",
gecko_pref="layout.css.grid-template-masonry-value.enabled",
animation_value_type="discrete",
servo_restyle_damage="reflow",
spec="https://github.com/w3c/csswg-drafts/issues/4650",
)}
${helpers.predefined_type(
"align-items",
"AlignItems",
@ -372,6 +394,16 @@ ${helpers.predefined_type(
% endfor
${helpers.predefined_type(
"masonry-auto-flow",
"MasonryAutoFlow",
"computed::MasonryAutoFlow::initial()",
engines="gecko",
gecko_pref="layout.css.grid-template-masonry-value.enabled",
animation_value_type="discrete",
spec="https://github.com/w3c/csswg-drafts/issues/4650",
)}
${helpers.predefined_type(
"grid-auto-flow",
"GridAutoFlow",