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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 | 49 |
50 def set_if_none(property, key, value): | 50 def set_if_none(property, key, value): |
51 if property[key] is None: | 51 if property[key] is None: |
52 property[key] = value | 52 property[key] = value |
53 | 53 |
54 for property in self._properties.values(): | 54 for property in self._properties.values(): |
55 upper_camel = property['upper_camel_name'] | 55 upper_camel = property['upper_camel_name'] |
56 set_if_none(property, 'name_for_methods', upper_camel.replace('Webki
t', '')) | 56 set_if_none(property, 'name_for_methods', upper_camel.replace('Webki
t', '')) |
57 name = property['name_for_methods'] | 57 name = property['name_for_methods'] |
58 set_if_none(property, 'type_name', 'E' + name) | 58 set_if_none(property, 'type_name', 'E' + name) |
59 set_if_none(property, 'getter', lower_first(name)) | 59 set_if_none(property, 'getter', lower_first(name) if property['type_
name'] != name else 'get' + name) |
60 set_if_none(property, 'setter', 'set' + name) | 60 set_if_none(property, 'setter', 'set' + name) |
61 set_if_none(property, 'initial', 'initial' + name) | 61 set_if_none(property, 'initial', 'initial' + name) |
62 if property['custom_all']: | 62 if property['custom_all']: |
63 property['custom_initial'] = True | 63 property['custom_initial'] = True |
64 property['custom_inherit'] = True | 64 property['custom_inherit'] = True |
65 property['custom_value'] = True | 65 property['custom_value'] = True |
66 property['should_declare_functions'] = not property['use_handlers_fo
r'] and not property['longhands'] \ | 66 property['should_declare_functions'] = not property['use_handlers_fo
r'] and not property['longhands'] \ |
67 and not property['direction_a
ware'] and not property['builder_skip'] | 67 and not property['direction_a
ware'] and not property['builder_skip'] |
68 | 68 |
69 @template_expander.use_jinja('StyleBuilderFunctions.h.tmpl', | 69 @template_expander.use_jinja('StyleBuilderFunctions.h.tmpl', |
(...skipping 12 matching lines...) Expand all Loading... |
82 | 82 |
83 @template_expander.use_jinja('StyleBuilder.cpp.tmpl', filters=filters) | 83 @template_expander.use_jinja('StyleBuilder.cpp.tmpl', filters=filters) |
84 def generate_style_builder(self): | 84 def generate_style_builder(self): |
85 return { | 85 return { |
86 'properties': self._properties, | 86 'properties': self._properties, |
87 } | 87 } |
88 | 88 |
89 | 89 |
90 if __name__ == '__main__': | 90 if __name__ == '__main__': |
91 in_generator.Maker(StyleBuilderWriter).main(sys.argv) | 91 in_generator.Maker(StyleBuilderWriter).main(sys.argv) |
OLD | NEW |