Scrolling iframe inside scrollable div does not work with trackpad
[WebKit-https.git] / LayoutTests / fast / scrolling / latching / scroll-iframe-in-overflow.html
1 <html>
2 <head>
3     <script src="../../../resources/js-test-pre.js"></script>
4     <style type="text/css">
5     #wrapper {
6         height: 400px;
7         width: 600px;
8         overflow: scroll;
9         background-color: #EEE;
10     }
11
12     iframe {
13         background-color: #CCC;
14         width: 400px;
15         height: 100px;
16         margin-bottom: 1000px;
17     }
18
19     body {
20         margin: 0;
21     }
22     </style>
23     <script>
24     window.jsTestIsAsync = true;
25
26     function checkForScroll() {
27         var iframe = document.getElementById("frame");
28         var wrapper = document.getElementById("wrapper");
29         if (iframe.contentWindow.scrollY && !wrapper.scrollTop)
30             testPassed("The iframe scrolled but the wrapper did not.");
31         else
32             testFailed("The iframe's scroll position is: " + iframe.contentWindow.scrollY + ", and the wrapper's scroll position is: " + wrapper.scrollTop);
33
34         testRunner.notifyDone();
35     }
36
37     function scrollTest() {
38         eventSender.mouseMoveTo(200, 50);
39         eventSender.mouseScrollByWithWheelAndMomentumPhases(0, -1, "began", "none");
40         eventSender.mouseScrollByWithWheelAndMomentumPhases(0, -1, "changed", "none");
41         eventSender.mouseScrollByWithWheelAndMomentumPhases(0, -1, "changed", "none");
42         eventSender.mouseScrollByWithWheelAndMomentumPhases(0, -1, "changed", "none");
43         eventSender.mouseScrollByWithWheelAndMomentumPhases(0, -1, "changed", "none");
44         eventSender.mouseScrollByWithWheelAndMomentumPhases(0, -1, "changed", "none");
45         eventSender.mouseScrollByWithWheelAndMomentumPhases(0, 0, "ended", "none");
46         eventSender.mouseScrollByWithWheelAndMomentumPhases(0, -10, "none", "begin");
47         eventSender.mouseScrollByWithWheelAndMomentumPhases(0, -10, "none", "continue");
48         eventSender.mouseScrollByWithWheelAndMomentumPhases(0, -10, "none", "continue");
49         eventSender.mouseScrollByWithWheelAndMomentumPhases(0, -10, "none", "continue");
50         eventSender.mouseScrollByWithWheelAndMomentumPhases(0, -10, "none", "continue");
51         eventSender.mouseScrollByWithWheelAndMomentumPhases(0, -10, "none", "continue");
52         eventSender.mouseScrollByWithWheelAndMomentumPhases(0, 0, "none", "end");
53         eventSender.callAfterScrollingCompletes(checkForScroll);
54     }
55
56     function setup() {
57         if (window.eventSender) {
58             eventSender.monitorWheelEvents();
59             setTimeout(scrollTest, 0);
60         } else {
61             var message = document.createElement("div");
62             message.innerHTML = "<p>This test is better run under DumpRenderTree. To manually test it, place the mouse pointer<br/>"
63                 + "inside the IFrame, then use a two-finger swipe to scroll the iframe to the bottom (and beyond).<br/>"
64                 + "<br/><br/>"
65                 + "The test passes if the overflow container does not scroll but the iframe scrolls to the bottom.</p>";
66             document.body.appendChild(message);
67         }
68     }
69
70     </script>
71 </head>
72 <body onload="setup()">
73     <div id="wrapper">
74         <iframe id="frame" src="./resources/inner_content.html"></iframe>
75     </div>
76     <script src="../../../resources/js-test-post.js"></script>
77 </body>
78 </html>