style: Rename alias to aliases in Longhand and Shorthand

Differential Revision: https://phabricator.services.mozilla.com/D105810
This commit is contained in:
Emily McDonough 2021-02-19 18:29:33 +00:00 committed by Emilio Cobos Álvarez
parent 742c5e0d17
commit 4dc475d3a1
11 changed files with 32 additions and 32 deletions

View file

@ -234,7 +234,7 @@ class Property(object):
gecko_pref, gecko_pref,
enabled_in, enabled_in,
rule_types_allowed, rule_types_allowed,
alias, aliases,
extra_prefixes, extra_prefixes,
flags, flags,
): ):
@ -257,7 +257,7 @@ class Property(object):
# modulo a pref, set via servo_pref / gecko_pref. # modulo a pref, set via servo_pref / gecko_pref.
assert enabled_in in ("", "ua", "chrome", "content") assert enabled_in in ("", "ua", "chrome", "content")
self.enabled_in = enabled_in self.enabled_in = enabled_in
self.alias = parse_property_aliases(alias) self.aliases = parse_property_aliases(aliases)
self.extra_prefixes = parse_property_aliases(extra_prefixes) self.extra_prefixes = parse_property_aliases(extra_prefixes)
self.flags = flags.split() if flags else [] self.flags = flags.split() if flags else []
@ -304,7 +304,7 @@ class Longhand(Property):
cast_type="u8", cast_type="u8",
logical=False, logical=False,
logical_group=None, logical_group=None,
alias=None, aliases=None,
extra_prefixes=None, extra_prefixes=None,
boxed=False, boxed=False,
flags=None, flags=None,
@ -323,7 +323,7 @@ class Longhand(Property):
gecko_pref=gecko_pref, gecko_pref=gecko_pref,
enabled_in=enabled_in, enabled_in=enabled_in,
rule_types_allowed=rule_types_allowed, rule_types_allowed=rule_types_allowed,
alias=alias, aliases=aliases,
extra_prefixes=extra_prefixes, extra_prefixes=extra_prefixes,
flags=flags, flags=flags,
) )
@ -543,7 +543,7 @@ class Shorthand(Property):
gecko_pref=None, gecko_pref=None,
enabled_in="content", enabled_in="content",
rule_types_allowed=DEFAULT_RULES, rule_types_allowed=DEFAULT_RULES,
alias=None, aliases=None,
extra_prefixes=None, extra_prefixes=None,
flags=None, flags=None,
): ):
@ -556,7 +556,7 @@ class Shorthand(Property):
gecko_pref=gecko_pref, gecko_pref=gecko_pref,
enabled_in=enabled_in, enabled_in=enabled_in,
rule_types_allowed=rule_types_allowed, rule_types_allowed=rule_types_allowed,
alias=alias, aliases=aliases,
extra_prefixes=extra_prefixes, extra_prefixes=extra_prefixes,
flags=flags, flags=flags,
) )
@ -692,7 +692,7 @@ class PropertiesData(object):
# See servo/servo#14941. # See servo/servo#14941.
if self.engine == "gecko": if self.engine == "gecko":
for (prefix, pref) in property.extra_prefixes: for (prefix, pref) in property.extra_prefixes:
property.alias.append(("-%s-%s" % (prefix, property.name), pref)) property.aliases.append(("-%s-%s" % (prefix, property.name), pref))
def declare_longhand(self, name, engines=None, **kwargs): def declare_longhand(self, name, engines=None, **kwargs):
engines = engines.split() engines = engines.split()
@ -701,8 +701,8 @@ class PropertiesData(object):
longhand = Longhand(self.current_style_struct, name, **kwargs) longhand = Longhand(self.current_style_struct, name, **kwargs)
self.add_prefixed_aliases(longhand) self.add_prefixed_aliases(longhand)
longhand.alias = [Alias(xp[0], longhand, xp[1]) for xp in longhand.alias] longhand.aliases = [Alias(xp[0], longhand, xp[1]) for xp in longhand.aliases]
self.longhand_aliases += longhand.alias self.longhand_aliases += longhand.aliases
self.current_style_struct.longhands.append(longhand) self.current_style_struct.longhands.append(longhand)
self.longhands.append(longhand) self.longhands.append(longhand)
self.longhands_by_name[name] = longhand self.longhands_by_name[name] = longhand
@ -721,8 +721,8 @@ class PropertiesData(object):
sub_properties = [self.longhands_by_name[s] for s in sub_properties] sub_properties = [self.longhands_by_name[s] for s in sub_properties]
shorthand = Shorthand(name, sub_properties, *args, **kwargs) shorthand = Shorthand(name, sub_properties, *args, **kwargs)
self.add_prefixed_aliases(shorthand) self.add_prefixed_aliases(shorthand)
shorthand.alias = [Alias(xp[0], shorthand, xp[1]) for xp in shorthand.alias] shorthand.aliases = [Alias(xp[0], shorthand, xp[1]) for xp in shorthand.aliases]
self.shorthand_aliases += shorthand.alias self.shorthand_aliases += shorthand.aliases
self.shorthands.append(shorthand) self.shorthands.append(shorthand)
self.shorthands_by_name[name] = shorthand self.shorthands_by_name[name] = shorthand
return shorthand return shorthand

