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, enum_for
_css_keyword | 13 from name_utilities import camel_case, lower_first, upper_first_letter, enum_for
_css_keyword |
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. | 21 # Whether this style is affected by these pseudo-classes. |
22 'affectedByFocus', | 22 'affectedByFocus', |
23 'affectedByHover', | 23 'affectedByHover', |
24 'affectedByActive', | 24 'affectedByActive', |
25 'affectedByDrag', | 25 'affectedByDrag', |
26 # A non-inherited property references a variable or @apply is used | 26 # A non-inherited property references a variable or @apply is used |
27 'hasVariableReferenceFromNonInheritedProperty', | 27 'hasVariableReferenceFromNonInheritedProperty', |
| 28 # Explicitly inherits a non-inherited property |
| 29 'hasExplicitlyInheritedProperties', |
28 ]) | 30 ]) |
29 | 31 |
30 | 32 |
31 class Field(object): | 33 class Field(object): |
32 """ | 34 """ |
33 The generated ComputedStyle object is made up of a series of Fields. | 35 The generated ComputedStyle object is made up of a series of Fields. |
34 Each Field has a name, size, type, etc, and a bunch of attributes to | 36 Each Field has a name, size, type, etc, and a bunch of attributes to |
35 determine which methods it will be used in. | 37 determine which methods it will be used in. |
36 | 38 |
37 A Field also has enough information to use any storage type in C++, such as | 39 A Field also has enough information to use any storage type in C++, such as |
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
368 'mapping': [('k' + camel_case(k), enum_for_css_keyword(k)) f
or k in property_['keywords']], | 370 'mapping': [('k' + camel_case(k), enum_for_css_keyword(k)) f
or k in property_['keywords']], |
369 } | 371 } |
370 | 372 |
371 return { | 373 return { |
372 'include_paths': self._include_paths, | 374 'include_paths': self._include_paths, |
373 'mappings': mappings, | 375 'mappings': mappings, |
374 } | 376 } |
375 | 377 |
376 if __name__ == '__main__': | 378 if __name__ == '__main__': |
377 json5_generator.Maker(ComputedStyleBaseWriter).main() | 379 json5_generator.Maker(ComputedStyleBaseWriter).main() |
OLD | NEW |