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 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
435 # Organise fields into a tree structure where the root group | 435 # Organise fields into a tree structure where the root group |
436 # is ComputedStyleBase. | 436 # is ComputedStyleBase. |
437 self._root_group = _group_fields(all_fields) | 437 self._root_group = _group_fields(all_fields) |
438 self._diff_functions_map = _create_diff_groups_map(json5_generator.Json5
File.load_from_files( | 438 self._diff_functions_map = _create_diff_groups_map(json5_generator.Json5
File.load_from_files( |
439 [json5_file_paths[2]] | 439 [json5_file_paths[2]] |
440 ).name_dictionaries, self._root_group) | 440 ).name_dictionaries, self._root_group) |
441 | 441 |
442 self._include_paths = _get_include_paths(all_properties) | 442 self._include_paths = _get_include_paths(all_properties) |
443 self._outputs = { | 443 self._outputs = { |
444 'ComputedStyleBase.h': self.generate_base_computed_style_h, | 444 'ComputedStyleBase.h': self.generate_base_computed_style_h, |
| 445 'ComputedStyleBase.cpp': self.generate_base_computed_style_cpp, |
445 'ComputedStyleBaseConstants.h': self.generate_base_computed_style_co
nstants, | 446 'ComputedStyleBaseConstants.h': self.generate_base_computed_style_co
nstants, |
446 } | 447 } |
447 | 448 |
448 @template_expander.use_jinja('ComputedStyleBase.h.tmpl', tests={'in': lambda
a, b: a in b}) | 449 @template_expander.use_jinja('ComputedStyleBase.h.tmpl', tests={'in': lambda
a, b: a in b}) |
449 def generate_base_computed_style_h(self): | 450 def generate_base_computed_style_h(self): |
450 return { | 451 return { |
451 'properties': self._properties, | 452 'properties': self._properties, |
452 'enums': self._generated_enums, | 453 'enums': self._generated_enums, |
453 'include_paths': self._include_paths, | 454 'include_paths': self._include_paths, |
454 'computed_style': self._root_group, | 455 'computed_style': self._root_group, |
455 'diff_functions_map': self._diff_functions_map, | 456 'diff_functions_map': self._diff_functions_map, |
456 } | 457 } |
457 | 458 |
| 459 @template_expander.use_jinja('ComputedStyleBase.cpp.tmpl', tests={'in': lamb
da a, b: a in b}) |
| 460 def generate_base_computed_style_cpp(self): |
| 461 return { |
| 462 'properties': self._properties, |
| 463 'enums': self._generated_enums, |
| 464 'include_paths': self._include_paths, |
| 465 'computed_style': self._root_group, |
| 466 'diff_functions_map': self._diff_functions_map, |
| 467 } |
| 468 |
458 @template_expander.use_jinja('ComputedStyleBaseConstants.h.tmpl') | 469 @template_expander.use_jinja('ComputedStyleBaseConstants.h.tmpl') |
459 def generate_base_computed_style_constants(self): | 470 def generate_base_computed_style_constants(self): |
460 return { | 471 return { |
461 'properties': self._properties, | 472 'properties': self._properties, |
462 'enums': self._generated_enums, | 473 'enums': self._generated_enums, |
463 } | 474 } |
464 | 475 |
465 if __name__ == '__main__': | 476 if __name__ == '__main__': |
466 json5_generator.Maker(ComputedStyleBaseWriter).main() | 477 json5_generator.Maker(ComputedStyleBaseWriter).main() |
OLD | NEW |