mirror of
https://github.com/servo/servo.git
synced 2025-08-08 06:55:31 +01:00
single_keywords supports custom_consts map for enum. r=heycam
We need it to convert PlaybackDirection::Alternate_reverse in Gecko to alternate-reverse in Servo.
This commit is contained in:
parent
2a2a89b7e4
commit
ff1db63922
1 changed files with 3 additions and 3 deletions
|
@ -60,12 +60,12 @@ class Keyword(object):
|
||||||
|
|
||||||
def gecko_constant(self, value):
|
def gecko_constant(self, value):
|
||||||
moz_stripped = value.replace("-moz-", '') if self.gecko_strip_moz_prefix else value
|
moz_stripped = value.replace("-moz-", '') if self.gecko_strip_moz_prefix else value
|
||||||
parts = moz_stripped.split('-')
|
mapped = self.consts_map.get(value)
|
||||||
if self.gecko_enum_prefix:
|
if self.gecko_enum_prefix:
|
||||||
parts = [p.title() for p in parts]
|
parts = moz_stripped.split('-')
|
||||||
|
parts = mapped if mapped else [p.title() for p in parts]
|
||||||
return self.gecko_enum_prefix + "::" + "".join(parts)
|
return self.gecko_enum_prefix + "::" + "".join(parts)
|
||||||
else:
|
else:
|
||||||
mapped = self.consts_map.get(value)
|
|
||||||
suffix = mapped if mapped else moz_stripped.replace("-", "_")
|
suffix = mapped if mapped else moz_stripped.replace("-", "_")
|
||||||
return self.gecko_constant_prefix + "_" + suffix.upper()
|
return self.gecko_constant_prefix + "_" + suffix.upper()
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue