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

Unified Diff: third_party/WebKit/Source/build/scripts/css_properties.py

Issue 2620233002: Add 'priority' key to CSSProperties.in (Closed)
Patch Set: 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/build/scripts/name_utilities.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/build/scripts/css_properties.py
diff --git a/third_party/WebKit/Source/build/scripts/css_properties.py b/third_party/WebKit/Source/build/scripts/css_properties.py
index e2015500bbda2b7e01bd2eb0e91e28829791579a..41d1a11f94d88c2067914f6639d549d48e2388ae 100755
--- a/third_party/WebKit/Source/build/scripts/css_properties.py
+++ b/third_party/WebKit/Source/build/scripts/css_properties.py
@@ -31,6 +31,7 @@ class CSSProperties(in_generator.Writer):
'custom_value': False,
'builder_skip': False,
'direction_aware': False,
+ 'priority': 2,
'api_class': None,
# Generated ComputedStyle annotations.
'field_storage_type': None,
@@ -62,6 +63,20 @@ class CSSProperties(in_generator.Writer):
in_generator.Writer.__init__(self, file_paths)
properties = self.in_file.name_dictionaries
+
+ # Group properties by priority.
+ prioritised_properties = {0: [], 1: [], 2: []}
ktyliu 2017/01/11 02:45:43 Note you can do this all in one statement by using
sashab 2017/01/11 02:50:46 "Let me do your entire patch in one line kthxbai"
+ for property in properties:
+ priority = int(property['priority'])
+ assert priority in [0, 1, 2], 'Priority must be a number between 0 and 2'
+ prioritised_properties[priority].append(property)
+
+ # Sort each priority alphabetically and concatenate them.
+ property_name_key = lambda p: name_utilities.strip_webkit_prefix(p['name'])
+ properties = (sorted(prioritised_properties[0], key=property_name_key) +
+ sorted(prioritised_properties[1], key=property_name_key) +
+ sorted(prioritised_properties[2], key=property_name_key))
+
self._aliases = [property for property in properties if property['alias_for']]
properties = [property for property in properties if not property['alias_for']]
« no previous file with comments | « no previous file | third_party/WebKit/Source/build/scripts/name_utilities.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698