Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5)

Side by Side Diff: tools/dom/scripts/htmleventgenerator.py

Issue 19820007: Fixes for Blink roll. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Minors fixes Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 293
294 members_emitter.Emit( 294 members_emitter.Emit(
295 "\n" 295 "\n"
296 " $(ANNOTATIONS)Stream<$TYPE> get $(NAME) => " 296 " $(ANNOTATIONS)Stream<$TYPE> get $(NAME) => "
297 "$PROVIDER.forTarget(this);\n", 297 "$PROVIDER.forTarget(this);\n",
298 ANNOTATIONS=annotations, 298 ANNOTATIONS=annotations,
299 NAME=getter_name, 299 NAME=getter_name,
300 PROVIDER=provider, 300 PROVIDER=provider,
301 TYPE=event_type) 301 TYPE=event_type)
302 302
303 def _GetRawEvents(self, interface):
304 all_interfaces = ([ interface ] +
305 self._database.TransitiveSecondaryParents(interface))
306 events = set([])
307 for super_interface in all_interfaces:
308 events = events.union(
309 set([attr.id for attr in super_interface.attributes
310 if attr.type.id == 'EventListener']))
311 return events
312
303 def _GetEvents(self, interface, custom_events): 313 def _GetEvents(self, interface, custom_events):
304 """ Gets a list of all of the events for the specified interface. 314 """ Gets a list of all of the events for the specified interface.
305 """ 315 """
306 html_interface_name = interface.doc_js_name 316 html_interface_name = interface.doc_js_name
307 317
308 events = set([attr.id for attr in interface.attributes 318 events = self._GetRawEvents(interface)
309 if attr.type.id == 'EventListener'])
310 319
311 if html_interface_name in _html_manual_events: 320 if html_interface_name in _html_manual_events:
312 events.update(_html_manual_events[html_interface_name]) 321 events.update(_html_manual_events[html_interface_name])
313 322
314 if not events and interface.id not in _html_explicit_event_classes : 323 if not events and interface.id not in _html_explicit_event_classes :
315 return None 324 return None
316 325
317 dom_event_names = set() 326 dom_event_names = set()
318 for event in events: 327 for event in events:
319 dom_name = event[2:] 328 dom_name = event[2:]
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
372 """ 381 """
373 key = '%s.%s' % (html_interface_name, dom_event_name) 382 key = '%s.%s' % (html_interface_name, dom_event_name)
374 if key in _html_event_types: 383 if key in _html_event_types:
375 return _html_event_types[key] 384 return _html_event_types[key]
376 key = '*.%s' % dom_event_name 385 key = '*.%s' % dom_event_name
377 if key in _html_event_types: 386 if key in _html_event_types:
378 return _html_event_types[key] 387 return _html_event_types[key]
379 _logger.warn('Cannot resolve event type for %s.%s' % 388 _logger.warn('Cannot resolve event type for %s.%s' %
380 (html_interface_name, dom_event_name)) 389 (html_interface_name, dom_event_name))
381 return None 390 return None
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698