Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / events / touch / gesture / gesture-tap-frame-scrolled.html
blob126b370ab4d1468955dad104974d60eeae65aad3
1 <!DOCTYPE HTML>
2 <script src="../../../../resources/js-test.js"></script>
3 <style>
4 html, body {
5 margin: 0;
7 body {
8 height: 1000px;
10 #target {
11 width: 50px;
12 height: 50px;
13 margin: 5px 0px 0px 5px;
15 </style>
16 <iframe frameborder=0 id="target" src="resources/event-delegator.html"></iframe>
17 <div id=console></div>
18 <script>
19 var event;
20 var windowScrollOffset = {
21 x: 0,
22 y: 3
24 var frameScrollOffset = {
25 x: 2,
26 y: 7
28 window.scrollTo(windowScrollOffset.x, windowScrollOffset.y);
29 var frameRect = target.getBoundingClientRect();
30 var pointInFrame = {
31 x: frameRect.width / 2,
32 y: frameRect.height / 2
34 var pointInWindow = {
35 x: frameRect.left + pointInFrame.x,
36 y: frameRect.top + pointInFrame.y
39 var eventReceived = {};
41 function onEventInFrame(e) {
42 debug("Received " + e.type + " in child frame");
43 event = e;
44 eventReceived[e.type] = true;
45 shouldBe("event.screenX", "pointInWindow.x");
46 shouldBe("event.screenY", "pointInWindow.y");
47 shouldBe("event.clientX", "pointInFrame.x");
48 shouldBe("event.clientY", "pointInFrame.y");
49 shouldBe("event.pageX", "pointInFrame.x + frameScrollOffset.x");
50 shouldBe("event.pageY", "pointInFrame.y + frameScrollOffset.y");
53 description("Verifies that a tap occuring in a scrolled iframe has the correct co-ordinates");
55 if (window.eventSender) {
56 jsTestIsAsync = true;
57 target.onload = function() {
58 target.contentWindow.scrollTo(frameScrollOffset.x, frameScrollOffset.y);
60 debug("Sending GestureTapDown to " + pointInWindow.x + "," + pointInWindow.y);
61 eventSender.gestureTapDown(pointInWindow.x, pointInWindow.y);
63 debug("Sending GestureShowPress");
64 eventSender.gestureShowPress(pointInWindow.x, pointInWindow.y);
66 debug("Sending GestureTap");
67 eventSender.gestureTap(pointInWindow.x, pointInWindow.y);
69 shouldBeTrue("eventReceived.mousemove");
70 shouldBeTrue("eventReceived.mousedown");
71 shouldBeTrue("eventReceived.mouseup");
72 shouldBeTrue("eventReceived.click");
73 setTimeout(finishJSTest, 0);
75 } else {
76 debug("This test requires eventSender");
78 </script>