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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 | 71 |
72 interface_counts = defaultdict(int) | 72 interface_counts = defaultdict(int) |
73 tags = self._template_context['tags'] | 73 tags = self._template_context['tags'] |
74 for tag in tags: | 74 for tag in tags: |
75 tag['has_js_interface'] = self._has_js_interface(tag) | 75 tag['has_js_interface'] = self._has_js_interface(tag) |
76 tag['js_interface'] = self._js_interface(tag) | 76 tag['js_interface'] = self._js_interface(tag) |
77 tag['interface'] = self._interface(tag) | 77 tag['interface'] = self._interface(tag) |
78 interface_counts[tag['interface']] += 1 | 78 interface_counts[tag['interface']] += 1 |
79 | 79 |
80 for tag in tags: | 80 for tag in tags: |
81 tag['multipleTagNames'] = interface_counts[tag['interface']] > 1 | 81 tag['multipleTagNames'] = (interface_counts[tag['interface']] > 1 or
tag['interface'] == fallback_interface) |
82 | 82 |
83 self._template_context.update({ | 83 self._template_context.update({ |
84 'fallback_interface': fallback_interface, | 84 'fallback_interface': fallback_interface, |
85 'fallback_js_interface': fallback_js_interface, | 85 'fallback_js_interface': fallback_js_interface, |
86 }) | 86 }) |
87 | 87 |
88 @template_expander.use_jinja('ElementFactory.h.tmpl', filters=filters) | 88 @template_expander.use_jinja('ElementFactory.h.tmpl', filters=filters) |
89 def generate_factory_header(self): | 89 def generate_factory_header(self): |
90 return self._template_context | 90 return self._template_context |
91 | 91 |
(...skipping 26 matching lines...) Expand all Loading... |
118 if tag['JSInterfaceName']: | 118 if tag['JSInterfaceName']: |
119 return tag['JSInterfaceName'] | 119 return tag['JSInterfaceName'] |
120 return self._interface(tag) | 120 return self._interface(tag) |
121 | 121 |
122 def _has_js_interface(self, tag): | 122 def _has_js_interface(self, tag): |
123 return not tag['noConstructor'] and self._js_interface(tag) != ('%sEleme
nt' % self.namespace) | 123 return not tag['noConstructor'] and self._js_interface(tag) != ('%sEleme
nt' % self.namespace) |
124 | 124 |
125 | 125 |
126 if __name__ == "__main__": | 126 if __name__ == "__main__": |
127 in_generator.Maker(MakeElementFactoryWriter).main(sys.argv) | 127 in_generator.Maker(MakeElementFactoryWriter).main(sys.argv) |
OLD | NEW |