4 <link rel="help" href="http://www.w3.org/TR/DOM-Level-3-Events/#events-WheelEvent">
5 <script src="../../../../resources/js-test-pre.js"></script>
11 var pageScrollPositionBefore;
12 var iFrameScrollPositionBefore;
13 var continueCount = 5;
15 function checkForScroll() {
17 // The IFrame should not have scrolled at all.
18 var pageScrollPositionAfter = document.body.scrollTop;
19 var iFrameScrollPositionAfter = window.frames['target'].document.body.scrollTop;
21 debug("Page before: " + pageScrollPositionBefore + ", IFrame before: " + iFrameScrollPositionBefore);
22 debug("Page after: " + pageScrollPositionAfter + ", IFrame after: " + iFrameScrollPositionAfter);
24 if (iFrameScrollPositionBefore != iFrameScrollPositionAfter)
25 testFailed("IFrame consumed wheel events.");
27 testPassed("IFrame did not receive wheel events.");
29 testRunner.notifyDone();
32 function scrollTest() {
33 // See where our IFrame lives:
34 pageScrollPositionBefore = document.body.scrollTop;
35 iFrameScrollPositionBefore = window.frames['target'].document.body.scrollTop;
37 iframeTarget = document.getElementById('target');
39 // Scroll the #source until we reach the #target.
40 var startPosX = iframeTarget.offsetLeft + 20;
41 var startPosY = iframeTarget.offsetTop - 42; // Slightly more than one wheel scroll away from the IFrame
42 eventSender.mouseMoveTo(startPosX, startPosY); // Make sure we are just outside the iFrame
43 debug("Mouse moved to (" + startPosX + ", " + startPosY + ")");
44 eventSender.mouseScrollByWithWheelAndMomentumPhases(0, -1, 'began', 'none', true);
45 eventSender.mouseScrollByWithWheelAndMomentumPhases(0, -1, 'changed', 'none', true);
46 eventSender.mouseScrollByWithWheelAndMomentumPhases(0, -1, 'changed', 'none', true);
47 eventSender.mouseScrollByWithWheelAndMomentumPhases(0, 0, 'ended', 'none', true);
48 eventSender.mouseScrollByWithWheelAndMomentumPhases(0, -1, 'none', 'begin', true);
49 eventSender.mouseScrollByWithWheelAndMomentumPhases(0, -1, 'none', 'continue', true);
50 eventSender.mouseScrollByWithWheelAndMomentumPhases(0, -1, 'none', 'continue', true);
51 eventSender.mouseScrollByWithWheelAndMomentumPhases(0, -1, 'none', 'continue', true);
52 eventSender.mouseScrollByWithWheelAndMomentumPhases(0, -1, 'none', 'continue', true);
53 eventSender.mouseScrollByWithWheelAndMomentumPhases(0, 0, 'none', 'end', true);
54 setTimeout(checkForScroll, 100);
57 function setupTopLevel() {
59 if (window.eventSender) {
60 testRunner.dumpAsText(true);
61 testRunner.waitUntilDone();
63 setTimeout(scrollTest, 1000);
65 var messageLocation = document.getElementById('parent');
66 var message = document.createElement('div');
67 message.innerHTML = "<p>This test is better run under DumpRenderTree. To manually test it, place the mouse pointer<br/>"
68 + "at the top of the page, and then use the mouse wheel or a two-finger swipe to scroll the<br/>"
69 + "down past the IFrame.<br/><br/>"
70 + "You should not see the row of END labels if this test is successful.</p>";
71 messageLocation.appendChild(message);
76 <div id="parent" style="height: 2000px">
77 <div id="source" style="height: 100px">
78 Put mouse here and flick downwards
80 <iframe id="target" name="target" style="border:solid 1px green; height: 500px; width: 500px;"
82 <div id='notToBeScrolled' style='height: 1000px; width: 1000px;'>
83 TOP TOP TOP TOP TOP TOP TOP TOP TOP TOP TOP TOP TOP TOP<br/><br/>
84 This should still be visible inside the frame after you scroll down
85 <br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/>
86 <br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/>
87 <br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/>
88 This should NOT be visible inside the frame after you scroll down<br/>
90 END END END END END END END END END END END END END
93 onload="setupTopLevel();"
97 <div id="console"></div>
99 description("Tests that iframe doesn't consume wheel events when scroll ");
101 <script src="../../../../resources/js-test-post.js"></script>