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 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
370 | 370 |
371 all_fields = _create_fields(all_properties) | 371 all_fields = _create_fields(all_properties) |
372 | 372 |
373 # Organise fields into a tree structure where the root group | 373 # Organise fields into a tree structure where the root group |
374 # is ComputedStyleBase. | 374 # is ComputedStyleBase. |
375 self._root_group = _group_fields(all_fields) | 375 self._root_group = _group_fields(all_fields) |
376 | 376 |
377 self._include_paths = _get_include_paths(all_properties) | 377 self._include_paths = _get_include_paths(all_properties) |
378 self._outputs = { | 378 self._outputs = { |
379 'ComputedStyleBase.h': self.generate_base_computed_style_h, | 379 'ComputedStyleBase.h': self.generate_base_computed_style_h, |
380 'ComputedStyleBase.cpp': self.generate_base_computed_style_cpp, | |
381 'ComputedStyleBaseConstants.h': self.generate_base_computed_style_co
nstants, | 380 'ComputedStyleBaseConstants.h': self.generate_base_computed_style_co
nstants, |
382 } | 381 } |
383 | 382 |
384 @template_expander.use_jinja('ComputedStyleBase.h.tmpl', tests={'in': lambda
a, b: a in b}) | 383 @template_expander.use_jinja('ComputedStyleBase.h.tmpl', tests={'in': lambda
a, b: a in b}) |
385 def generate_base_computed_style_h(self): | 384 def generate_base_computed_style_h(self): |
386 return { | 385 return { |
387 'properties': self._properties, | 386 'properties': self._properties, |
388 'enums': self._generated_enums, | 387 'enums': self._generated_enums, |
389 'include_paths': self._include_paths, | 388 'include_paths': self._include_paths, |
390 'computed_style': self._root_group, | 389 'computed_style': self._root_group, |
391 } | 390 } |
392 | 391 |
393 @template_expander.use_jinja('ComputedStyleBase.cpp.tmpl', tests={'in': lamb
da a, b: a in b}) | |
394 def generate_base_computed_style_cpp(self): | |
395 return { | |
396 'properties': self._properties, | |
397 'enums': self._generated_enums, | |
398 'computed_style': self._root_group, | |
399 } | |
400 | |
401 @template_expander.use_jinja('ComputedStyleBaseConstants.h.tmpl') | 392 @template_expander.use_jinja('ComputedStyleBaseConstants.h.tmpl') |
402 def generate_base_computed_style_constants(self): | 393 def generate_base_computed_style_constants(self): |
403 return { | 394 return { |
404 'properties': self._properties, | 395 'properties': self._properties, |
405 'enums': self._generated_enums, | 396 'enums': self._generated_enums, |
406 } | 397 } |
407 | 398 |
408 if __name__ == '__main__': | 399 if __name__ == '__main__': |
409 json5_generator.Maker(ComputedStyleBaseWriter).main() | 400 json5_generator.Maker(ComputedStyleBaseWriter).main() |
OLD | NEW |