View file

@ -24,7 +24,7 @@
"border-%s-color" % side_name, "Color", "border-%s-color" % side_name, "Color",
"computed_value::T::currentcolor()", "computed_value::T::currentcolor()",
engines="gecko servo-2013 servo-2020", engines="gecko servo-2013 servo-2020",
alias=maybe_moz_logical_alias(engine, side, "-moz-border-%s-color"), aliases=maybe_moz_logical_alias(engine, side, "-moz-border-%s-color"),
spec=maybe_logical_spec(side, "color"), spec=maybe_logical_spec(side, "color"),
animation_value_type="AnimatedColor", animation_value_type="AnimatedColor",
logical=is_logical, logical=is_logical,
@ -37,7 +37,7 @@
"border-%s-style" % side_name, "BorderStyle", "border-%s-style" % side_name, "BorderStyle",
"specified::BorderStyle::None", "specified::BorderStyle::None",
engines="gecko servo-2013 servo-2020", engines="gecko servo-2013 servo-2020",
alias=maybe_moz_logical_alias(engine, side, "-moz-border-%s-style"), aliases=maybe_moz_logical_alias(engine, side, "-moz-border-%s-style"),
spec=maybe_logical_spec(side, "style"), spec=maybe_logical_spec(side, "style"),
animation_value_type="discrete" if not is_logical else "none", animation_value_type="discrete" if not is_logical else "none",
logical=is_logical, logical=is_logical,
@ -50,7 +50,7 @@
"crate::values::computed::NonNegativeLength::new(3.)", "crate::values::computed::NonNegativeLength::new(3.)",
engines="gecko servo-2013 servo-2020", engines="gecko servo-2013 servo-2020",
computed_type="crate::values::computed::NonNegativeLength", computed_type="crate::values::computed::NonNegativeLength",
alias=maybe_moz_logical_alias(engine, side, "-moz-border-%s-width"), aliases=maybe_moz_logical_alias(engine, side, "-moz-border-%s-width"),
spec=maybe_logical_spec(side, "width"), spec=maybe_logical_spec(side, "width"),
animation_value_type="NonNegativeLength", animation_value_type="NonNegativeLength",
logical=is_logical, logical=is_logical,

View file

