Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(146)

Unified Diff: third_party/WebKit/Source/devtools/scripts/build/generate_supported_css.py

Issue 2620883002: Convert Settings.in, CSSValueKeywords.in, SVGCSSValueKeywords.in to json5 (Closed)
Patch Set: Convert CSSProperties.in to json5 format Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/devtools/scripts/build/generate_supported_css.py
diff --git a/third_party/WebKit/Source/devtools/scripts/build/generate_supported_css.py b/third_party/WebKit/Source/devtools/scripts/build/generate_supported_css.py
index 91fcb91019ae6878d5b94862eee0fd13e20d3e6f..b22e62dd3880ce965112e792368227c51a8c323e 100755
--- a/third_party/WebKit/Source/devtools/scripts/build/generate_supported_css.py
+++ b/third_party/WebKit/Source/devtools/scripts/build/generate_supported_css.py
@@ -35,38 +35,30 @@ except ImportError:
import sys
import re
+from json5_generator import Json5File # pylint: disable=W0403
+
def properties_from_file(file_name):
+ doc = Json5File.load_from_files([file_name])
+
properties = []
propertyNames = set()
- with open(file_name, "r") as f:
- for line in f:
- line = line.strip()
- if not line or line.startswith("//") or "alias_for" in line:
- continue
- partition = re.split("[, ]", line)
- name = partition[0]
- attributes = partition[1:]
- entry = {"name": name}
- if "inherited" in attributes:
- entry["inherited"] = True
- if "svg" in attributes:
- entry["svg"] = True
- propertyNames.add(name)
- longhands = line.partition("longhands=")[2].partition(",")[0]
- if longhands:
- entry["longhands"] = longhands.split(";")
- properties.append(entry)
+ for entry in doc.name_dictionaries:
+ if entry["alias_for"]:
+ continue
+ properties.append(entry)
+ propertyNames.add(entry["name"])
# Filter out unsupported longhands.
for property in properties:
if "longhands" not in property:
continue
- longhands = property["longhands"]
+ longhands = property["longhands"].split(";")
longhands = [longhand for longhand in longhands if longhand in propertyNames]
if not longhands:
del property["longhands"]
else:
property["longhands"] = longhands
+
return properties
properties = properties_from_file(sys.argv[1])
« no previous file with comments | « third_party/WebKit/Source/devtools/BUILD.gn ('k') | third_party/WebKit/Source/devtools/scripts/build/json5_generator.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698