OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (C) 2013 Google Inc. All rights reserved. | 2 # Copyright (C) 2013 Google Inc. All rights reserved. |
3 # | 3 # |
4 # Redistribution and use in source and binary forms, with or without | 4 # Redistribution and use in source and binary forms, with or without |
5 # modification, are permitted provided that the following conditions are | 5 # modification, are permitted provided that the following conditions are |
6 # met: | 6 # met: |
7 # | 7 # |
8 # * Redistributions of source code must retain the above copyright | 8 # * Redistributions of source code must retain the above copyright |
9 # notice, this list of conditions and the following disclaimer. | 9 # notice, this list of conditions and the following disclaimer. |
10 # * Redistributions in binary form must reproduce the above | 10 # * Redistributions in binary form must reproduce the above |
(...skipping 20 matching lines...) Expand all Loading... |
31 import sys | 31 import sys |
32 | 32 |
33 import in_generator | 33 import in_generator |
34 import template_expander | 34 import template_expander |
35 | 35 |
36 | 36 |
37 class StyleBuilderWriter(in_generator.Writer): | 37 class StyleBuilderWriter(in_generator.Writer): |
38 class_name = 'StyleBuilder' | 38 class_name = 'StyleBuilder' |
39 | 39 |
40 valid_values = { | 40 valid_values = { |
41 'apply_type': ['default', 'length'], | 41 'svg': [True, False], |
42 'use_none': [True, False], | |
43 'use_intrinsic': [True, False], | |
44 'use_auto': [True, False], | |
45 'custom_all': [True, False], | 42 'custom_all': [True, False], |
46 'custom_initial': [True, False], | 43 'custom_initial': [True, False], |
47 'custom_inherit': [True, False], | 44 'custom_inherit': [True, False], |
48 'custom_value': [True, False], | 45 'custom_value': [True, False], |
49 } | 46 } |
50 defaults = { | 47 defaults = { |
51 'condition': None, | 48 'condition': None, |
52 'apply_type': 'default', | |
53 'name_for_methods': None, | 49 'name_for_methods': None, |
54 'use_handlers_for': None, | 50 'use_handlers_for': None, |
| 51 'svg': False, |
| 52 'converter': None, |
55 # These depend on property name by default | 53 # These depend on property name by default |
56 'type_name': None, | 54 'type_name': None, |
57 'getter': None, | 55 'getter': None, |
58 'setter': None, | 56 'setter': None, |
59 'initial': None, | 57 'initial': None, |
60 # Setting these stops default handlers being generated | 58 # Setting these stops default handlers being generated |
61 # Setting custom_all is the same as setting the other three | 59 # Setting custom_all is the same as setting the other three |
62 'custom_all': False, | 60 'custom_all': False, |
63 'custom_initial': False, | 61 'custom_initial': False, |
64 'custom_inherit': False, | 62 'custom_inherit': False, |
65 'custom_value': False, | 63 'custom_value': False, |
66 # For the length apply type. Will get moved out to StyleBuilderFunctions.cpp.tmp
l | |
67 'use_none': False, | |
68 'use_intrinsic': False, | |
69 'use_auto': False, | |
70 } | 64 } |
71 | 65 |
72 def __init__(self, in_files, enabled_conditions): | 66 def __init__(self, in_files, enabled_conditions): |
73 super(StyleBuilderWriter, self).__init__(in_files, enabled_conditions) | 67 super(StyleBuilderWriter, self).__init__(in_files, enabled_conditions) |
74 self._outputs = {("StyleBuilderFunctions.h"): self.generate_style_builde
r_functions_h, | 68 self._outputs = {("StyleBuilderFunctions.h"): self.generate_style_builde
r_functions_h, |
75 ("StyleBuilderFunctions.cpp"): self.generate_style_buil
der_functions_cpp, | 69 ("StyleBuilderFunctions.cpp"): self.generate_style_buil
der_functions_cpp, |
76 ("StyleBuilder.cpp"): self.generate_style_builder, | 70 ("StyleBuilder.cpp"): self.generate_style_builder, |
77 } | 71 } |
78 | 72 |
79 self._properties = self.in_file.name_dictionaries | 73 self._properties = self.in_file.name_dictionaries |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 | 119 |
126 @template_expander.use_jinja("StyleBuilder.cpp.tmpl") | 120 @template_expander.use_jinja("StyleBuilder.cpp.tmpl") |
127 def generate_style_builder(self): | 121 def generate_style_builder(self): |
128 return { | 122 return { |
129 "properties": self._properties, | 123 "properties": self._properties, |
130 } | 124 } |
131 | 125 |
132 | 126 |
133 if __name__ == "__main__": | 127 if __name__ == "__main__": |
134 in_generator.Maker(StyleBuilderWriter).main(sys.argv) | 128 in_generator.Maker(StyleBuilderWriter).main(sys.argv) |
OLD | NEW |