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

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

Issue 2567473002: Made a generator for CSSPropertyDescriptor.cpp (Closed)
Patch Set: Created 4 years 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/build/scripts/make_css_property_api.py
diff --git a/third_party/WebKit/Source/build/scripts/make_css_property_api.py b/third_party/WebKit/Source/build/scripts/make_css_property_api.py
new file mode 100755
index 0000000000000000000000000000000000000000..91a8768eac8b74ae7faa5d6afa31a34f88fd9a11
--- /dev/null
+++ b/third_party/WebKit/Source/build/scripts/make_css_property_api.py
@@ -0,0 +1,40 @@
+#!/usr/bin/env python
+# Copyright 2016 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import sys
+
+import in_generator
+import template_expander
+import make_style_builder
+
+
+class CSSPropertyAPIWriter(make_style_builder.StyleBuilderWriter):
+ def __init__(self, in_file_path):
+ super(CSSPropertyAPIWriter, self).__init__(in_file_path)
+
+ self._outputs = {"CSSPropertyDescriptor.cpp": self.generate_property_descriptor_h}
sashab 2016/12/08 23:56:35 Move this line and move newline to after it to be
aazzam 2016/12/09 00:44:39 done
+ self._property_groups = []
sashab 2016/12/08 23:56:35 Add comments explaining what these variables are f
aazzam 2016/12/09 00:44:39 done
+ self._properties_by_index = []
+ for property in self._properties.values():
+ if property['generated_api_class'] is not None:
+ if property['generated_api_class'] is True:
+ self._property_groups.append(property['upper_camel_name'])
sashab 2016/12/08 23:56:35 It's not clear that the other branch is not False.
aazzam 2016/12/09 00:44:39 done
+ else:
sashab 2016/12/08 23:56:35 I would change to elif property['..'] is not False
aazzam 2016/12/09 00:44:39 done :)
+ self._property_groups.append(property['generated_api_class'])
+ self._properties_by_index.append(property)
+
+ self._property_groups = list(set(self._property_groups))
sashab 2016/12/08 23:56:35 Add comment explaining this is to remove duplicate
aazzam 2016/12/09 00:44:39 done
+ for i, property in enumerate(self._properties_by_index):
sashab 2016/12/08 23:56:35 Add comment explaining what this loop is for
aazzam 2016/12/09 00:44:39 done
+ property['api_array_index'] = i + 1
+
+ @template_expander.use_jinja('CSSPropertyDescriptor.cpp.tmpl')
+ def generate_property_descriptor_h(self):
+ return {
+ 'propertyGroups': sorted(self._property_groups),
sashab 2016/12/08 23:56:35 Check other files - I think they use underscore_na
aazzam 2016/12/09 00:44:39 done
+ 'properties': self._properties_by_index,
+ }
+
+if __name__ == '__main__':
+ in_generator.Maker(CSSPropertyAPIWriter).main(sys.argv)

Powered by Google App Engine
This is Rietveld 408576698