| 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 24 matching lines...) Expand all Loading... |
| 35 # A non-inherited property references a variable or @apply is used | 35 # A non-inherited property references a variable or @apply is used |
| 36 {'name': 'HasVariableReferenceFromNonInheritedProperty', 'field_template': '
monotonic_flag', | 36 {'name': 'HasVariableReferenceFromNonInheritedProperty', 'field_template': '
monotonic_flag', |
| 37 'inherited': False, 'independent': False}, | 37 'inherited': False, 'independent': False}, |
| 38 # Explicitly inherits a non-inherited property | 38 # Explicitly inherits a non-inherited property |
| 39 {'name': 'HasExplicitlyInheritedProperties', 'field_template': 'monotonic_fl
ag', | 39 {'name': 'HasExplicitlyInheritedProperties', 'field_template': 'monotonic_fl
ag', |
| 40 'inherited': False, 'independent': False}, | 40 'inherited': False, 'independent': False}, |
| 41 # These properties only have generated storage, and their methods are handwr
itten in ComputedStyle. | 41 # These properties only have generated storage, and their methods are handwr
itten in ComputedStyle. |
| 42 # TODO(shend): Remove these fields and delete the 'storage_only' template. | 42 # TODO(shend): Remove these fields and delete the 'storage_only' template. |
| 43 {'name': 'EmptyState', 'field_template': 'storage_only', 'size': 1, 'default
_value': 'false', | 43 {'name': 'EmptyState', 'field_template': 'storage_only', 'size': 1, 'default
_value': 'false', |
| 44 'type_name': 'bool', 'inherited': False, 'independent': False}, | 44 'type_name': 'bool', 'inherited': False, 'independent': False}, |
| 45 {'name': 'StyleType', 'field_template': 'storage_only', 'size': 6, 'default_
value': '0', |
| 46 'type_name': 'PseudoId', 'inherited': False, 'independent': False}, |
| 47 {'name': 'PseudoBits', 'field_template': 'storage_only', 'size': 8, 'default
_value': 'PseudoIdNone', |
| 48 'type_name': 'PseudoId', 'inherited': False, 'independent': False}, |
| 45 ] | 49 ] |
| 46 | 50 |
| 47 | 51 |
| 48 class Field(object): | 52 class Field(object): |
| 49 """ | 53 """ |
| 50 The generated ComputedStyle object is made up of a series of Fields. | 54 The generated ComputedStyle object is made up of a series of Fields. |
| 51 Each Field has a name, size, type, etc, and a bunch of attributes to | 55 Each Field has a name, size, type, etc, and a bunch of attributes to |
| 52 determine which methods it will be used in. | 56 determine which methods it will be used in. |
| 53 | 57 |
| 54 A Field also has enough information to use any storage type in C++, such as | 58 A Field also has enough information to use any storage type in C++, such as |
| (...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 351 'mapping': [(enum_value_name(k), enum_for_css_keyword(k)) fo
r k in property_['keywords']], | 355 'mapping': [(enum_value_name(k), enum_for_css_keyword(k)) fo
r k in property_['keywords']], |
| 352 } | 356 } |
| 353 | 357 |
| 354 return { | 358 return { |
| 355 'include_paths': self._include_paths, | 359 'include_paths': self._include_paths, |
| 356 'mappings': mappings, | 360 'mappings': mappings, |
| 357 } | 361 } |
| 358 | 362 |
| 359 if __name__ == '__main__': | 363 if __name__ == '__main__': |
| 360 json5_generator.Maker(ComputedStyleBaseWriter).main() | 364 json5_generator.Maker(ComputedStyleBaseWriter).main() |
| OLD | NEW |