mirror of
https://github.com/servo/servo.git
synced 2025-10-04 02:29:12 +01:00
Use rust-phf to map strings to property IDs
This commit is contained in:
parent
137e30b825
commit
fdc40592de
7 changed files with 50 additions and 36 deletions
|
@ -33,6 +33,7 @@ def main():
|
|||
rust = render(template, product=product, data=properties, __file__=template)
|
||||
if output == "style-crate":
|
||||
write(os.environ["OUT_DIR"], "properties.rs", rust)
|
||||
write(os.environ["OUT_DIR"], "static_ids.txt", static_ids(properties))
|
||||
if product == "gecko":
|
||||
template = os.path.join(BASE, "gecko.mako.rs")
|
||||
rust = render(template, data=properties)
|
||||
|
@ -69,6 +70,15 @@ def write(directory, filename, content):
|
|||
open(os.path.join(directory, filename), "wb").write(content)
|
||||
|
||||
|
||||
def static_ids(properties):
|
||||
return '\n'.join(
|
||||
"%s\tStaticId::%s(%sId::%s)" % (p.name, kind, kind, p.camel_case)
|
||||
for kind, props in [("Longhand", properties.longhands),
|
||||
("Shorthand", properties.shorthands)]
|
||||
for p in props
|
||||
)
|
||||
|
||||
|
||||
def write_html(properties):
|
||||
properties = dict(
|
||||
(p.name, {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue