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

Unified Diff: sdk/lib/html/scripts/generator.py

Issue 11411347: Refine types of EventTarget (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sdk/lib/html/dart2js/html_dart2js.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/html/scripts/generator.py
diff --git a/sdk/lib/html/scripts/generator.py b/sdk/lib/html/scripts/generator.py
index 1ba1bcd576fee9b3c010633cb448b1bcde7989b2..703e14889b8aa802134f6bafabc43720d8cc53d4 100644
--- a/sdk/lib/html/scripts/generator.py
+++ b/sdk/lib/html/scripts/generator.py
@@ -594,6 +594,7 @@ def FindConversion(idl_type, direction, interface, member):
#
# INTERFACE.MEMBER: annotations for member.
# +TYPE: add annotations only if there are member annotations.
+# -TYPE: add annotations only if there are no member annotations.
# TYPE: add regardless of member annotations.
dart2js_annotations = {
@@ -615,10 +616,26 @@ dart2js_annotations = {
'DOMWindow.openDatabase': "@Creates('Database') @Creates('DatabaseSync')",
# Cross-frame windows are EventTargets.
- 'EventTarget':
- #"@Creates('Null') @Returns('EventTarget|=Object')",
+ '-EventTarget':
"@Creates('EventTarget|=Object') @Returns('EventTarget|=Object')",
+ # To be in callback with the browser-created Event, we had to have called
+ # addEventListener on the target, so we avoid
+ 'Event.currentTarget':
+ "@Creates('Null') @Returns('EventTarget|=Object')",
+
+ # Only nodes in the DOM bubble and have target !== currentTarget.
+ 'Event.target':
+ "@Creates('Node') @Returns('EventTarget|=Object')",
+
+ 'MouseEvent.relatedTarget':
+ "@Creates('Node') @Returns('EventTarget|=Object')",
+
+ # Touch targets are Elements in a Document, or the Document.
+ 'Touch.target':
+ "@Creates('Element|Document') @Returns('Element|Document')",
+
+
'FileReader.result': "@Creates('String|ArrayBuffer|Null')",
# Rather than have the result of an IDBRequest as a union over all possible
@@ -687,6 +704,9 @@ def FindAnnotations(idl_type, interface_name, member_name):
return ann2 + ' ' + ann1
return ann1
+ ann2 = dart2js_annotations.get('-' + idl_type)
+ if ann2:
+ return ann2
ann2 = dart2js_annotations.get(idl_type)
return ann2
« no previous file with comments | « sdk/lib/html/dart2js/html_dart2js.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698