@@ -594,6 +594,7 @@ def FindConversion(idl_type, direction, interface, member):
594
594
#
595
595
# INTERFACE.MEMBER: annotations for member.
596
596
# +TYPE: add annotations only if there are member annotations.
597
+ # -TYPE: add annotations only if there are no member annotations.
597
598
# TYPE: add regardless of member annotations.
598
599
599
600
dart2js_annotations = {
@@ -615,10 +616,26 @@ def FindConversion(idl_type, direction, interface, member):
615
616
'DOMWindow.openDatabase' : "@Creates('Database') @Creates('DatabaseSync')" ,
616
617
617
618
# Cross-frame windows are EventTargets.
618
- 'EventTarget' :
619
- #"@Creates('Null') @Returns('EventTarget|=Object')",
619
+ '-EventTarget' :
620
620
"@Creates('EventTarget|=Object') @Returns('EventTarget|=Object')" ,
621
621
622
+ # To be in callback with the browser-created Event, we had to have called
623
+ # addEventListener on the target, so we avoid
624
+ 'Event.currentTarget' :
625
+ "@Creates('Null') @Returns('EventTarget|=Object')" ,
626
+
627
+ # Only nodes in the DOM bubble and have target !== currentTarget.
628
+ 'Event.target' :
629
+ "@Creates('Node') @Returns('EventTarget|=Object')" ,
630
+
631
+ 'MouseEvent.relatedTarget' :
632
+ "@Creates('Node') @Returns('EventTarget|=Object')" ,
633
+
634
+ # Touch targets are Elements in a Document, or the Document.
635
+ 'Touch.target' :
636
+ "@Creates('Element|Document') @Returns('Element|Document')" ,
637
+
638
+
622
639
'FileReader.result' : "@Creates('String|ArrayBuffer|Null')" ,
623
640
624
641
# 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):
687
704
return ann2 + ' ' + ann1
688
705
return ann1
689
706
707
+ ann2 = dart2js_annotations .get ('-' + idl_type )
708
+ if ann2 :
709
+ return ann2
690
710
ann2 = dart2js_annotations .get (idl_type )
691
711
return ann2
692
712
0 commit comments