Bug 1646811 - servo: Enable parsing of `flex-*` properties for layout-2020.
authorSimon Sapin <simon.sapin@exyr.org>
Thu, 18 Jun 2020 18:12:23 +0000
changeset 536348 08aa02d53ba51711c80c252a4010593b3e090809
parent 536347 bdbb1eb6acf15ad43f0a979e37a89b4d86b8d037
child 536349 023935dbbdd66d3d5f78c82a48306ab79879188d
push id37520
push userdluca@mozilla.com
push dateFri, 19 Jun 2020 04:04:08 +0000
treeherdermozilla-central@d1a4f9157858 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1646811
milestone79.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1646811 - servo: Enable parsing of `flex-*` properties for layout-2020. Depends on D80235 Differential Revision: https://phabricator.services.mozilla.com/D80236
servo/components/style/properties/longhands/position.mako.rs
servo/components/style/properties/shorthands/position.mako.rs
--- a/servo/components/style/properties/longhands/position.mako.rs
+++ b/servo/components/style/properties/longhands/position.mako.rs
@@ -67,28 +67,30 @@ macro_rules! impl_align_conversions {
 
 // CSS Flexible Box Layout Module Level 1
 // http://www.w3.org/TR/css3-flexbox/
 
 // Flex container properties
 ${helpers.single_keyword(
     "flex-direction",
     "row row-reverse column column-reverse",
-    engines="gecko servo-2013",
+    engines="gecko servo-2013 servo-2020",
+    servo_2020_pref="layout.flexbox.enabled",
     spec="https://drafts.csswg.org/css-flexbox/#flex-direction-property",
     extra_prefixes="webkit",
     animation_value_type="discrete",
     servo_restyle_damage = "reflow",
     gecko_enum_prefix = "StyleFlexDirection",
 )}
 
 ${helpers.single_keyword(
     "flex-wrap",
     "nowrap wrap wrap-reverse",
-    engines="gecko servo-2013",
+    engines="gecko servo-2013 servo-2020",
+    servo_2020_pref="layout.flexbox.enabled",
     spec="https://drafts.csswg.org/css-flexbox/#flex-wrap-property",
     extra_prefixes="webkit",
     animation_value_type="discrete",
     servo_restyle_damage = "reflow",
     gecko_enum_prefix = "StyleFlexWrap",
 )}
 
 % if engine == "servo-2013":
@@ -200,28 +202,30 @@ macro_rules! impl_align_conversions {
     impl_align_conversions!(crate::values::specified::align::JustifyItems);
 % endif
 
 // Flex item properties
 ${helpers.predefined_type(
     "flex-grow",
     "NonNegativeNumber",
     "From::from(0.0)",
-    engines="gecko servo-2013",
+    engines="gecko servo-2013 servo-2020",
+    servo_2020_pref="layout.flexbox.enabled",
     spec="https://drafts.csswg.org/css-flexbox/#flex-grow-property",
     extra_prefixes="webkit",
     animation_value_type="NonNegativeNumber",
     servo_restyle_damage="reflow",
 )}
 
 ${helpers.predefined_type(
     "flex-shrink",
     "NonNegativeNumber",
     "From::from(1.0)",
-    engines="gecko servo-2013",
+    engines="gecko servo-2013 servo-2020",
+    servo_2020_pref="layout.flexbox.enabled",
     spec="https://drafts.csswg.org/css-flexbox/#flex-shrink-property",
     extra_prefixes="webkit",
     animation_value_type="NonNegativeNumber",
     servo_restyle_damage = "reflow",
 )}
 
 // https://drafts.csswg.org/css-align/#align-self-property
 % if engine in ["servo-2013", "servo-2020"]:
@@ -273,17 +277,18 @@ macro_rules! impl_align_conversions {
     spec="https://drafts.csswg.org/css-flexbox/#order-property",
     servo_restyle_damage="reflow",
 )}
 
 ${helpers.predefined_type(
     "flex-basis",
     "FlexBasis",
     "computed::FlexBasis::auto()",
-    engines="gecko servo-2013",
+    engines="gecko servo-2013 servo-2020",
+    servo_2020_pref="layout.flexbox.enabled",
     spec="https://drafts.csswg.org/css-flexbox/#flex-basis-property",
     extra_prefixes="webkit",
     animation_value_type="FlexBasis",
     servo_restyle_damage="reflow",
     boxed=True,
 )}
 
 % for (size, logical) in ALL_SIZES:
--- a/servo/components/style/properties/shorthands/position.mako.rs
+++ b/servo/components/style/properties/shorthands/position.mako.rs
@@ -1,16 +1,17 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
 
 <%namespace name="helpers" file="/helpers.mako.rs" />
 
 <%helpers:shorthand name="flex-flow"
-                    engines="gecko servo-2013"
+                    engines="gecko servo-2013 servo-2020",
+                    servo_2020_pref="layout.flexbox.enabled",
                     sub_properties="flex-direction flex-wrap"
                     extra_prefixes="webkit"
                     derive_serialize="True"
                     spec="https://drafts.csswg.org/css-flexbox/#flex-flow-property">
     use crate::properties::longhands::{flex_direction, flex_wrap};
 
     pub fn parse_value<'i, 't>(
         context: &ParserContext,
@@ -40,17 +41,18 @@
         Ok(expanded! {
             flex_direction: unwrap_or_initial!(flex_direction, direction),
             flex_wrap: unwrap_or_initial!(flex_wrap, wrap),
         })
     }
 </%helpers:shorthand>
 
 <%helpers:shorthand name="flex"
-                    engines="gecko servo-2013"
+                    engines="gecko servo-2013 servo-2020",
+                    servo_2020_pref="layout.flexbox.enabled",
                     sub_properties="flex-grow flex-shrink flex-basis"
                     extra_prefixes="webkit"
                     derive_serialize="True"
                     spec="https://drafts.csswg.org/css-flexbox/#flex-property">
     use crate::parser::Parse;
     use crate::values::specified::NonNegativeNumber;
     use crate::properties::longhands::flex_basis::SpecifiedValue as FlexBasis;