@ -505,7 +505,7 @@ ${helpers.predefined_type(
"BreakWithin", "BreakWithin",
"computed::BreakWithin::Auto", "computed::BreakWithin::Auto",
engines="gecko", engines="gecko",
alias="page-break-inside", aliases="page-break-inside",
spec="https://drafts.csswg.org/css-break/#propdef-break-inside", spec="https://drafts.csswg.org/css-break/#propdef-break-inside",
animation_value_type="discrete", animation_value_type="discrete",
)} )}
@ -607,7 +607,7 @@ ${helpers.predefined_type(
"Appearance", "Appearance",
"computed::Appearance::None", "computed::Appearance::None",
engines="gecko", engines="gecko",
alias="-moz-appearance -webkit-appearance", aliases="-moz-appearance -webkit-appearance",
spec="https://drafts.csswg.org/css-ui-4/#propdef-appearance", spec="https://drafts.csswg.org/css-ui-4/#propdef-appearance",
animation_value_type="discrete", animation_value_type="discrete",
gecko_ffi_name="mAppearance", gecko_ffi_name="mAppearance",

View file

@ -57,7 +57,7 @@ ${helpers.single_keyword(
gecko_ffi_name="mTextSizeAdjust", gecko_ffi_name="mTextSizeAdjust",
animation_value_type="discrete", animation_value_type="discrete",
spec="https://drafts.csswg.org/css-size-adjust/#adjustment-control", spec="https://drafts.csswg.org/css-size-adjust/#adjustment-control",
alias="-webkit-text-size-adjust", aliases="-webkit-text-size-adjust",
)} )}
${helpers.predefined_type( ${helpers.predefined_type(
@ -82,7 +82,7 @@ ${helpers.predefined_type(
servo_2020_pref="layout.2020.unimplemented", servo_2020_pref="layout.2020.unimplemented",
animation_value_type="discrete", animation_value_type="discrete",
spec="https://drafts.csswg.org/css-text/#propdef-overflow-wrap", spec="https://drafts.csswg.org/css-text/#propdef-overflow-wrap",
alias="word-wrap", aliases="word-wrap",
servo_restyle_damage="rebuild_and_reflow", servo_restyle_damage="rebuild_and_reflow",
)} )}

View file

@ -17,7 +17,7 @@
"LengthPercentageOrAuto", "LengthPercentageOrAuto",
"computed::LengthPercentageOrAuto::zero()", "computed::LengthPercentageOrAuto::zero()",
engines="gecko servo-2013 servo-2020", engines="gecko servo-2013 servo-2020",
alias=maybe_moz_logical_alias(engine, side, "-moz-margin-%s"), aliases=maybe_moz_logical_alias(engine, side, "-moz-margin-%s"),
allow_quirks="No" if side[1] else "Yes", allow_quirks="No" if side[1] else "Yes",
animation_value_type="ComputedValue", animation_value_type="ComputedValue",
logical=side[1], logical=side[1],

View file

@ -17,7 +17,7 @@
"NonNegativeLengthPercentage", "NonNegativeLengthPercentage",
"computed::NonNegativeLengthPercentage::zero()", "computed::NonNegativeLengthPercentage::zero()",
engines="gecko servo-2013 servo-2020", engines="gecko servo-2013 servo-2020",
alias=maybe_moz_logical_alias(engine, side, "-moz-padding-%s"), aliases=maybe_moz_logical_alias(engine, side, "-moz-padding-%s"),
animation_value_type="NonNegativeLengthPercentage", animation_value_type="NonNegativeLengthPercentage",
logical=side[1], logical=side[1],
logical_group="padding", logical_group="padding",

View file

@ -432,7 +432,7 @@ ${helpers.predefined_type(
"length::NonNegativeLengthPercentageOrNormal", "length::NonNegativeLengthPercentageOrNormal",
"computed::length::NonNegativeLengthPercentageOrNormal::normal()", "computed::length::NonNegativeLengthPercentageOrNormal::normal()",
engines="gecko servo-2013", engines="gecko servo-2013",
alias="grid-column-gap" if engine == "gecko" else "", aliases="grid-column-gap" if engine == "gecko" else "",
extra_prefixes="moz:layout.css.prefixes.columns", extra_prefixes="moz:layout.css.prefixes.columns",
servo_2013_pref="layout.columns.enabled", servo_2013_pref="layout.columns.enabled",
spec="https://drafts.csswg.org/css-align-3/#propdef-column-gap", spec="https://drafts.csswg.org/css-align-3/#propdef-column-gap",
@ -446,7 +446,7 @@ ${helpers.predefined_type(
"length::NonNegativeLengthPercentageOrNormal", "length::NonNegativeLengthPercentageOrNormal",
"computed::length::NonNegativeLengthPercentageOrNormal::normal()", "computed::length::NonNegativeLengthPercentageOrNormal::normal()",
engines="gecko", engines="gecko",
alias="grid-row-gap", aliases="grid-row-gap",
spec="https://drafts.csswg.org/css-align-3/#propdef-row-gap", spec="https://drafts.csswg.org/css-align-3/#propdef-row-gap",
animation_value_type="NonNegativeLengthPercentageOrNormal", animation_value_type="NonNegativeLengthPercentageOrNormal",
servo_restyle_damage="reflow", servo_restyle_damage="reflow",

View file

@ -15,7 +15,7 @@ ${helpers.single_keyword(
gecko_ffi_name="mBoxAlign", gecko_ffi_name="mBoxAlign",
gecko_enum_prefix="StyleBoxAlign", gecko_enum_prefix="StyleBoxAlign",
animation_value_type="discrete", animation_value_type="discrete",
alias="-webkit-box-align", aliases="-webkit-box-align",
spec="Nonstandard (https://developer.mozilla.org/en-US/docs/Web/CSS/box-align)", spec="Nonstandard (https://developer.mozilla.org/en-US/docs/Web/CSS/box-align)",
)} )}
@ -26,7 +26,7 @@ ${helpers.single_keyword(
gecko_ffi_name="mBoxDirection", gecko_ffi_name="mBoxDirection",
gecko_enum_prefix="StyleBoxDirection", gecko_enum_prefix="StyleBoxDirection",
animation_value_type="discrete", animation_value_type="discrete",
alias="-webkit-box-direction", aliases="-webkit-box-direction",
spec="Nonstandard (https://developer.mozilla.org/en-US/docs/Web/CSS/box-direction)", spec="Nonstandard (https://developer.mozilla.org/en-US/docs/Web/CSS/box-direction)",
)} )}
@ -37,7 +37,7 @@ ${helpers.predefined_type(
engines="gecko", engines="gecko",
gecko_ffi_name="mBoxFlex", gecko_ffi_name="mBoxFlex",
animation_value_type="NonNegativeNumber", animation_value_type="NonNegativeNumber",
alias="-webkit-box-flex", aliases="-webkit-box-flex",
spec="Nonstandard (https://developer.mozilla.org/en-US/docs/Web/CSS/box-flex)", spec="Nonstandard (https://developer.mozilla.org/en-US/docs/Web/CSS/box-flex)",
)} )}
@ -49,7 +49,7 @@ ${helpers.single_keyword(
gecko_aliases="inline-axis=horizontal block-axis=vertical", gecko_aliases="inline-axis=horizontal block-axis=vertical",
gecko_enum_prefix="StyleBoxOrient", gecko_enum_prefix="StyleBoxOrient",
animation_value_type="discrete", animation_value_type="discrete",
alias="-webkit-box-orient", aliases="-webkit-box-orient",
spec="Nonstandard (https://developer.mozilla.org/en-US/docs/Web/CSS/box-orient)", spec="Nonstandard (https://developer.mozilla.org/en-US/docs/Web/CSS/box-orient)",
)} )}
@ -60,7 +60,7 @@ ${helpers.single_keyword(
gecko_ffi_name="mBoxPack", gecko_ffi_name="mBoxPack",
gecko_enum_prefix="StyleBoxPack", gecko_enum_prefix="StyleBoxPack",
animation_value_type="discrete", animation_value_type="discrete",
alias="-webkit-box-pack", aliases="-webkit-box-pack",
spec="Nonstandard (https://developer.mozilla.org/en-US/docs/Web/CSS/box-pack)", spec="Nonstandard (https://developer.mozilla.org/en-US/docs/Web/CSS/box-pack)",
)} )}
@ -72,7 +72,7 @@ ${helpers.predefined_type(
"1", "1",
engines="gecko", engines="gecko",
parse_method="parse_non_negative", parse_method="parse_non_negative",
alias="-webkit-box-ordinal-group", aliases="-webkit-box-ordinal-group",
gecko_ffi_name="mBoxOrdinal", gecko_ffi_name="mBoxOrdinal",
animation_value_type="discrete", animation_value_type="discrete",
spec="Nonstandard (https://developer.mozilla.org/en-US/docs/Web/CSS/-moz-box-ordinal-group)", spec="Nonstandard (https://developer.mozilla.org/en-US/docs/Web/CSS/-moz-box-ordinal-group)",

View file

@ -1948,7 +1948,7 @@ impl PropertyId {
% for (kind, properties) in [("Longhand", data.longhands), ("Shorthand", data.shorthands)]: % for (kind, properties) in [("Longhand", data.longhands), ("Shorthand", data.shorthands)]:
% for property in properties: % for property in properties:
"${property.name}" => StaticId::${kind}(${kind}Id::${property.camel_case}), "${property.name}" => StaticId::${kind}(${kind}Id::${property.camel_case}),
% for alias in property.alias: % for alias in property.aliases:
"${alias.name}" => { "${alias.name}" => {
StaticId::${kind}Alias( StaticId::${kind}Alias(
${kind}Id::${property.camel_case}, ${kind}Id::${property.camel_case},
@ -4089,7 +4089,7 @@ macro_rules! css_properties_accessors {
% for kind, props in [("Longhand", data.longhands), ("Shorthand", data.shorthands)]: % for kind, props in [("Longhand", data.longhands), ("Shorthand", data.shorthands)]:
% for property in props: % for property in props:
% if property.enabled_in_content(): % if property.enabled_in_content():
% for prop in [property] + property.alias: % for prop in [property] + property.aliases:
% if '-' in prop.name: % if '-' in prop.name:
[${prop.ident.capitalize()}, Set${prop.ident.capitalize()}, [${prop.ident.capitalize()}, Set${prop.ident.capitalize()},
PropertyId::${kind}(${kind}Id::${property.camel_case})], PropertyId::${kind}(${kind}Id::${property.camel_case})],

View file

@ -112,7 +112,7 @@ pub fn parse_border<'i, 't>(
'border-%s-%s' % (side, prop) 'border-%s-%s' % (side, prop)
for prop in ['color', 'style', 'width'] for prop in ['color', 'style', 'width']
)}" )}"
alias="${maybe_moz_logical_alias(engine, (side, logical), '-moz-border-%s')}" aliases="${maybe_moz_logical_alias(engine, (side, logical), '-moz-border-%s')}"
spec="${spec}"> spec="${spec}">
pub fn parse_value<'i, 't>( pub fn parse_value<'i, 't>(

View file

@ -115,7 +115,7 @@
<%helpers:shorthand <%helpers:shorthand
name="gap" name="gap"
engines="gecko" engines="gecko"
alias="grid-gap" aliases="grid-gap"
sub_properties="row-gap column-gap" sub_properties="row-gap column-gap"
spec="https://drafts.csswg.org/css-align-3/#gap-shorthand" spec="https://drafts.csswg.org/css-align-3/#gap-shorthand"
> >