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 json5_generator | 6 import json5_generator |
| 7 import name_utilities | 7 import name_utilities |
| 8 | 8 |
| 9 | 9 |
| 10 class CSSProperties(json5_generator.Writer): | 10 class CSSProperties(json5_generator.Writer): |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 51 self._properties_including_aliases = properties | 51 self._properties_including_aliases = properties |
| 52 self._properties = {property['property_id']: property for property in pr operties} | 52 self._properties = {property['property_id']: property for property in pr operties} |
| 53 | 53 |
| 54 # The generated code will only work with at most one alias per property | 54 # The generated code will only work with at most one alias per property |
| 55 assert len({property['alias_for'] for property in self._aliases}) == len (self._aliases) | 55 assert len({property['alias_for'] for property in self._aliases}) == len (self._aliases) |
| 56 | 56 |
| 57 for property in self._aliases: | 57 for property in self._aliases: |
| 58 property['property_id'] = name_utilities.enum_for_css_property_alias (property['name']) | 58 property['property_id'] = name_utilities.enum_for_css_property_alias (property['name']) |
| 59 aliased_property = self._properties[name_utilities.enum_for_css_prop erty(property['alias_for'])] | 59 aliased_property = self._properties[name_utilities.enum_for_css_prop erty(property['alias_for'])] |
| 60 property['enum_value'] = aliased_property['enum_value'] + 512 | 60 property['enum_value'] = aliased_property['enum_value'] + 512 |
| 61 self._properties_including_aliases += self._aliases | 61 self._properties_including_aliases += self._aliases |
|
ktyliu
2017/02/08 04:29:38
do you need to access these other variables too?
| |
| 62 | |
| 63 def properties(self): | |
| 64 return self._properties | |
| OLD | NEW |