2 <script src="../../../../resources/js-test.js"></script>
13 margin: 5px 0px 0px 5px;
16 <iframe frameborder=0 id="target" src="resources/event-delegator.html"></iframe>
17 <div id=console></div>
20 var windowScrollOffset = {
24 var frameScrollOffset = {
28 window.scrollTo(windowScrollOffset.x, windowScrollOffset.y);
29 var frameRect = target.getBoundingClientRect();
31 x: frameRect.width / 2,
32 y: frameRect.height / 2
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");
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) {
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, 100);
76 debug("This test requires eventSender");