| OLD | NEW |
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 # Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 2 # Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 3 # for details. All rights reserved. Use of this source code is governed by a | 3 # for details. All rights reserved. Use of this source code is governed by a |
| 4 # BSD-style license that can be found in the LICENSE file. | 4 # BSD-style license that can be found in the LICENSE file. |
| 5 | 5 |
| 6 """This module provides functionality to generate dart:html event classes.""" | 6 """This module provides functionality to generate dart:html event classes.""" |
| 7 | 7 |
| 8 import logging | 8 import logging |
| 9 import monitored | 9 import monitored |
| 10 | 10 |
| (...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 321 + provider), call_name)), | 321 + provider), call_name)), |
| 322 TYPE=event_type) | 322 TYPE=event_type) |
| 323 | 323 |
| 324 def _GetRawEvents(self, interface): | 324 def _GetRawEvents(self, interface): |
| 325 all_interfaces = ([ interface ] + | 325 all_interfaces = ([ interface ] + |
| 326 self._database.TransitiveSecondaryParents(interface)) | 326 self._database.TransitiveSecondaryParents(interface)) |
| 327 events = set([]) | 327 events = set([]) |
| 328 for super_interface in all_interfaces: | 328 for super_interface in all_interfaces: |
| 329 events = events.union( | 329 events = events.union( |
| 330 set([attr.id for attr in super_interface.attributes | 330 set([attr.id for attr in super_interface.attributes |
| 331 if (attr.type.id == 'EventHandler' | 331 if attr.type.id == 'EventListener'])) |
| 332 or attr.type.id == 'EventListener')])) | |
| 333 return events | 332 return events |
| 334 | 333 |
| 335 def _GetEvents(self, interface, custom_events): | 334 def _GetEvents(self, interface, custom_events): |
| 336 """ Gets a list of all of the events for the specified interface. | 335 """ Gets a list of all of the events for the specified interface. |
| 337 """ | 336 """ |
| 338 html_interface_name = interface.doc_js_name | 337 html_interface_name = interface.doc_js_name |
| 339 | 338 |
| 340 events = self._GetRawEvents(interface) | 339 events = self._GetRawEvents(interface) |
| 341 | 340 |
| 342 if html_interface_name in _html_manual_events: | 341 if html_interface_name in _html_manual_events: |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 403 """ | 402 """ |
| 404 key = '%s.%s' % (html_interface_name, dom_event_name) | 403 key = '%s.%s' % (html_interface_name, dom_event_name) |
| 405 if key in _html_event_types: | 404 if key in _html_event_types: |
| 406 return _html_event_types[key] | 405 return _html_event_types[key] |
| 407 key = '*.%s' % dom_event_name | 406 key = '*.%s' % dom_event_name |
| 408 if key in _html_event_types: | 407 if key in _html_event_types: |
| 409 return _html_event_types[key] | 408 return _html_event_types[key] |
| 410 _logger.warn('Cannot resolve event type for %s.%s' % | 409 _logger.warn('Cannot resolve event type for %s.%s' % |
| 411 (html_interface_name, dom_event_name)) | 410 (html_interface_name, dom_event_name)) |
| 412 return None | 411 return None |
| OLD | NEW |