OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright 2014 The Chromium Authors. All rights reserved. | 2 # Copyright 2014 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 in_generator | 6 import in_generator |
7 import name_utilities | 7 import name_utilities |
8 | 8 |
9 | 9 |
10 class CSSProperties(in_generator.Writer): | 10 class CSSProperties(in_generator.Writer): |
(...skipping 16 matching lines...) Expand all Loading... |
27 'converter': None, | 27 'converter': None, |
28 'custom_all': False, | 28 'custom_all': False, |
29 'custom_initial': False, | 29 'custom_initial': False, |
30 'custom_inherit': False, | 30 'custom_inherit': False, |
31 'custom_value': False, | 31 'custom_value': False, |
32 'builder_skip': False, | 32 'builder_skip': False, |
33 'direction_aware': False, | 33 'direction_aware': False, |
34 # Typed OM annotations. | 34 # Typed OM annotations. |
35 'typedom_types': [], | 35 'typedom_types': [], |
36 'keywords': [], | 36 'keywords': [], |
| 37 'keyword_only': False, |
37 'supports_percentage': False, | 38 'supports_percentage': False, |
38 'supports_multiple': False, | 39 'supports_multiple': False, |
39 } | 40 } |
40 | 41 |
41 valid_values = { | 42 valid_values = { |
42 'interpolable': (True, False), | 43 'interpolable': (True, False), |
43 'inherited': (True, False), | 44 'inherited': (True, False), |
44 'independent': (True, False), | 45 'independent': (True, False), |
45 'font': (True, False), | 46 'font': (True, False), |
46 'svg': (True, False), | 47 'svg': (True, False), |
47 'custom_all': (True, False), | 48 'custom_all': (True, False), |
48 'custom_initial': (True, False), | 49 'custom_initial': (True, False), |
49 'custom_inherit': (True, False), | 50 'custom_inherit': (True, False), |
50 'custom_value': (True, False), | 51 'custom_value': (True, False), |
51 'builder_skip': (True, False), | 52 'builder_skip': (True, False), |
52 'direction_aware': (True, False), | 53 'direction_aware': (True, False), |
| 54 'keyword_only': (True, False), |
53 } | 55 } |
54 | 56 |
55 def __init__(self, file_paths): | 57 def __init__(self, file_paths): |
56 in_generator.Writer.__init__(self, file_paths) | 58 in_generator.Writer.__init__(self, file_paths) |
57 | 59 |
58 properties = self.in_file.name_dictionaries | 60 properties = self.in_file.name_dictionaries |
59 self._descriptors = [property for property in properties if property['de
scriptor_only']] | 61 self._descriptors = [property for property in properties if property['de
scriptor_only']] |
60 | 62 |
61 self._aliases = [property for property in properties if property['alias_
for']] | 63 self._aliases = [property for property in properties if property['alias_
for']] |
62 properties = [property for property in properties if not property['alias
_for']] | 64 properties = [property for property in properties if not property['alias
_for']] |
(...skipping 17 matching lines...) Expand all Loading... |
80 self._properties = {property['property_id']: property for property in pr
operties} | 82 self._properties = {property['property_id']: property for property in pr
operties} |
81 | 83 |
82 # The generated code will only work with at most one alias per property | 84 # The generated code will only work with at most one alias per property |
83 assert len({property['alias_for'] for property in self._aliases}) == len
(self._aliases) | 85 assert len({property['alias_for'] for property in self._aliases}) == len
(self._aliases) |
84 | 86 |
85 for property in self._aliases: | 87 for property in self._aliases: |
86 property['property_id'] = name_utilities.enum_for_css_property_alias
(property['name']) | 88 property['property_id'] = name_utilities.enum_for_css_property_alias
(property['name']) |
87 aliased_property = self._properties[name_utilities.enum_for_css_prop
erty(property['alias_for'])] | 89 aliased_property = self._properties[name_utilities.enum_for_css_prop
erty(property['alias_for'])] |
88 property['enum_value'] = aliased_property['enum_value'] + 512 | 90 property['enum_value'] = aliased_property['enum_value'] + 512 |
89 self._properties_including_aliases += self._aliases | 91 self._properties_including_aliases += self._aliases |
OLD | NEW |