Chromium Code Reviews| 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 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 377 return False | 377 return False |
| 378 | 378 |
| 379 def _IsEventSuppressed(self, interface, event_name, event_type): | 379 def _IsEventSuppressed(self, interface, event_name, event_type): |
| 380 """ Checks if the event should not be emitted. | 380 """ Checks if the event should not be emitted. |
| 381 """ | 381 """ |
| 382 if self._renamer.ShouldSuppressMember(interface, event_name, 'on:'): | 382 if self._renamer.ShouldSuppressMember(interface, event_name, 'on:'): |
| 383 return True | 383 return True |
| 384 | 384 |
| 385 if (interface.doc_js_name == 'Window' or | 385 if (interface.doc_js_name == 'Window' or |
| 386 interface.doc_js_name == 'Element' or | 386 interface.doc_js_name == 'Element' or |
| 387 interface.doc_js_name == 'Document'): | 387 interface.doc_js_name == 'Document' or |
| 388 interface.doc_js_name == 'GlobalEventHandlers'): | |
|
vsm
2014/01/07 18:45:22
There is also WindowEventHandlers now - do we need
| |
| 388 media_interface = self._database.GetInterface('HTMLMediaElement') | 389 media_interface = self._database.GetInterface('HTMLMediaElement') |
| 389 media_events = self._GetEvents(media_interface, []) | 390 media_events = self._GetEvents(media_interface, []) |
| 390 if self._HasEvent(media_events, event_name, event_type): | 391 if self._HasEvent(media_events, event_name, event_type): |
| 391 return True | 392 return True |
| 392 | 393 |
| 393 def _GetEventRedirection(self, interface, event_name, event_type): | 394 def _GetEventRedirection(self, interface, event_name, event_type): |
| 394 """ For events which are declared in one place, but exposed elsewhere, | 395 """ For events which are declared in one place, but exposed elsewhere, |
| 395 this gets the source of the event (where the provider is declared) | 396 this gets the source of the event (where the provider is declared) |
| 396 """ | 397 """ |
| 397 if interface.doc_js_name == 'Window' or interface.doc_js_name == 'Document': | 398 if interface.doc_js_name == 'Window' or interface.doc_js_name == 'Document': |
| 398 element_interface = self._database.GetInterface('Element') | 399 element_interface = self._database.GetInterface('Element') |
| 399 element_events = self._GetEvents(element_interface, []) | 400 element_events = self._GetEvents(element_interface, []) |
| 400 if self._HasEvent(element_events, event_name, event_type): | 401 if self._HasEvent(element_events, event_name, event_type): |
| 401 return 'Element' | 402 return 'Element' |
| 402 return None | 403 return None |
| 403 | 404 |
| 404 def _FindEventInfo(self, html_interface_name, dom_event_name): | 405 def _FindEventInfo(self, html_interface_name, dom_event_name): |
| 405 """ Finds the event info (event name and type). | 406 """ Finds the event info (event name and type). |
| 406 """ | 407 """ |
| 407 key = '%s.%s' % (html_interface_name, dom_event_name) | 408 key = '%s.%s' % (html_interface_name, dom_event_name) |
| 408 if key in _html_event_types: | 409 if key in _html_event_types: |
| 409 return _html_event_types[key] | 410 return _html_event_types[key] |
| 410 key = '*.%s' % dom_event_name | 411 key = '*.%s' % dom_event_name |
| 411 if key in _html_event_types: | 412 if key in _html_event_types: |
| 412 return _html_event_types[key] | 413 return _html_event_types[key] |
| 413 _logger.warn('Cannot resolve event type for %s.%s' % | 414 _logger.warn('Cannot resolve event type for %s.%s' % |
| 414 (html_interface_name, dom_event_name)) | 415 (html_interface_name, dom_event_name)) |
| 415 return None | 416 return None |
| OLD | NEW |