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

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

Issue 2902433002: Generates predicates to test in diff functions in ComputedStyle (Closed)
Patch Set: alancutter@'s suggestions Created 3 years, 7 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_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 40ad5b910a8eb162ff2f13b452772980feaf8798..d62c9857ed28c8c1cc668df3f8ad544ff0c936e3 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
@@ -25,9 +25,9 @@ from itertools import chain
# TODO(shend): Put alignment sizes into code form, rather than linking to a CL which may disappear.
ALIGNMENT_ORDER = [
'double',
- 'AtomicString', 'RefPtr', 'Persistent', 'Font', 'FillLayer', 'NinePieceImage', 'LayoutUnit' # Aligns like a pointer (can be 32 or 64 bits)
+ 'AtomicString', 'RefPtr', 'Persistent', 'Font', 'FillLayer', 'NinePieceImage', # Aligns like a pointer (can be 32 or 64 bits)
'LengthBox', 'LengthSize', 'Length', 'TextSizeAdjust', 'TabSize', 'float',
- 'StyleColor', 'Color', 'unsigned', 'int',
+ 'StyleColor', 'Color', 'LayoutUnit', 'unsigned', 'int',
'short',
'uint8_t', 'char',
'bool'
@@ -86,6 +86,7 @@ class DiffGroup(object):
self.group_name = group_name
self.subgroups = []
self.expressions = []
+ self.predicates = []
class Field(object):
@@ -192,29 +193,33 @@ def _group_fields(fields):
def _create_diff_groups_map(diff_function_inputs, root_group):
diff_functions_map = {}
for entry in diff_function_inputs:
- diff_functions_map[entry['name']] = _create_diff_groups(entry['fields_to_diff'], entry['methods_to_diff'], root_group)
+ diff_functions_map[entry['name']] = _create_diff_groups(entry['fields_to_diff'],
+ entry['methods_to_diff'], entry['predicates_to_test'], root_group)
return diff_functions_map
-def _list_field_dependencies(methods_to_diff):
+def _list_field_dependencies(entries_with_field_dependencies):
field_dependencies = []
- for entry in methods_to_diff:
+ for entry in entries_with_field_dependencies:
field_dependencies += entry['field_dependencies']
return field_dependencies
-def _create_diff_groups(fields_to_diff, methods_to_diff, root_group):
+def _create_diff_groups(fields_to_diff, methods_to_diff, predicates_to_test, root_group):
diff_group = DiffGroup(root_group.member_name)
- field_dependencies = _list_field_dependencies(methods_to_diff)
+ field_dependencies = _list_field_dependencies(methods_to_diff + predicates_to_test)
for subgroup in root_group.subgroups:
if any(field.property_name in (fields_to_diff + field_dependencies) for field in subgroup.all_fields):
- diff_group.subgroups.append(_create_diff_groups(fields_to_diff, methods_to_diff, subgroup))
+ diff_group.subgroups.append(_create_diff_groups(fields_to_diff, methods_to_diff, predicates_to_test, subgroup))
for field in root_group.fields:
if field.property_name in fields_to_diff:
diff_group.expressions.append(field.getter_expression)
for entry in methods_to_diff:
if field.property_name in entry['field_dependencies']:
diff_group.expressions.append(entry['method'])
+ for entry in predicates_to_test:
+ if field.property_name in entry['field_dependencies']:
+ diff_group.predicates.append(entry['predicate'])
return diff_group

Powered by Google App Engine
This is Rietveld 408576698