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

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

Issue 2692943006: Only include unique files in generated ComputedStyleBase.h (Closed)
Patch Set: Rebase Created 3 years, 10 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/templates/ComputedStyleBase.h.tmpl » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/build/scripts/make_computed_style_base.py
diff --git a/third_party/WebKit/Source/build/scripts/make_computed_style_base.py b/third_party/WebKit/Source/build/scripts/make_computed_style_base.py
index bae41bcba8ae844cd3650e363adba7c5cc8b6cbe..7002f99c641cd0b1cac7d535bd7004eb2a8425ae 100755
--- a/third_party/WebKit/Source/build/scripts/make_computed_style_base.py
+++ b/third_party/WebKit/Source/build/scripts/make_computed_style_base.py
@@ -48,8 +48,6 @@ class Field(object):
'property_name',
# Name of the type (e.g. EClear, int)
'type_name',
- # Path to predefined class for overriding generated types.
- 'field_type_path',
# Affects how the field is generated (keyword, flag)
'field_template',
# Bits needed for storage
@@ -89,6 +87,17 @@ class Field(object):
assert len(kwargs) == 0, 'Unexpected arguments provided to Field: ' + str(kwargs)
+def _get_include_paths(properties):
+ """
+ Get a list of paths that need to be included for ComputedStyleBase.
+ """
+ include_paths = set()
+ for property_ in properties:
+ if property_['field_type_path'] is not None:
+ include_paths.add(property_['field_type_path'] + '.h')
+ return list(sorted(include_paths))
+
+
def _create_enums(properties):
"""
Returns a dictionary of enums to be generated, enum name -> [list of enum values]
@@ -126,10 +135,8 @@ def _create_property_field(property_):
# Separate the type path from the type name, if specified.
if property_['field_type_path']:
- field_type_path = property_['field_type_path']
- type_name = field_type_path.split('/')[-1]
+ type_name = property_['field_type_path'].split('/')[-1]
else:
- field_type_path = None
type_name = property_['type_name']
# For now, the getter name should match the field name. Later, getter names
@@ -151,7 +158,6 @@ def _create_property_field(property_):
inherited=property_['inherited'],
independent=property_['independent'],
type_name=type_name,
- field_type_path=field_type_path,
field_template=property_['field_template'],
size=int(math.ceil(bits_needed)),
default_value=default_value,
@@ -179,7 +185,6 @@ def _create_inherited_flag_field(property_):
name='m_' + field_name_suffix_lower,
property_name=property_['name'],
type_name='bool',
- field_type_path=None,
field_template='flag',
size=1,
default_value='true',
@@ -202,7 +207,6 @@ def _create_nonproperty_field(field_name):
name=member_name,
property_name=field_name,
type_name='bool',
- field_type_path=None,
field_template='flag',
size=1,
default_value='false',
@@ -317,6 +321,7 @@ class ComputedStyleBaseWriter(make_style_builder.StyleBuilderWriter):
return {
'properties': self._properties,
'enums': self._generated_enums,
+ 'include_paths': _get_include_paths(self._properties.values()),
'fields': self._fields,
'expected_total_field_bytes': self._expected_total_field_bytes,
}
« no previous file with comments | « no previous file | third_party/WebKit/Source/build/scripts/templates/ComputedStyleBase.h.tmpl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698