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

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

Issue 21607003: Add Event delegation to Elements and groups of elements. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 4 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 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 # If the provider is declared elsewhere, point to that. 284 # If the provider is declared elsewhere, point to that.
285 redirection = self._GetEventRedirection(interface, html_name, event_type) 285 redirection = self._GetEventRedirection(interface, html_name, event_type)
286 if redirection: 286 if redirection:
287 provider = '%s.%sEvent' % (redirection, html_name) 287 provider = '%s.%sEvent' % (redirection, html_name)
288 else: 288 else:
289 provider = html_name + 'Event' 289 provider = html_name + 'Event'
290 290
291 annotations = self._metadata.GetFormattedMetadata( 291 annotations = self._metadata.GetFormattedMetadata(
292 library_name, interface, annotation_name, ' ') 292 library_name, interface, annotation_name, ' ')
293 293
294 isElement = ('Element' in interface.id and
blois 2013/08/02 20:13:02 Shouldn't all element subclasses get this? Not jus
Emily Fortuna 2013/08/07 23:38:25 Done.
295 'ElementInstance' not in interface.id)
294 members_emitter.Emit( 296 members_emitter.Emit(
295 "\n" 297 "\n"
296 " $(ANNOTATIONS)Stream<$TYPE> get $(NAME) => " 298 " $(ANNOTATIONS)$(ELEM_TYPE)Stream<$TYPE> get $(NAME) => "
297 "$PROVIDER.forTarget(this);\n", 299 "$PROVIDER.for$(ELEM_TYPE)Target(this);\n",
298 ANNOTATIONS=annotations, 300 ANNOTATIONS=annotations,
301 ELEM_TYPE='Element' if isElement else '',
299 NAME=getter_name, 302 NAME=getter_name,
300 PROVIDER=provider, 303 PROVIDER=provider,
301 TYPE=event_type) 304 TYPE=event_type)
302 305
303 def _GetRawEvents(self, interface): 306 def _GetRawEvents(self, interface):
304 all_interfaces = ([ interface ] + 307 all_interfaces = ([ interface ] +
305 self._database.TransitiveSecondaryParents(interface)) 308 self._database.TransitiveSecondaryParents(interface))
306 events = set([]) 309 events = set([])
307 for super_interface in all_interfaces: 310 for super_interface in all_interfaces:
308 events = events.union( 311 events = events.union(
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
381 """ 384 """
382 key = '%s.%s' % (html_interface_name, dom_event_name) 385 key = '%s.%s' % (html_interface_name, dom_event_name)
383 if key in _html_event_types: 386 if key in _html_event_types:
384 return _html_event_types[key] 387 return _html_event_types[key]
385 key = '*.%s' % dom_event_name 388 key = '*.%s' % dom_event_name
386 if key in _html_event_types: 389 if key in _html_event_types:
387 return _html_event_types[key] 390 return _html_event_types[key]
388 _logger.warn('Cannot resolve event type for %s.%s' % 391 _logger.warn('Cannot resolve event type for %s.%s' %
389 (html_interface_name, dom_event_name)) 392 (html_interface_name, dom_event_name))
390 return None 393 return None
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698