Auto-generate CSSStyleDeclaration.webidl for CSS properties based on the style crate

This commit is contained in:
Simon Sapin 2019-07-26 21:54:42 +02:00
parent 447ae1eae6
commit f1300bb98b
7 changed files with 83 additions and 485 deletions

View file

@ -8,7 +8,7 @@ publish = false
build = "build.rs"
# https://github.com/rust-lang/cargo/issues/3544
links = "for some reason the links key is required to pass data around between build scripts"
links = "servo_style_crate"
[lib]
name = "style"

View file

@ -94,6 +94,15 @@ def main():
template = os.path.join(BASE, "gecko.mako.rs")
rust = render(template, data=properties)
write(OUT_DIR, "gecko_properties.rs", rust)
if product == "servo":
names_and_prefs = [
(prop.name, prop.servo_pref)
for p in properties.longhands + properties.shorthands
if p.enabled_in_content()
for prop in [p] + p.alias
]
write(OUT_DIR, "css_properties.json", json.dumps(names_and_prefs, indent=4))
elif output == "geckolib":
if len(sys.argv) < 4:
abort(usage)