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 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
352 # is ComputedStyleBase. | 352 # is ComputedStyleBase. |
353 self._root_group = _group_fields(all_fields) | 353 self._root_group = _group_fields(all_fields) |
354 | 354 |
355 self._include_paths = _get_include_paths(all_properties) | 355 self._include_paths = _get_include_paths(all_properties) |
356 self._outputs = { | 356 self._outputs = { |
357 'ComputedStyleBase.h': self.generate_base_computed_style_h, | 357 'ComputedStyleBase.h': self.generate_base_computed_style_h, |
358 'ComputedStyleBase.cpp': self.generate_base_computed_style_cpp, | 358 'ComputedStyleBase.cpp': self.generate_base_computed_style_cpp, |
359 'ComputedStyleBaseConstants.h': self.generate_base_computed_style_co
nstants, | 359 'ComputedStyleBaseConstants.h': self.generate_base_computed_style_co
nstants, |
360 } | 360 } |
361 | 361 |
362 @template_expander.use_jinja('ComputedStyleBase.h.tmpl') | 362 @template_expander.use_jinja('ComputedStyleBase.h.tmpl', tests={'in': lambda
a, b: a in b}) |
363 def generate_base_computed_style_h(self): | 363 def generate_base_computed_style_h(self): |
364 return { | 364 return { |
365 'properties': self._properties, | 365 'properties': self._properties, |
366 'enums': self._generated_enums, | 366 'enums': self._generated_enums, |
367 'include_paths': self._include_paths, | 367 'include_paths': self._include_paths, |
368 'computed_style': self._root_group, | 368 'computed_style': self._root_group, |
369 } | 369 } |
370 | 370 |
371 @template_expander.use_jinja('ComputedStyleBase.cpp.tmpl') | 371 @template_expander.use_jinja('ComputedStyleBase.cpp.tmpl', tests={'in': lamb
da a, b: a in b}) |
372 def generate_base_computed_style_cpp(self): | 372 def generate_base_computed_style_cpp(self): |
373 return { | 373 return { |
374 'properties': self._properties, | 374 'properties': self._properties, |
375 'enums': self._generated_enums, | 375 'enums': self._generated_enums, |
376 'computed_style': self._root_group, | 376 'computed_style': self._root_group, |
377 } | 377 } |
378 | 378 |
379 @template_expander.use_jinja('ComputedStyleBaseConstants.h.tmpl') | 379 @template_expander.use_jinja('ComputedStyleBaseConstants.h.tmpl') |
380 def generate_base_computed_style_constants(self): | 380 def generate_base_computed_style_constants(self): |
381 return { | 381 return { |
382 'properties': self._properties, | 382 'properties': self._properties, |
383 'enums': self._generated_enums, | 383 'enums': self._generated_enums, |
384 } | 384 } |
385 | 385 |
386 if __name__ == '__main__': | 386 if __name__ == '__main__': |
387 json5_generator.Maker(ComputedStyleBaseWriter).main() | 387 json5_generator.Maker(ComputedStyleBaseWriter).main() |
OLD | NEW |