2 <script src=
"../../../../resources/js-test.js"></script>
15 border:
1px solid black;
21 <iframe id=frame
></iframe>
25 description("Verify that in the absence of any reason to adjust into an iframe, taps are handle in the frame matching the center point of the tap. bug 401504");
29 function nodeName(node
) {
30 var name
= node
.nodeName
;
32 name
+= '#' + node
.id
;
36 document
.addEventListener('click', function(e
) {
38 debug("Received click on " + nodeName(e
.target
));
41 function doTap(name
, x
, y
, expectFrame
) {
43 var e
= document
.elementFromPoint(x
, y
);
44 var onFrame
= e
== frame
;
45 if (onFrame
!= expectFrame
)
46 testFailed("Point-based hit-test returned unexpected element: " + nodeName(e
));
48 eventSender
.gestureTapDown(x
, y
);
49 eventSender
.gestureShowPress(x
, y
);
50 debug("Sending GestureTap " + name
);
52 eventSender
.gestureTap(x
, y
);
53 shouldBe('sawClick', onFrame
? 'false' : 'true');
57 var rect
= frame
.getBoundingClientRect();
59 var midx
= rect
.left
+ rect
.width
/ 2;
60 var midy
= rect
.top
+ rect
.height
/ 2;
61 doTap("on top of iframe", midx
, midy
, true);
62 doTap("above iframe", midx
, rect
.top
- 1, false);
63 doTap("to the left of iframe", rect
.left
- 1, midy
, false);
64 doTap("to the right of iframe", rect
.right
+ 1, midy
, false);
65 doTap("below iframe", midx
, rect
.bottom
+ 1, false);