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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 'use_auto': [True, False], | 44 'use_auto': [True, False], |
45 'custom_all': [True, False], | 45 'custom_all': [True, False], |
46 'custom_initial': [True, False], | 46 'custom_initial': [True, False], |
47 'custom_inherit': [True, False], | 47 'custom_inherit': [True, False], |
48 'custom_value': [True, False], | 48 'custom_value': [True, False], |
49 } | 49 } |
50 defaults = { | 50 defaults = { |
51 'condition': None, | 51 'condition': None, |
52 'apply_type': 'default', | 52 'apply_type': 'default', |
53 'name_for_methods': None, | 53 'name_for_methods': None, |
| 54 'use_handlers_for': None, |
54 # These depend on property name by default | 55 # These depend on property name by default |
55 'type_name': None, | 56 'type_name': None, |
56 'getter': None, | 57 'getter': None, |
57 'setter': None, | 58 'setter': None, |
58 'initial': None, | 59 'initial': None, |
59 # Setting these stops default handlers being generated | 60 # Setting these stops default handlers being generated |
60 # Setting custom_all is the same as setting the other three | 61 # Setting custom_all is the same as setting the other three |
61 'custom_all': False, | 62 'custom_all': False, |
62 'custom_initial': False, | 63 'custom_initial': False, |
63 'custom_inherit': False, | 64 'custom_inherit': False, |
(...skipping 14 matching lines...) Expand all Loading... |
78 self._properties = self.in_file.name_dictionaries | 79 self._properties = self.in_file.name_dictionaries |
79 | 80 |
80 def set_if_none(property, key, value): | 81 def set_if_none(property, key, value): |
81 if property[key] is None: | 82 if property[key] is None: |
82 property[key] = value | 83 property[key] = value |
83 | 84 |
84 for property in self._properties: | 85 for property in self._properties: |
85 cc = self._camelcase_property_name(property["name"]) | 86 cc = self._camelcase_property_name(property["name"]) |
86 property["property_id"] = "CSSProperty" + cc | 87 property["property_id"] = "CSSProperty" + cc |
87 cc = property["name_for_methods"] or cc.replace("Webkit", "") | 88 cc = property["name_for_methods"] or cc.replace("Webkit", "") |
| 89 property["camel_case_name"] = cc |
88 set_if_none(property, "type_name", "E" + cc) | 90 set_if_none(property, "type_name", "E" + cc) |
89 set_if_none(property, "getter", self._lower_first(cc)) | 91 set_if_none(property, "getter", self._lower_first(cc)) |
90 set_if_none(property, "setter", "set" + cc) | 92 set_if_none(property, "setter", "set" + cc) |
91 set_if_none(property, "initial", "initial" + cc) | 93 set_if_none(property, "initial", "initial" + cc) |
92 if property["custom_all"]: | 94 if property["custom_all"]: |
93 property["custom_initial"] = True | 95 property["custom_initial"] = True |
94 property["custom_inherit"] = True | 96 property["custom_inherit"] = True |
95 property["custom_value"] = True | 97 property["custom_value"] = True |
96 | 98 |
97 self._properties = dict((property["property_id"], property) for property
in self._properties) | 99 self._properties = dict((property["property_id"], property) for property
in self._properties) |
(...skipping 25 matching lines...) Expand all Loading... |
123 | 125 |
124 @template_expander.use_jinja("StyleBuilder.cpp.tmpl") | 126 @template_expander.use_jinja("StyleBuilder.cpp.tmpl") |
125 def generate_style_builder(self): | 127 def generate_style_builder(self): |
126 return { | 128 return { |
127 "properties": self._properties, | 129 "properties": self._properties, |
128 } | 130 } |
129 | 131 |
130 | 132 |
131 if __name__ == "__main__": | 133 if __name__ == "__main__": |
132 in_generator.Maker(StyleBuilderWriter).main(sys.argv) | 134 in_generator.Maker(StyleBuilderWriter).main(sys.argv) |
OLD | NEW |