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

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

Issue 2654403003: Added api_methods flag to CSSProperties.json5. (Closed)
Patch Set: Changed comments again 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/build/scripts/make_css_property_apis.py
diff --git a/third_party/WebKit/Source/build/scripts/make_css_property_apis.py b/third_party/WebKit/Source/build/scripts/make_css_property_apis.py
index 35ee4a2bb4944b2127cf5ce56f14a3296dd057d4..141daf2b70f98f8d57bcd60f79aee044984b35a5 100755
--- a/third_party/WebKit/Source/build/scripts/make_css_property_apis.py
+++ b/third_party/WebKit/Source/build/scripts/make_css_property_apis.py
@@ -11,7 +11,6 @@ import make_style_builder
from collections import namedtuple, defaultdict
-
# Gets the classname for a given property.
def get_classname(property):
if property['api_class'] is True:
@@ -25,6 +24,10 @@ def get_classname(property):
class CSSPropertyAPIWriter(make_style_builder.StyleBuilderWriter):
def __init__(self, json5_file_path):
+ # Holds names of all valid methods in the API. When a new method is added
+ # to the API, it must also be added to this list.
+ valid_methods = ["parseSingleValue"]
sashab 2017/01/31 20:06:30 Can we store this in CSSproperties.json5? There is
ktyliu 2017/01/31 22:14:16 yes you can put this inside CSSProperties.json5 to
aazzam 2017/01/31 22:38:37 awesome idea!! much better than asking people to e
+
super(CSSPropertyAPIWriter, self).__init__(json5_file_path)
self._outputs = {
'CSSPropertyDescriptor.cpp': self.generate_property_descriptor_cpp,
@@ -37,7 +40,10 @@ class CSSPropertyAPIWriter(make_style_builder.StyleBuilderWriter):
continue
classname = get_classname(property)
properties_for_class[classname].append(property['property_id'])
- self._outputs[classname + '.h'] = self.generate_property_api_h_builder(classname)
+ for method in property['api_methods']:
sashab 2017/01/31 20:06:30 for 'api_method' in (keep naming consistent)
aazzam 2017/01/31 22:38:37 I think i can get rid of this if i'm validating th
+ assert method in valid_methods, 'Invalid method ' + method + \
ktyliu 2017/01/31 22:14:16 this becomes unnecessary if you specify valid_valu
+ '. Methods added to the API must also be added to list valid_methods.'
+ self._outputs[classname + '.h'] = self.generate_property_api_h_builder(classname, property['api_methods'])
# Stores a list of classes with elements (index, classname, [propertyIDs, ..]).
self._api_classes = []
@@ -58,11 +64,12 @@ class CSSPropertyAPIWriter(make_style_builder.StyleBuilderWriter):
# Provides a function object given the classname of the property.
# This returned function generates a .h file for the specified property.
- def generate_property_api_h_builder(self, api_classname):
+ def generate_property_api_h_builder(self, api_classname, implemented_functions):
@template_expander.use_jinja('CSSPropertyAPIFiles.h.tmpl')
def generate_property_api_h():
return {
'api_classname': api_classname,
+ 'implemented_functions': implemented_functions,
sashab 2017/01/31 20:06:30 Keep naming consistent; call this api_methods
}
return generate_property_api_h

Powered by Google App Engine
This is Rietveld 408576698