OLD | NEW |
---|---|
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 Loading... | |
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 field.is_property: |
alancutter (OOO until 2018)
2017/05/24 03:31:17
I don't fully understand this. You add field_depen
nainar
2017/05/24 06:07:21
field.is_property is a badly named field that indi
alancutter (OOO until 2018)
2017/05/24 07:25:36
Yes please, that sounds like it would be much bett
nainar
2017/05/24 07:42:14
Done in this patch.
| |
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 Loading... | |
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() |
OLD | NEW |