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 |
11 import make_style_builder | 11 import make_style_builder |
12 | 12 |
13 from name_utilities import camel_case, lower_first, upper_first_letter | 13 from name_utilities import camel_case, lower_first, upper_first_letter |
14 | 14 |
15 | 15 |
16 # Temporary hard-coded list of fields that are not CSS properties. | 16 # Temporary hard-coded list of fields that are not CSS properties. |
17 # Ideally these would be specified in a .in or .json5 file. | 17 # Ideally these would be specified in a .in or .json5 file. |
18 NONPROPERTY_FIELDS = set([ | 18 NONPROPERTY_FIELDS = set([ |
19 # Style can not be shared. | 19 # Style can not be shared. |
20 'unique', | 20 'unique', |
| 21 # Whether this style is affected by these pseudo-classes. |
| 22 'affectedByFocus', |
| 23 'affectedByHover', |
| 24 'affectedByActive', |
| 25 'affectedByDrag', |
21 ]) | 26 ]) |
22 | 27 |
23 | 28 |
24 class Field(object): | 29 class Field(object): |
25 """ | 30 """ |
26 The generated ComputedStyle object is made up of a series of Fields. | 31 The generated ComputedStyle object is made up of a series of Fields. |
27 Each Field has a name, size, type, etc, and a bunch of attributes to | 32 Each Field has a name, size, type, etc, and a bunch of attributes to |
28 determine which methods it will be used in. | 33 determine which methods it will be used in. |
29 | 34 |
30 A Field also has enough information to use any storage type in C++, such as | 35 A Field also has enough information to use any storage type in C++, such as |
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
328 def generate_base_computed_style_constants(self): | 333 def generate_base_computed_style_constants(self): |
329 return { | 334 return { |
330 'properties': self._properties, | 335 'properties': self._properties, |
331 'enums': self._generated_enums, | 336 'enums': self._generated_enums, |
332 'fields': self._fields, | 337 'fields': self._fields, |
333 'expected_total_field_bytes': self._expected_total_field_bytes, | 338 'expected_total_field_bytes': self._expected_total_field_bytes, |
334 } | 339 } |
335 | 340 |
336 if __name__ == '__main__': | 341 if __name__ == '__main__': |
337 json5_generator.Maker(ComputedStyleBaseWriter).main() | 342 json5_generator.Maker(ComputedStyleBaseWriter).main() |
OLD | NEW |