From 4dc475d3a1c247464251f73b0537af2bf27f5dc0 Mon Sep 17 00:00:00 2001 From: Emily McDonough Date: Fri, 19 Feb 2021 18:29:33 +0000 Subject: [PATCH] style: Rename alias to aliases in Longhand and Shorthand Differential Revision: https://phabricator.services.mozilla.com/D105810 --- components/style/properties/data.py | 22 +++++++++---------- .../style/properties/longhands/border.mako.rs | 6 ++--- .../style/properties/longhands/box.mako.rs | 4 ++-- .../longhands/inherited_text.mako.rs | 4 ++-- .../style/properties/longhands/margin.mako.rs | 2 +- .../properties/longhands/padding.mako.rs | 2 +- .../properties/longhands/position.mako.rs | 4 ++-- .../style/properties/longhands/xul.mako.rs | 12 +++++----- .../style/properties/properties.mako.rs | 4 ++-- .../properties/shorthands/border.mako.rs | 2 +- .../properties/shorthands/position.mako.rs | 2 +- 11 files changed, 32 insertions(+), 32 deletions(-) diff --git a/components/style/properties/data.py b/components/style/properties/data.py index 4da703bef87..714e3ced604 100644 --- a/components/style/properties/data.py +++ b/components/style/properties/data.py @@ -234,7 +234,7 @@ class Property(object): gecko_pref, enabled_in, rule_types_allowed, - alias, + aliases, extra_prefixes, flags, ): @@ -257,7 +257,7 @@ class Property(object): # modulo a pref, set via servo_pref / gecko_pref. assert enabled_in in ("", "ua", "chrome", "content") 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.flags = flags.split() if flags else [] @@ -304,7 +304,7 @@ class Longhand(Property): cast_type="u8", logical=False, logical_group=None, - alias=None, + aliases=None, extra_prefixes=None, boxed=False, flags=None, @@ -323,7 +323,7 @@ class Longhand(Property): gecko_pref=gecko_pref, enabled_in=enabled_in, rule_types_allowed=rule_types_allowed, - alias=alias, + aliases=aliases, extra_prefixes=extra_prefixes, flags=flags, ) @@ -543,7 +543,7 @@ class Shorthand(Property): gecko_pref=None, enabled_in="content", rule_types_allowed=DEFAULT_RULES, - alias=None, + aliases=None, extra_prefixes=None, flags=None, ): @@ -556,7 +556,7 @@ class Shorthand(Property): gecko_pref=gecko_pref, enabled_in=enabled_in, rule_types_allowed=rule_types_allowed, - alias=alias, + aliases=aliases, extra_prefixes=extra_prefixes, flags=flags, ) @@ -692,7 +692,7 @@ class PropertiesData(object): # See servo/servo#14941. if self.engine == "gecko": 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): engines = engines.split() @@ -701,8 +701,8 @@ class PropertiesData(object): longhand = Longhand(self.current_style_struct, name, **kwargs) self.add_prefixed_aliases(longhand) - longhand.alias = [Alias(xp[0], longhand, xp[1]) for xp in longhand.alias] - self.longhand_aliases += longhand.alias + longhand.aliases = [Alias(xp[0], longhand, xp[1]) for xp in longhand.aliases] + self.longhand_aliases += longhand.aliases self.current_style_struct.longhands.append(longhand) self.longhands.append(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] shorthand = Shorthand(name, sub_properties, *args, **kwargs) self.add_prefixed_aliases(shorthand) - shorthand.alias = [Alias(xp[0], shorthand, xp[1]) for xp in shorthand.alias] - self.shorthand_aliases += shorthand.alias + shorthand.aliases = [Alias(xp[0], shorthand, xp[1]) for xp in shorthand.aliases] + self.shorthand_aliases += shorthand.aliases self.shorthands.append(shorthand) self.shorthands_by_name[name] = shorthand return shorthand diff --git a/components/style/properties/longhands/border.mako.rs b/components/style/properties/longhands/border.mako.rs index 11ed63a438a..82fbfe9c1c7 100644 --- a/components/style/properties/longhands/border.mako.rs +++ b/components/style/properties/longhands/border.mako.rs @@ -24,7 +24,7 @@ "border-%s-color" % side_name, "Color", "computed_value::T::currentcolor()", 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"), animation_value_type="AnimatedColor", logical=is_logical, @@ -37,7 +37,7 @@ "border-%s-style" % side_name, "BorderStyle", "specified::BorderStyle::None", 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"), animation_value_type="discrete" if not is_logical else "none", logical=is_logical, @@ -50,7 +50,7 @@ "crate::values::computed::NonNegativeLength::new(3.)", engines="gecko servo-2013 servo-2020", 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"), animation_value_type="NonNegativeLength", logical=is_logical, diff --git a/components/style/properties/longhands/box.mako.rs b/components/style/properties/longhands/box.mako.rs index 77755db8b15..73a2ec87065 100644 --- a/components/style/properties/longhands/box.mako.rs +++ b/components/style/properties/longhands/box.mako.rs @@ -505,7 +505,7 @@ ${helpers.predefined_type( "BreakWithin", "computed::BreakWithin::Auto", engines="gecko", - alias="page-break-inside", + aliases="page-break-inside", spec="https://drafts.csswg.org/css-break/#propdef-break-inside", animation_value_type="discrete", )} @@ -607,7 +607,7 @@ ${helpers.predefined_type( "Appearance", "computed::Appearance::None", engines="gecko", - alias="-moz-appearance -webkit-appearance", + aliases="-moz-appearance -webkit-appearance", spec="https://drafts.csswg.org/css-ui-4/#propdef-appearance", animation_value_type="discrete", gecko_ffi_name="mAppearance", diff --git a/components/style/properties/longhands/inherited_text.mako.rs b/components/style/properties/longhands/inherited_text.mako.rs index 3720119ce88..bb43a0a86de 100644 --- a/components/style/properties/longhands/inherited_text.mako.rs +++ b/components/style/properties/longhands/inherited_text.mako.rs @@ -57,7 +57,7 @@ ${helpers.single_keyword( gecko_ffi_name="mTextSizeAdjust", animation_value_type="discrete", spec="https://drafts.csswg.org/css-size-adjust/#adjustment-control", - alias="-webkit-text-size-adjust", + aliases="-webkit-text-size-adjust", )} ${helpers.predefined_type( @@ -82,7 +82,7 @@ ${helpers.predefined_type( servo_2020_pref="layout.2020.unimplemented", animation_value_type="discrete", spec="https://drafts.csswg.org/css-text/#propdef-overflow-wrap", - alias="word-wrap", + aliases="word-wrap", servo_restyle_damage="rebuild_and_reflow", )} diff --git a/components/style/properties/longhands/margin.mako.rs b/components/style/properties/longhands/margin.mako.rs index c28ca5f6560..75d16a3cccd 100644 --- a/components/style/properties/longhands/margin.mako.rs +++ b/components/style/properties/longhands/margin.mako.rs @@ -17,7 +17,7 @@ "LengthPercentageOrAuto", "computed::LengthPercentageOrAuto::zero()", 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", animation_value_type="ComputedValue", logical=side[1], diff --git a/components/style/properties/longhands/padding.mako.rs b/components/style/properties/longhands/padding.mako.rs index 79668df7bbf..84683412f2c 100644 --- a/components/style/properties/longhands/padding.mako.rs +++ b/components/style/properties/longhands/padding.mako.rs @@ -17,7 +17,7 @@ "NonNegativeLengthPercentage", "computed::NonNegativeLengthPercentage::zero()", 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", logical=side[1], logical_group="padding", diff --git a/components/style/properties/longhands/position.mako.rs b/components/style/properties/longhands/position.mako.rs index e5afe7b2883..4500b7d911f 100644 --- a/components/style/properties/longhands/position.mako.rs +++ b/components/style/properties/longhands/position.mako.rs @@ -432,7 +432,7 @@ ${helpers.predefined_type( "length::NonNegativeLengthPercentageOrNormal", "computed::length::NonNegativeLengthPercentageOrNormal::normal()", 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", servo_2013_pref="layout.columns.enabled", spec="https://drafts.csswg.org/css-align-3/#propdef-column-gap", @@ -446,7 +446,7 @@ ${helpers.predefined_type( "length::NonNegativeLengthPercentageOrNormal", "computed::length::NonNegativeLengthPercentageOrNormal::normal()", engines="gecko", - alias="grid-row-gap", + aliases="grid-row-gap", spec="https://drafts.csswg.org/css-align-3/#propdef-row-gap", animation_value_type="NonNegativeLengthPercentageOrNormal", servo_restyle_damage="reflow", diff --git a/components/style/properties/longhands/xul.mako.rs b/components/style/properties/longhands/xul.mako.rs index a981f5ba795..a939b018920 100644 --- a/components/style/properties/longhands/xul.mako.rs +++ b/components/style/properties/longhands/xul.mako.rs @@ -15,7 +15,7 @@ ${helpers.single_keyword( gecko_ffi_name="mBoxAlign", gecko_enum_prefix="StyleBoxAlign", 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)", )} @@ -26,7 +26,7 @@ ${helpers.single_keyword( gecko_ffi_name="mBoxDirection", gecko_enum_prefix="StyleBoxDirection", 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)", )} @@ -37,7 +37,7 @@ ${helpers.predefined_type( engines="gecko", gecko_ffi_name="mBoxFlex", 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)", )} @@ -49,7 +49,7 @@ ${helpers.single_keyword( gecko_aliases="inline-axis=horizontal block-axis=vertical", gecko_enum_prefix="StyleBoxOrient", 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)", )} @@ -60,7 +60,7 @@ ${helpers.single_keyword( gecko_ffi_name="mBoxPack", gecko_enum_prefix="StyleBoxPack", 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)", )} @@ -72,7 +72,7 @@ ${helpers.predefined_type( "1", engines="gecko", parse_method="parse_non_negative", - alias="-webkit-box-ordinal-group", + aliases="-webkit-box-ordinal-group", gecko_ffi_name="mBoxOrdinal", animation_value_type="discrete", spec="Nonstandard (https://developer.mozilla.org/en-US/docs/Web/CSS/-moz-box-ordinal-group)", diff --git a/components/style/properties/properties.mako.rs b/components/style/properties/properties.mako.rs index 31da5e8a700..a3430526458 100644 --- a/components/style/properties/properties.mako.rs +++ b/components/style/properties/properties.mako.rs @@ -1948,7 +1948,7 @@ impl PropertyId { % for (kind, properties) in [("Longhand", data.longhands), ("Shorthand", data.shorthands)]: % for property in properties: "${property.name}" => StaticId::${kind}(${kind}Id::${property.camel_case}), - % for alias in property.alias: + % for alias in property.aliases: "${alias.name}" => { StaticId::${kind}Alias( ${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 property in props: % if property.enabled_in_content(): - % for prop in [property] + property.alias: + % for prop in [property] + property.aliases: % if '-' in prop.name: [${prop.ident.capitalize()}, Set${prop.ident.capitalize()}, PropertyId::${kind}(${kind}Id::${property.camel_case})], diff --git a/components/style/properties/shorthands/border.mako.rs b/components/style/properties/shorthands/border.mako.rs index c204c878444..b8c5a7f2e16 100644 --- a/components/style/properties/shorthands/border.mako.rs +++ b/components/style/properties/shorthands/border.mako.rs @@ -112,7 +112,7 @@ pub fn parse_border<'i, 't>( 'border-%s-%s' % (side, prop) 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}"> pub fn parse_value<'i, 't>( diff --git a/components/style/properties/shorthands/position.mako.rs b/components/style/properties/shorthands/position.mako.rs index 0dacdc4c7cf..28343b8a562 100644 --- a/components/style/properties/shorthands/position.mako.rs +++ b/components/style/properties/shorthands/position.mako.rs @@ -115,7 +115,7 @@ <%helpers:shorthand name="gap" engines="gecko" - alias="grid-gap" + aliases="grid-gap" sub_properties="row-gap column-gap" spec="https://drafts.csswg.org/css-align-3/#gap-shorthand" >