mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
style: Replace Gecko's hacky EXPERIMENTAL set with the same mechanism as servo.
We can remove the PREF_foo bits in a bit.
This commit is contained in:
parent
187d28c732
commit
2bd91d21d7
5 changed files with 19 additions and 27 deletions
|
@ -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):
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -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":
|
||||
|
|
|
@ -103,6 +103,7 @@
|
|||
</%helpers:shorthand>
|
||||
|
||||
<%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>
|
||||
|
||||
<%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>
|
||||
|
||||
<%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};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue