| 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 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 342 for property_ in self._properties.values(): | 342 for property_ in self._properties.values(): |
| 343 if property_['field_template'] is not None: | 343 if property_['field_template'] is not None: |
| 344 assert not property_['longhands'], \ | 344 assert not property_['longhands'], \ |
| 345 "Shorthand '{}' cannot have a field_template.".format(proper
ty_['name']) | 345 "Shorthand '{}' cannot have a field_template.".format(proper
ty_['name']) |
| 346 | 346 |
| 347 css_properties = [value for value in self._properties.values() if not va
lue['longhands']] | 347 css_properties = [value for value in self._properties.values() if not va
lue['longhands']] |
| 348 | 348 |
| 349 for property_ in css_properties: | 349 for property_ in css_properties: |
| 350 # All CSS properties that are generated do not have custom compariso
n and copy logic. | 350 # All CSS properties that are generated do not have custom compariso
n and copy logic. |
| 351 property_['has_custom_compare_and_copy'] = False | 351 property_['has_custom_compare_and_copy'] = False |
| 352 # CSS properties are not allowed to explicitly specify their field_s
ize. | |
| 353 property_['field_size'] = None | |
| 354 | 352 |
| 355 # Read extra fields using the parameter specification from the CSS prope
rties file. | 353 # Read extra fields using the parameter specification from the CSS prope
rties file. |
| 356 extra_fields = json5_generator.Json5File.load_from_files( | 354 extra_fields = json5_generator.Json5File.load_from_files( |
| 357 [json5_file_paths[1]], | 355 [json5_file_paths[1]], |
| 358 default_parameters=self.json5_file.parameters | 356 default_parameters=self.json5_file.parameters |
| 359 ).name_dictionaries | 357 ).name_dictionaries |
| 360 | 358 |
| 361 for property_ in extra_fields: | 359 for property_ in extra_fields: |
| 362 make_style_builder.apply_property_naming_defaults(property_) | 360 make_style_builder.apply_property_naming_defaults(property_) |
| 363 | 361 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 402 | 400 |
| 403 @template_expander.use_jinja('ComputedStyleBaseConstants.h.tmpl') | 401 @template_expander.use_jinja('ComputedStyleBaseConstants.h.tmpl') |
| 404 def generate_base_computed_style_constants(self): | 402 def generate_base_computed_style_constants(self): |
| 405 return { | 403 return { |
| 406 'properties': self._properties, | 404 'properties': self._properties, |
| 407 'enums': self._generated_enums, | 405 'enums': self._generated_enums, |
| 408 } | 406 } |
| 409 | 407 |
| 410 if __name__ == '__main__': | 408 if __name__ == '__main__': |
| 411 json5_generator.Maker(ComputedStyleBaseWriter).main() | 409 json5_generator.Maker(ComputedStyleBaseWriter).main() |
| OLD | NEW |