style: Add gecko_pref annotation to the properties.

This commit is contained in:
Emilio Cobos Álvarez 2017-11-16 02:44:35 +01:00
parent f4683d1718
commit 187d28c732
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C
16 changed files with 42 additions and 2 deletions

View file

@ -146,7 +146,7 @@ def arg_to_bool(arg):
class Longhand(object):
def __init__(self, style_struct, name, spec=None, animation_value_type=None, derived_from=None, keyword=None,
predefined_type=None, custom_cascade=False, servo_pref=None, internal=False,
predefined_type=None, custom_cascade=False, servo_pref=None, gecko_pref=None, internal=False,
need_index=False, custom_cascade_function=None, gecko_ffi_name=None,
allowed_in_keyframe_block=True, cast_type='u8',
logical=False, alias=None, extra_prefixes=None, boxed=False,
@ -162,6 +162,7 @@ class Longhand(object):
self.camel_case = to_camel_case(self.ident)
self.style_struct = style_struct
self.servo_pref = servo_pref
self.gecko_pref = gecko_pref
self.custom_cascade = custom_cascade
self.custom_cascade_function = custom_cascade_function if custom_cascade else None
self.internal = internal
@ -207,7 +208,8 @@ class Longhand(object):
class Shorthand(object):
def __init__(self, name, sub_properties, spec=None, servo_pref=None, internal=False,
def __init__(self, name, sub_properties, spec=None, servo_pref=None, gecko_pref=None,
internal=False,
allowed_in_keyframe_block=True, alias=None, extra_prefixes=None,
allowed_in_page_rule=False, flags=None, gecko_pref_ident=None):
self.name = name
@ -218,6 +220,7 @@ class Shorthand(object):
self.camel_case = to_camel_case(self.ident)
self.derived_from = None
self.servo_pref = servo_pref
self.gecko_pref = gecko_pref
self.sub_properties = sub_properties
self.internal = internal
self.alias = alias.split() if alias else []
@ -261,6 +264,7 @@ class Alias(object):
self.gecko_pref_ident = to_rust_ident(name)
self.internal = original.internal
self.servo_pref = original.servo_pref
self.gecko_pref = original.gecko_pref
self.allowed_in_page_rule = original.allowed_in_page_rule
self.allowed_in_keyframe_block = original.allowed_in_keyframe_block

View file

@ -92,6 +92,7 @@ ${helpers.single_keyword("background-blend-mode",
color-burn hard-light soft-light difference exclusion hue
saturation color luminosity""",
gecko_constant_prefix="NS_STYLE_BLEND",
gecko_pref="layout.css.background-blend-mode.enabled",
vector=True, products="gecko", animation_value_type="discrete",
spec="https://drafts.fxtf.org/compositing/#background-blend-mode",
flags="APPLIES_TO_FIRST_LETTER APPLIES_TO_FIRST_LINE APPLIES_TO_PLACEHOLDER")}

View file

@ -191,6 +191,7 @@ ${helpers.gecko_keyword_conversion(Keyword('border-style',
${helpers.single_keyword("box-decoration-break", "slice clone",
gecko_enum_prefix="StyleBoxDecorationBreak",
gecko_pref="layout.css.box-decoration-break.enabled",
spec="https://drafts.csswg.org/css-break/#propdef-box-decoration-break",
products="gecko", animation_value_type="discrete")}

View file

@ -375,6 +375,7 @@ ${helpers.single_keyword("-servo-overflow-clip-box", "padding-box content-box",
${helpers.single_keyword("overflow-clip-box", "padding-box content-box",
products="gecko", animation_value_type="discrete", internal=True,
gecko_pref="layout.css.overflow-clip-box.enabled",
flags="APPLIES_TO_PLACEHOLDER",
spec="Internal, not web-exposed, \
may be standardized in the future (https://developer.mozilla.org/en-US/docs/Web/CSS/overflow-clip-box)")}
@ -543,6 +544,7 @@ ${helpers.predefined_type("animation-delay",
"ScrollSnapPoint",
"computed::ScrollSnapPoint::none()",
animation_value_type="discrete",
gecko_pref="layout.css.scroll-snap.enabled",
products="gecko",
spec="Nonstandard (https://www.w3.org/TR/2015/WD-css-snappoints-1-20150326/#scroll-snap-points)",
)}
@ -552,6 +554,7 @@ ${helpers.predefined_type("scroll-snap-destination",
"Position",
"computed::Position::zero()",
products="gecko",
gecko_pref="layout.css.scroll-snap.enabled",
boxed="True",
spec="Nonstandard (https://developer.mozilla.org/en-US/docs/Web/CSS/scroll-snap-destination)",
animation_value_type="discrete")}
@ -562,6 +565,7 @@ ${helpers.predefined_type(
"computed::Position::zero()",
vector=True,
products="gecko",
gecko_pref="layout.css.scroll-snap.enabled",
spec="Nonstandard (https://developer.mozilla.org/en-US/docs/Web/CSS/scroll-snap-destination)",
animation_value_type="discrete",
allow_empty="NotInitial"
@ -579,6 +583,7 @@ ${helpers.predefined_type("transform", "Transform",
// https://www.w3.org/TR/cssom-view-1/
${helpers.single_keyword("scroll-behavior",
"auto smooth",
gecko_pref="layout.css.scroll-behavior.property-enabled",
products="gecko",
spec="https://drafts.csswg.org/cssom-view/#propdef-scroll-behavior",
animation_value_type="discrete")}
@ -590,6 +595,7 @@ ${helpers.single_keyword("scroll-behavior",
"computed::ScrollSnapType::None",
products="gecko",
needs_context=False,
gecko_pref="layout.css.scroll-snap.enabled",
spec="Nonstandard (https://developer.mozilla.org/en-US/docs/Web/CSS/scroll-snap-type-x)",
animation_value_type="discrete"
)}
@ -600,6 +606,7 @@ ${helpers.single_keyword("scroll-behavior",
${helpers.single_keyword("isolation",
"auto isolate",
products="gecko",
gecko_pref="layout.css.isolation.enabled",
spec="https://drafts.fxtf.org/compositing/#isolation",
flags="CREATES_STACKING_CONTEXT",
animation_value_type="discrete")}
@ -666,6 +673,7 @@ ${helpers.single_keyword("transform-box",
"border-box fill-box view-box",
gecko_enum_prefix="StyleGeometryBox",
products="gecko",
gecko_pref="svg.transform-box.enabled",
spec="https://drafts.csswg.org/css-transforms/#transform-box",
gecko_inexhaustive="True",
animation_value_type="discrete")}
@ -693,6 +701,7 @@ ${helpers.predefined_type("transform-origin",
// also update the glue once they are implemented in gecko.
<%helpers:longhand name="contain" animation_value_type="discrete" products="gecko"
flags="FIXPOS_CB"
gecko_pref="layout.css.contain.enabled",
spec="https://drafts.csswg.org/css-contain/#contain-property">
use std::fmt;
use style_traits::ToCss;
@ -894,6 +903,7 @@ ${helpers.predefined_type(
"generics::basic_shape::ShapeSource::None",
products="gecko",
boxed=True,
gecko_pref="layout.css.shape-outside.enabled",
animation_value_type="ComputedValue",
flags="APPLIES_TO_FIRST_LETTER",
spec="https://drafts.csswg.org/css-shapes/#shape-outside-property",

View file

@ -62,6 +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",
spec="https://drafts.csswg.org/css-multicol/#propdef-column-span")}
${helpers.single_keyword("column-rule-style",

View file

@ -52,4 +52,5 @@ ${helpers.single_keyword("mix-blend-mode",
saturation color luminosity""", gecko_constant_prefix="NS_STYLE_BLEND",
animation_value_type="discrete",
flags="CREATES_STACKING_CONTEXT",
gecko_pref="layout.css.mix-blend-mode.enabled",
spec="https://drafts.fxtf.org/compositing/#propdef-mix-blend-mode")}

View file

@ -1203,6 +1203,7 @@ https://drafts.csswg.org/css-fonts-4/#low-level-font-variation-settings-control-
${helpers.predefined_type("font-variation-settings",
"FontVariantSettings",
products="gecko",
gecko_pref="layout.css.font-variations.enabled",
initial_value="specified::FontVariantSettings::normal()",
animation_value_type="ComputedValue",
flags="APPLIES_TO_FIRST_LETTER APPLIES_TO_FIRST_LINE APPLIES_TO_PLACEHOLDER",
@ -1510,6 +1511,7 @@ ${helpers.single_keyword("-moz-osx-font-smoothing",
"auto grayscale",
gecko_constant_prefix="NS_FONT_SMOOTHING",
gecko_ffi_name="mFont.smoothing",
gecko_pref="layout.css.osx-font-smoothing.enabled",
products="gecko",
spec="Nonstandard (https://developer.mozilla.org/en-US/docs/Web/CSS/font-smooth)",
flags="APPLIES_TO_FIRST_LETTER APPLIES_TO_FIRST_LINE APPLIES_TO_PLACEHOLDER",

View file

@ -41,6 +41,7 @@ ${helpers.single_keyword("text-orientation",
// https://drafts.csswg.org/css-color/
${helpers.single_keyword("color-adjust",
"economy exact", products="gecko",
gecko_pref="layout.css.color-adjust.enabled",
animation_value_type="discrete",
spec="https://drafts.csswg.org/css-color/#propdef-color-adjust")}
@ -60,6 +61,7 @@ ${helpers.single_keyword("image-rendering",
<%helpers:longhand name="image-orientation"
products="gecko"
animation_value_type="discrete"
gecko_pref="layout.css.image-orientation.enabled"
spec="https://drafts.csswg.org/css-images/#propdef-image-orientation, \
/// additional values in https://developer.mozilla.org/en-US/docs/Web/CSS/image-orientation">
use std::fmt;

View file

@ -132,6 +132,7 @@ ${helpers.predefined_type("marker-end", "UrlOrNone", "Either::Second(None_)",
<%helpers:longhand name="paint-order"
animation_value_type="discrete"
gecko_pref="svg.paint-order.enabled"
products="gecko"
spec="https://www.w3.org/TR/SVG2/painting.html#PaintOrder">
use std::fmt;

View file

@ -66,6 +66,7 @@ ${helpers.single_keyword("word-break",
extra_specified="${'distribute' if product == 'gecko' else ''}"
gecko_enum_prefix="StyleTextJustify"
animation_value_type="discrete"
gecko_pref="layout.css.text-justify.enabled"
flags="APPLIES_TO_PLACEHOLDER",
spec="https://drafts.csswg.org/css-text/#propdef-text-justify">
@ -689,6 +690,7 @@ ${helpers.predefined_type(
"Color",
"computed_value::T::currentcolor()",
products="gecko",
gecko_pref="layout.css.prefixes.webkit",
animation_value_type="AnimatedColor",
ignored_when_colors_disabled=True,
flags="APPLIES_TO_FIRST_LETTER APPLIES_TO_FIRST_LINE APPLIES_TO_PLACEHOLDER",
@ -703,6 +705,7 @@ ${helpers.predefined_type(
products="gecko",
animation_value_type="AnimatedColor",
ignored_when_colors_disabled=True,
gecko_pref="layout.css.prefixes.webkit",
flags="APPLIES_TO_FIRST_LETTER APPLIES_TO_FIRST_LINE APPLIES_TO_PLACEHOLDER",
spec="https://compat.spec.whatwg.org/#the-webkit-text-stroke-color",
)}
@ -713,6 +716,7 @@ ${helpers.predefined_type("-webkit-text-stroke-width",
initial_specified_value="specified::BorderSideWidth::Length(specified::Length::zero())",
computed_type="::values::computed::NonNegativeLength",
products="gecko",
gecko_pref="layout.css.prefixes.webkit",
flags="APPLIES_TO_FIRST_LETTER APPLIES_TO_FIRST_LINE APPLIES_TO_PLACEHOLDER",
spec="https://compat.spec.whatwg.org/#the-webkit-text-stroke-width",
animation_value_type="discrete")}
@ -732,6 +736,7 @@ ${helpers.single_keyword("ruby-position", "over under",
${helpers.single_keyword("text-combine-upright", "none all",
products="gecko", animation_value_type="discrete",
gecko_pref="layout.css.text-combine-upright.enabled",
spec="https://drafts.csswg.org/css-writing-modes-3/#text-combine-upright")}
// SVG 1.1: Section 11 - Painting: Filling, Stroking and Marker Symbols

View file

@ -257,6 +257,7 @@ ${helpers.predefined_type("object-position",
"computed::NonNegativeLengthOrPercentage::zero()",
spec="https://drafts.csswg.org/css-grid/#propdef-grid-%s-gap" % kind,
animation_value_type="NonNegativeLengthOrPercentage",
gecko_pref="layout.css.grid.enabled",
products="gecko")}
% for range in ["start", "end"]:
@ -266,6 +267,7 @@ ${helpers.predefined_type("object-position",
animation_value_type="discrete",
spec="https://drafts.csswg.org/css-grid/#propdef-grid-%s-%s" % (kind, range),
products="gecko",
gecko_pref="layout.css.grid.enabled",
boxed=True)}
% endfor
@ -277,6 +279,7 @@ ${helpers.predefined_type("object-position",
animation_value_type="discrete",
spec="https://drafts.csswg.org/css-grid/#propdef-grid-auto-%ss" % kind,
products="gecko",
gecko_pref="layout.css.grid.enabled",
boxed=True)}
${helpers.predefined_type("grid-template-%ss" % kind,
@ -285,6 +288,7 @@ ${helpers.predefined_type("object-position",
products="gecko",
spec="https://drafts.csswg.org/css-grid/#propdef-grid-template-%ss" % kind,
boxed=True,
gecko_pref="layout.css.grid.enabled",
animation_value_type="discrete")}
% endfor
@ -292,6 +296,7 @@ ${helpers.predefined_type("object-position",
<%helpers:longhand name="grid-auto-flow"
spec="https://drafts.csswg.org/css-grid/#propdef-grid-auto-flow"
products="gecko"
gecko_pref="layout.css.grid.enabled"
animation_value_type="discrete">
use std::fmt;
use style_traits::ToCss;
@ -415,6 +420,7 @@ ${helpers.predefined_type("object-position",
spec="https://drafts.csswg.org/css-grid/#propdef-grid-template-areas"
products="gecko"
animation_value_type="discrete"
gecko_pref="layout.css.grid.enabled"
boxed="True">
use hash::FnvHashMap;
use std::fmt;

View file

@ -62,4 +62,5 @@ ${helpers.predefined_type(
animation_value_type="discrete",
products="gecko",
flags="APPLIES_TO_FIRST_LETTER",
gecko_pref="layout.css.initial-letter.enabled",
spec="https://drafts.csswg.org/css-inline/#sizing-drop-initials")}

View file

@ -184,6 +184,7 @@ pub mod shorthands {
data.declare_shorthand(
"all",
logical_longhands + other_longhands,
gecko_pref="layout.css.all-shorthand.enabled",
spec="https://drafts.csswg.org/css-cascade-3/#all-shorthand"
)
%>

View file

@ -331,6 +331,7 @@ macro_rules! try_parse_one {
</%helpers:shorthand>
<%helpers:shorthand name="scroll-snap-type" products="gecko"
gecko_pref="layout.css.scroll-snap.enabled"
sub_properties="scroll-snap-type-x scroll-snap-type-y"
spec="https://drafts.csswg.org/css-scroll-snap/#propdef-scroll-snap-type">
use properties::longhands::scroll_snap_type_x;
@ -360,6 +361,7 @@ macro_rules! try_parse_one {
<%helpers:shorthand name="-moz-transform" products="gecko"
sub_properties="transform"
gecko_pref="layout.css.prefixes.transforms"
flags="SHORTHAND_ALIAS_PROPERTY"
derive_serialize="True"
spec="Non-standard: https://developer.mozilla.org/en-US/docs/Web/CSS/transform">

View file

@ -46,6 +46,7 @@
<%helpers:shorthand name="-webkit-text-stroke"
sub_properties="-webkit-text-stroke-width
-webkit-text-stroke-color"
gecko_pref="layout.css.prefixes.webkit"
products="gecko"
derive_serialize="True"
spec="https://compat.spec.whatwg.org/#the-webkit-text-stroke">

View file

@ -462,6 +462,7 @@
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};