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

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

Issue 2578773002: Made a generator for .h files for implementations of CSSPropertyAPI.h (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_descriptor.py b/third_party/WebKit/Source/build/scripts/make_css_property_api.py
similarity index 75%
rename from third_party/WebKit/Source/build/scripts/make_css_property_descriptor.py
rename to third_party/WebKit/Source/build/scripts/make_css_property_api.py
index 8e9343167b4eaadb3647653297bf2d1a2c7cfb8f..d4ca7aa7a0e05cde32b11d99197c7ebcea289a72 100755
--- a/third_party/WebKit/Source/build/scripts/make_css_property_descriptor.py
+++ b/third_party/WebKit/Source/build/scripts/make_css_property_api.py
@@ -37,6 +37,7 @@ class CSSPropertyAPIWriter(make_style_builder.StyleBuilderWriter):
continue
sashab 2016/12/15 02:48:42 Small thing - in your CL description, avoid 'we',
aazzam 2016/12/15 04:35:07 done :)
classname = get_classname(property)
sashab 2016/12/15 02:48:43 Also this file - because it generates both, maybe:
aazzam 2016/12/15 04:35:07 I've gone with make_css_property_apis.py, sounds O
properties_for_class[classname].append(property['property_id'])
+ self._outputs.update({classname + '.h': self.generate_property_api_h_builder(classname)})
sashab 2016/12/15 02:48:43 You don't need .update - you can just set [key] =
aazzam 2016/12/15 04:35:07 done :)
# Stores a list of classes with elements (index, classname, [propertyIDs, ..]).
self._api_classes = []
@@ -55,5 +56,17 @@ class CSSPropertyAPIWriter(make_style_builder.StyleBuilderWriter):
'api_classes': self._api_classes,
}
+ # The self._outputs dict requires a function pointer to a generation function for
+ # each .h file. This generation function is different depending on which property
+ # group we are generating a .h file for. Therefore we have generate_api_function
+ # which generates a new function pointer given the classname and property ids.
sashab 2016/12/15 02:48:42 Great comment, except one nit: 'function pointer'
aazzam 2016/12/15 04:35:07 re-worded it, does this sound better?
+ def generate_property_api_h_builder(self, api_classname):
+ @template_expander.use_jinja('CSSPropertyAPI.h.tmpl')
+ def generate_property_api_h():
+ return {
+ 'api_classname': api_classname,
+ }
+ return generate_property_api_h
+
if __name__ == '__main__':
in_generator.Maker(CSSPropertyAPIWriter).main(sys.argv)

Powered by Google App Engine
This is Rietveld 408576698