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

Side by Side Diff: third_party/WebKit/Source/build/scripts/make_computed_style_base.py

Issue 2889353002: Generate diffs for properties that are generated in ComputedStyle (Closed)
Patch Set: alancutter@ 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 unified diff | Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/css/ComputedStyleDiffFunctions.json5 » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright 2016 The Chromium Authors. All rights reserved. 2 # Copyright 2016 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 import math 6 import math
7 import sys 7 import sys
8 8
9 import json5_generator 9 import json5_generator
10 import template_expander 10 import template_expander
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 return field_dependencies 200 return field_dependencies
201 201
202 202
203 def _create_diff_groups(fields_to_diff, methods_to_diff, root_group): 203 def _create_diff_groups(fields_to_diff, methods_to_diff, root_group):
204 diff_group = DiffGroup(root_group.member_name) 204 diff_group = DiffGroup(root_group.member_name)
205 field_dependencies = _list_field_dependencies(methods_to_diff) 205 field_dependencies = _list_field_dependencies(methods_to_diff)
206 for subgroup in root_group.subgroups: 206 for subgroup in root_group.subgroups:
207 if any(field.property_name in (fields_to_diff + field_dependencies) for field in subgroup.all_fields): 207 if any(field.property_name in (fields_to_diff + field_dependencies) for field in subgroup.all_fields):
208 diff_group.subgroups.append(_create_diff_groups(fields_to_diff, meth ods_to_diff, subgroup)) 208 diff_group.subgroups.append(_create_diff_groups(fields_to_diff, meth ods_to_diff, subgroup))
209 for field in root_group.fields: 209 for field in root_group.fields:
210 if field.property_name in fields_to_diff: 210 if not field.is_inherited_flag:
211 diff_group.expressions.append(field.getter_expression) 211 if field.property_name in fields_to_diff:
212 for entry in methods_to_diff: 212 diff_group.expressions.append(field.getter_expression)
213 if field.property_name in entry['field_dependencies']: 213 for entry in methods_to_diff:
214 diff_group.expressions.append(entry['method']) 214 if field.property_name in entry['field_dependencies']:
215 diff_group.expressions.append(entry['method'])
215 return diff_group 216 return diff_group
216 217
217 218
218 def _create_enums(properties): 219 def _create_enums(properties):
219 """ 220 """
220 Returns an OrderedDict of enums to be generated, enum name -> [list of enum values] 221 Returns an OrderedDict of enums to be generated, enum name -> [list of enum values]
221 """ 222 """
222 enums = {} 223 enums = {}
223 for property_ in properties: 224 for property_ in properties:
224 # Only generate enums for keyword properties that use the default field_ type_path. 225 # Only generate enums for keyword properties that use the default field_ type_path.
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
442 443
443 @template_expander.use_jinja('ComputedStyleBaseConstants.h.tmpl') 444 @template_expander.use_jinja('ComputedStyleBaseConstants.h.tmpl')
444 def generate_base_computed_style_constants(self): 445 def generate_base_computed_style_constants(self):
445 return { 446 return {
446 'properties': self._properties, 447 'properties': self._properties,
447 'enums': self._generated_enums, 448 'enums': self._generated_enums,
448 } 449 }
449 450
450 if __name__ == '__main__': 451 if __name__ == '__main__':
451 json5_generator.Maker(ComputedStyleBaseWriter).main() 452 json5_generator.Maker(ComputedStyleBaseWriter).main()
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/css/ComputedStyleDiffFunctions.json5 » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698