Chromium Code Reviews| 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 'runtime_flag': None, | 13 'runtime_flag': None, |
| 14 'longhands': '', | 14 'longhands': '', |
| 15 'interpolable': False, | 15 'interpolable': False, |
| 16 'inherited': False, | 16 'inherited': False, |
| 17 'font': False, | 17 'font': False, |
| 18 'svg': False, | 18 'svg': False, |
| 19 'animation': False, | |
|
Timothy Loh
2016/05/24 05:38:35
I'm not really a fan of having these as arguments
| |
| 20 'transition': False, | |
| 19 'name_for_methods': None, | 21 'name_for_methods': None, |
| 20 'use_handlers_for': None, | 22 'use_handlers_for': None, |
| 21 'getter': None, | 23 'getter': None, |
| 22 'setter': None, | 24 'setter': None, |
| 23 'initial': None, | 25 'initial': None, |
| 24 'type_name': None, | 26 'type_name': None, |
| 25 'converter': None, | 27 'converter': None, |
| 26 'custom_all': False, | 28 'custom_all': False, |
| 27 'custom_initial': False, | 29 'custom_initial': False, |
| 28 'custom_inherit': False, | 30 'custom_inherit': False, |
| 29 'custom_value': False, | 31 'custom_value': False, |
| 30 'builder_skip': False, | 32 'builder_skip': False, |
| 31 'direction_aware': False, | 33 'direction_aware': False, |
| 32 # Typed OM annotations. | 34 # Typed OM annotations. |
| 33 'typedom_types': [], | 35 'typedom_types': [], |
| 34 'keywords': [], | 36 'keywords': [], |
| 35 'supports_percentage': False, | 37 'supports_percentage': False, |
| 36 'supports_multiple': False, | 38 'supports_multiple': False, |
| 37 } | 39 } |
| 38 | 40 |
| 39 valid_values = { | 41 valid_values = { |
| 40 'interpolable': (True, False), | 42 'interpolable': (True, False), |
| 41 'inherited': (True, False), | 43 'inherited': (True, False), |
| 42 'font': (True, False), | 44 'font': (True, False), |
| 43 'svg': (True, False), | 45 'svg': (True, False), |
| 46 'animation': (True, False), | |
| 47 'transition': (True, False), | |
| 44 'custom_all': (True, False), | 48 'custom_all': (True, False), |
| 45 'custom_initial': (True, False), | 49 'custom_initial': (True, False), |
| 46 'custom_inherit': (True, False), | 50 'custom_inherit': (True, False), |
| 47 'custom_value': (True, False), | 51 'custom_value': (True, False), |
| 48 'builder_skip': (True, False), | 52 'builder_skip': (True, False), |
| 49 'direction_aware': (True, False), | 53 'direction_aware': (True, False), |
| 50 } | 54 } |
| 51 | 55 |
| 52 def __init__(self, file_paths): | 56 def __init__(self, file_paths): |
| 53 in_generator.Writer.__init__(self, file_paths) | 57 in_generator.Writer.__init__(self, file_paths) |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 76 self._properties = {property['property_id']: property for property in pr operties} | 80 self._properties = {property['property_id']: property for property in pr operties} |
| 77 | 81 |
| 78 # The generated code will only work with at most one alias per property | 82 # 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) | 83 assert len({property['alias_for'] for property in self._aliases}) == len (self._aliases) |
| 80 | 84 |
| 81 for property in self._aliases: | 85 for property in self._aliases: |
| 82 property['property_id'] = name_utilities.enum_for_css_property_alias (property['name']) | 86 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'])] | 87 aliased_property = self._properties[name_utilities.enum_for_css_prop erty(property['alias_for'])] |
| 84 property['enum_value'] = aliased_property['enum_value'] + 512 | 88 property['enum_value'] = aliased_property['enum_value'] + 512 |
| 85 self._properties_including_aliases += self._aliases | 89 self._properties_including_aliases += self._aliases |
| OLD | NEW |