Skip to content

Commit

Permalink
Put alias instances into {longhand,shorthand}.alias.
Browse files Browse the repository at this point in the history
  • Loading branch information
upsuper committed Apr 11, 2018
1 parent 9a900ef commit 2aee174
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 13 deletions.
6 changes: 4 additions & 2 deletions components/style/properties/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,8 @@ def declare_longhand(self, name, products="gecko servo", **kwargs):

longhand = Longhand(self.current_style_struct, name, **kwargs)
self.add_prefixed_aliases(longhand)
self.longhand_aliases += list(map(lambda x: Alias(x, longhand), longhand.alias))
longhand.alias = list(map(lambda x: Alias(x, longhand), longhand.alias))
self.longhand_aliases += longhand.alias
self.current_style_struct.longhands.append(longhand)
self.longhands.append(longhand)
self.longhands_by_name[name] = longhand
Expand All @@ -475,7 +476,8 @@ def declare_shorthand(self, name, sub_properties, products="gecko servo", *args,
sub_properties = [self.longhands_by_name[s] for s in sub_properties]
shorthand = Shorthand(name, sub_properties, *args, **kwargs)
self.add_prefixed_aliases(shorthand)
self.shorthand_aliases += list(map(lambda x: Alias(x, shorthand), shorthand.alias))
shorthand.alias = list(map(lambda x: Alias(x, shorthand), shorthand.alias))
self.shorthand_aliases += shorthand.alias
self.shorthands.append(shorthand)
return shorthand

Expand Down
22 changes: 11 additions & 11 deletions components/style/properties/properties.mako.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1578,10 +1578,10 @@ 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 name in property.alias:
"${name}" => {
% for alias in property.alias:
"${alias.name}" => {
StaticId::${kind}Alias(${kind}Id::${property.camel_case},
AliasId::${to_camel_case(name)})
AliasId::${alias.camel_case})
},
% endfor
% endfor
Expand Down Expand Up @@ -1621,10 +1621,10 @@ impl PropertyId {
Ok(PropertyId::Longhand(LonghandId::${property.camel_case}))
}
% for alias in property.alias:
${helpers.alias_to_nscsspropertyid(alias)} => {
${helpers.alias_to_nscsspropertyid(alias.name)} => {
Ok(PropertyId::LonghandAlias(
LonghandId::${property.camel_case},
AliasId::${to_camel_case(alias)}
AliasId::${alias.camel_case}
))
}
% endfor
Expand All @@ -1634,10 +1634,10 @@ impl PropertyId {
Ok(PropertyId::Shorthand(ShorthandId::${property.camel_case}))
}
% for alias in property.alias:
${helpers.alias_to_nscsspropertyid(alias)} => {
${helpers.alias_to_nscsspropertyid(alias.name)} => {
Ok(PropertyId::ShorthandAlias(
ShorthandId::${property.camel_case},
AliasId::${to_camel_case(alias)}
AliasId::${alias.camel_case}
))
}
% endfor
Expand Down Expand Up @@ -3868,12 +3868,12 @@ 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 name in [property.name] + property.alias:
% if '-' in name:
[${to_rust_ident(name).capitalize()}, Set${to_rust_ident(name).capitalize()},
% for prop in [property] + property.alias:
% if '-' in prop.name:
[${prop.ident.capitalize()}, Set${prop.ident.capitalize()},
PropertyId::${kind}(${kind}Id::${property.camel_case})],
% endif
[${to_camel_case(name)}, Set${to_camel_case(name)},
[${prop.camel_case}, Set${prop.camel_case},
PropertyId::${kind}(${kind}Id::${property.camel_case})],
% endfor
% endif
Expand Down

0 comments on commit 2aee174

Please sign in to comment.