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

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

Issue 2811253002: Extract default naming logic in StyleBuilderWriter to a method. (Closed)
Patch Set: Created 3 years, 8 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/make_style_builder.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/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 b7330333dc1ff4eb2d0cc902b1f3f523615c41af..9d69846be99b8268f7498f089da300500905af3f 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
@@ -14,7 +14,7 @@ from name_utilities import (
enum_for_css_keyword, enum_type_name, enum_value_name, class_member_name, method_name,
join_name
)
-from collections import OrderedDict
+from collections import OrderedDict, defaultdict
# Temporary hard-coded list of fields that are not CSS properties.
@@ -307,12 +307,10 @@ class ComputedStyleBaseWriter(make_style_builder.StyleBuilderWriter):
# TODO(shend): Remove this once we move NONPROPERTIES to its own JSON file,
# since the JSON5 reader will handle missing fields and defaults.
- for property_ in NONPROPERTIES:
- property_['name_for_methods'] = property_['name']
- if 'field_type_path' not in property_:
Bugs Nash 2017/04/12 23:31:45 this field_type_path logic does not seem to be in
shend 2017/04/12 23:41:03 This line should be fine because all it's doing is
Bugs Nash 2017/04/12 23:52:37 The default dict doesn't add field_type_path at al
shend 2017/04/12 23:57:28 Yeah, it doesn't add field_type_path. So if proper
- property_['field_type_path'] = None
- if 'type_name' not in property_:
- property_['type_name'] = 'E' + enum_type_name(property_['name_for_methods'])
+ nonproperties = [defaultdict(lambda: None, item) for item in NONPROPERTIES]
+
+ for property_ in nonproperties:
+ self._apply_property_naming_defaults(property_)
property_values = self._properties.values()
@@ -323,10 +321,10 @@ class ComputedStyleBaseWriter(make_style_builder.StyleBuilderWriter):
# CSS properties are not allowed to explicitly specify their field_size.
property_['field_size'] = None
- self._generated_enums = _create_enums(property_values + NONPROPERTIES)
+ self._generated_enums = _create_enums(property_values + nonproperties)
all_fields = (_create_fields('property', property_values) +
- _create_fields('nonproperty', NONPROPERTIES))
+ _create_fields('nonproperty', nonproperties))
# Separate the normal fields from the bit fields
bit_fields = [field for field in all_fields if field.is_bit_field]
@@ -363,7 +361,7 @@ class ComputedStyleBaseWriter(make_style_builder.StyleBuilderWriter):
for field in bucket:
self._fields.append(field)
- self._include_paths = _get_include_paths(property_values + NONPROPERTIES)
+ self._include_paths = _get_include_paths(property_values + nonproperties)
@template_expander.use_jinja('ComputedStyleBase.h.tmpl')
« no previous file with comments | « no previous file | third_party/WebKit/Source/build/scripts/make_style_builder.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698