| 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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 # TODO(shend): Remove these fields and delete the 'storage_only' template. | 52 # TODO(shend): Remove these fields and delete the 'storage_only' template. |
| 53 {'name': 'EmptyState', 'field_template': 'storage_only', 'size': 1, 'default
_value': 'false', | 53 {'name': 'EmptyState', 'field_template': 'storage_only', 'size': 1, 'default
_value': 'false', |
| 54 'type_name': 'bool', 'inherited': False, 'independent': False}, | 54 'type_name': 'bool', 'inherited': False, 'independent': False}, |
| 55 {'name': 'StyleType', 'field_template': 'storage_only', 'size': 6, 'default_
value': '0', | 55 {'name': 'StyleType', 'field_template': 'storage_only', 'size': 6, 'default_
value': '0', |
| 56 'type_name': 'PseudoId', 'inherited': False, 'independent': False}, | 56 'type_name': 'PseudoId', 'inherited': False, 'independent': False}, |
| 57 {'name': 'PseudoBits', 'field_template': 'storage_only', 'size': 8, 'default
_value': 'PseudoIdNone', | 57 {'name': 'PseudoBits', 'field_template': 'storage_only', 'size': 8, 'default
_value': 'PseudoIdNone', |
| 58 'type_name': 'PseudoId', 'inherited': False, 'independent': False}, | 58 'type_name': 'PseudoId', 'inherited': False, 'independent': False}, |
| 59 # True if 'underline solid' is the only text decoration on this element. | 59 # True if 'underline solid' is the only text decoration on this element. |
| 60 {'name': 'HasSimpleUnderline', 'field_template': 'storage_only', 'size': 1,
'default_value': 'false', | 60 {'name': 'HasSimpleUnderline', 'field_template': 'storage_only', 'size': 1,
'default_value': 'false', |
| 61 'type_name': 'bool', 'inherited': True, 'independent': False}, | 61 'type_name': 'bool', 'inherited': True, 'independent': False}, |
| 62 # TODO(shend): vertical align is actually a CSS property, but since we don't
support union fields |
| 63 # which can be either a keyword or Length, this is generated as a nonpropert
y for now. Remove this |
| 64 # once we can support union fields and groups. |
| 65 {'name': 'VerticalAlign', 'field_template': 'storage_only', 'size': 4, 'defa
ult_value': 'EVerticalAlign::kBaseline', |
| 66 'type_name': 'EVerticalAlign', 'inherited': False, 'independent': False}, |
| 62 ] | 67 ] |
| 63 | 68 |
| 64 | 69 |
| 65 class Field(object): | 70 class Field(object): |
| 66 """ | 71 """ |
| 67 The generated ComputedStyle object is made up of a series of Fields. | 72 The generated ComputedStyle object is made up of a series of Fields. |
| 68 Each Field has a name, size, type, etc, and a bunch of attributes to | 73 Each Field has a name, size, type, etc, and a bunch of attributes to |
| 69 determine which methods it will be used in. | 74 determine which methods it will be used in. |
| 70 | 75 |
| 71 A Field also has enough information to use any storage type in C++, such as | 76 A Field also has enough information to use any storage type in C++, such as |
| (...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 367 'mapping': [(enum_value_name(k), enum_for_css_keyword(k)) fo
r k in property_['keywords']], | 372 'mapping': [(enum_value_name(k), enum_for_css_keyword(k)) fo
r k in property_['keywords']], |
| 368 } | 373 } |
| 369 | 374 |
| 370 return { | 375 return { |
| 371 'include_paths': self._include_paths, | 376 'include_paths': self._include_paths, |
| 372 'mappings': mappings, | 377 'mappings': mappings, |
| 373 } | 378 } |
| 374 | 379 |
| 375 if __name__ == '__main__': | 380 if __name__ == '__main__': |
| 376 json5_generator.Maker(ComputedStyleBaseWriter).main() | 381 json5_generator.Maker(ComputedStyleBaseWriter).main() |
| OLD | NEW |