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): |
11 defaults = { | 11 defaults = { |
12 'alias_for': None, | 12 'alias_for': None, |
| 13 'descriptor_only': None, |
13 'runtime_flag': None, | 14 'runtime_flag': None, |
14 'longhands': '', | 15 'longhands': '', |
15 'interpolable': False, | 16 'interpolable': False, |
16 'inherited': False, | 17 'inherited': False, |
17 'font': False, | 18 'font': False, |
18 'svg': False, | 19 'svg': False, |
19 'name_for_methods': None, | 20 'name_for_methods': None, |
20 'use_handlers_for': None, | 21 'use_handlers_for': None, |
21 'getter': None, | 22 'getter': None, |
22 'setter': None, | 23 'setter': None, |
(...skipping 23 matching lines...) Expand all Loading... |
46 'custom_inherit': (True, False), | 47 'custom_inherit': (True, False), |
47 'custom_value': (True, False), | 48 'custom_value': (True, False), |
48 'builder_skip': (True, False), | 49 'builder_skip': (True, False), |
49 'direction_aware': (True, False), | 50 'direction_aware': (True, False), |
50 } | 51 } |
51 | 52 |
52 def __init__(self, file_paths): | 53 def __init__(self, file_paths): |
53 in_generator.Writer.__init__(self, file_paths) | 54 in_generator.Writer.__init__(self, file_paths) |
54 | 55 |
55 properties = self.in_file.name_dictionaries | 56 properties = self.in_file.name_dictionaries |
| 57 self._descriptors = [property for property in properties if property['de
scriptor_only']] |
56 | 58 |
57 self._aliases = [property for property in properties if property['alias_
for']] | 59 self._aliases = [property for property in properties if property['alias_
for']] |
58 properties = [property for property in properties if not property['alias
_for']] | 60 properties = [property for property in properties if not property['alias
_for']] |
59 | 61 |
60 # 0: CSSPropertyInvalid | 62 # 0: CSSPropertyInvalid |
61 # 1: CSSPropertyApplyAtRule | 63 # 1: CSSPropertyApplyAtRule |
62 # 2: CSSPropertyVariable | 64 # 2: CSSPropertyVariable |
63 self._first_enum_value = 3 | 65 self._first_enum_value = 3 |
64 | 66 |
65 # StylePropertyMetadata additionally assumes there are under 1024 proper
ties. | 67 # StylePropertyMetadata additionally assumes there are under 1024 proper
ties. |
(...skipping 10 matching lines...) Expand all Loading... |
76 self._properties = {property['property_id']: property for property in pr
operties} | 78 self._properties = {property['property_id']: property for property in pr
operties} |
77 | 79 |
78 # The generated code will only work with at most one alias per property | 80 # The generated code will only work with at most one alias per property |
79 assert len({property['alias_for'] for property in self._aliases}) == len
(self._aliases) | 81 assert len({property['alias_for'] for property in self._aliases}) == len
(self._aliases) |
80 | 82 |
81 for property in self._aliases: | 83 for property in self._aliases: |
82 property['property_id'] = name_utilities.enum_for_css_property_alias
(property['name']) | 84 property['property_id'] = name_utilities.enum_for_css_property_alias
(property['name']) |
83 aliased_property = self._properties[name_utilities.enum_for_css_prop
erty(property['alias_for'])] | 85 aliased_property = self._properties[name_utilities.enum_for_css_prop
erty(property['alias_for'])] |
84 property['enum_value'] = aliased_property['enum_value'] + 512 | 86 property['enum_value'] = aliased_property['enum_value'] + 512 |
85 self._properties_including_aliases += self._aliases | 87 self._properties_including_aliases += self._aliases |
OLD | NEW |