From 2bd91d21d71c0b765e23db2b823c4e35dadc733e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Thu, 16 Nov 2017 02:50:53 +0100 Subject: [PATCH] style: Replace Gecko's hacky EXPERIMENTAL set with the same mechanism as servo. We can remove the PREF_foo bits in a bit. --- components/style/properties/data.py | 11 ++++++++ .../style/properties/longhand/box.mako.rs | 1 + .../style/properties/longhand/column.mako.rs | 2 +- .../style/properties/properties.mako.rs | 26 +------------------ .../properties/shorthand/position.mako.rs | 6 ++++- 5 files changed, 19 insertions(+), 27 deletions(-) diff --git a/components/style/properties/data.py b/components/style/properties/data.py index 5a448bb6c95..c9bb0c69e87 100644 --- a/components/style/properties/data.py +++ b/components/style/properties/data.py @@ -206,6 +206,12 @@ class Longhand(object): self.transitionable = False self.animation_type = None + def experimental(self, product): + if product == "gecko": + return bool(self.gecko_pref) + return bool(self.servo_pref) + + class Shorthand(object): def __init__(self, name, sub_properties, spec=None, servo_pref=None, gecko_pref=None, @@ -255,6 +261,11 @@ class Shorthand(object): animatable = property(get_animatable) transitionable = property(get_transitionable) + def experimental(self, product): + if product == "gecko": + return bool(self.gecko_pref) + return bool(self.servo_pref) + class Alias(object): def __init__(self, name, original): diff --git a/components/style/properties/longhand/box.mako.rs b/components/style/properties/longhand/box.mako.rs index f7a3aa10974..d45686d5364 100644 --- a/components/style/properties/longhand/box.mako.rs +++ b/components/style/properties/longhand/box.mako.rs @@ -912,6 +912,7 @@ ${helpers.predefined_type( <%helpers:longhand name="touch-action" products="gecko" animation_value_type="discrete" + gecko_pref="layout.css.touch_action.enabled" spec="https://compat.spec.whatwg.org/#touch-action"> use gecko_bindings::structs; use std::fmt; diff --git a/components/style/properties/longhand/column.mako.rs b/components/style/properties/longhand/column.mako.rs index 48009ff16b2..c45ce687a03 100644 --- a/components/style/properties/longhand/column.mako.rs +++ b/components/style/properties/longhand/column.mako.rs @@ -62,7 +62,7 @@ ${helpers.predefined_type( ${helpers.single_keyword("column-span", "none all", products="gecko", animation_value_type="discrete", - gecko_pref="layout.css.color-adjust.enabled", + gecko_pref="layout.css.column-span.enabled", spec="https://drafts.csswg.org/css-multicol/#propdef-column-span")} ${helpers.single_keyword("column-rule-style", diff --git a/components/style/properties/properties.mako.rs b/components/style/properties/properties.mako.rs index 64ed0e1b9cc..a2695a08c22 100644 --- a/components/style/properties/properties.mako.rs +++ b/components/style/properties/properties.mako.rs @@ -1292,31 +1292,7 @@ impl PropertyId { // both experimental and internal, the pref only controls its // availability in non-UA sheets (and in UA sheets it is always available). ${id_set("INTERNAL", lambda p: p.internal)} - - % if product == "servo": - ${id_set("EXPERIMENTAL", lambda p: p.servo_pref)} - % endif - % if product == "gecko": - use gecko_bindings::structs::root::mozilla; - static EXPERIMENTAL: NonCustomPropertyIdSet = NonCustomPropertyIdSet { - <% - grouped = [] - properties = data.longhands + data.shorthands + data.all_aliases() - while properties: - grouped.append(properties[:32]) - properties = properties[32:] - %> - storage: [ - % for group in grouped: - (0 - % for i, property in enumerate(group): - | ((mozilla::SERVO_PREF_ENABLED_${property.gecko_pref_ident} as u32) << ${i}) - % endfor - ), - % endfor - ] - }; - % endif + ${id_set("EXPERIMENTAL", lambda p: p.experimental(product))} let passes_pref_check = || { % if product == "servo": diff --git a/components/style/properties/shorthand/position.mako.rs b/components/style/properties/shorthand/position.mako.rs index 2aa4e49a2a6..a04283c0321 100644 --- a/components/style/properties/shorthand/position.mako.rs +++ b/components/style/properties/shorthand/position.mako.rs @@ -103,6 +103,7 @@ <%helpers:shorthand name="grid-gap" sub_properties="grid-row-gap grid-column-gap" + gecko_pref="layout.css.grid.enabled" spec="https://drafts.csswg.org/css-grid/#propdef-grid-gap" products="gecko"> use properties::longhands::{grid_row_gap, grid_column_gap}; @@ -134,6 +135,7 @@ % for kind in ["row", "column"]: <%helpers:shorthand name="grid-${kind}" sub_properties="grid-${kind}-start grid-${kind}-end" + gecko_pref="layout.css.grid.enabled" spec="https://drafts.csswg.org/css-grid/#propdef-grid-${kind}" products="gecko"> use values::specified::GridLine; @@ -173,6 +175,7 @@ % endfor <%helpers:shorthand name="grid-area" + gecko_pref="layout.css.grid.enabled" sub_properties="grid-row-start grid-row-end grid-column-start grid-column-end" spec="https://drafts.csswg.org/css-grid/#propdef-grid-area" products="gecko"> @@ -238,6 +241,7 @@ <%helpers:shorthand name="grid-template" + gecko_pref="layout.css.grid.enabled" sub_properties="grid-template-rows grid-template-columns grid-template-areas" spec="https://drafts.csswg.org/css-grid/#propdef-grid-template" products="gecko"> @@ -459,10 +463,10 @@ <%helpers:shorthand name="grid" + gecko_pref="layout.css.grid.enabled" sub_properties="grid-template-rows grid-template-columns grid-template-areas grid-auto-rows grid-auto-columns grid-auto-flow" spec="https://drafts.csswg.org/css-grid/#propdef-grid" - gecko_pref="layout.css.grid.enabled" products="gecko"> use parser::Parse; use properties::longhands::{grid_auto_columns, grid_auto_rows, grid_auto_flow};