| <html> |
| <head> |
| <style> |
| .outer { |
| position: relative; |
| margin: 100px; |
| height: 400px; |
| width: 200px; |
| border: 1px solid blue; |
| } |
| |
| #inner { |
| position: absolute; |
| top: 0; |
| left: 0; |
| right: 0; |
| bottom: 0; |
| |
| overflow-x: hidden; |
| overflow-y: auto; |
| } |
| |
| .big { |
| height: 2000px; |
| } |
| </style> |
| |
| <script src="../../resources/js-test-pre.js"></script> |
| <script> |
| |
| function decreaseContentSize() |
| { |
| var content = document.getElementById('content'); |
| content.classList.remove("big"); |
| internals.updateLayoutIgnorePendingStylesheetsAndRunPostLayoutTasks(); |
| |
| var divTarget = document.getElementById('inner'); |
| var divScrollPos = divTarget.scrollTop; |
| if (divScrollPos == 0) |
| testPassed("Re-sizing the content of the scrolled div correctly set a new scroll position."); |
| else |
| testFailed("Re-sizing the content of the scrolled div failed to correctly set a new scroll position. "); |
| |
| testRunner.notifyDone(); |
| } |
| |
| function scrollTest() |
| { |
| var startPosX = 150; |
| var startPosY = 150; |
| eventSender.mouseMoveTo(startPosX, startPosY); |
| eventSender.mouseScrollByWithWheelAndMomentumPhases(0, -1, 'began', 'none'); |
| eventSender.mouseScrollByWithWheelAndMomentumPhases(0, -1, 'changed', 'none'); |
| eventSender.mouseScrollByWithWheelAndMomentumPhases(0, -1, 'changed', 'none'); |
| eventSender.mouseScrollByWithWheelAndMomentumPhases(0, 0, 'ended', 'none'); |
| eventSender.mouseScrollByWithWheelAndMomentumPhases(0, -1, 'none', 'begin'); |
| eventSender.mouseScrollByWithWheelAndMomentumPhases(0, -1, 'none', 'continue'); |
| eventSender.mouseScrollByWithWheelAndMomentumPhases(0, 0, 'none', 'end'); |
| |
| setTimeout(decreaseContentSize, 100); |
| } |
| |
| function setUp() { |
| if (window.eventSender) { |
| testRunner.dumpAsText(); |
| testRunner.waitUntilDone(); |
| |
| setTimeout(scrollTest, 0); |
| } |
| } |
| </script> |
| </head> |
| |
| <body onload="setUp();"> |
| |
| <div class="outer"> |
| <div id="inner"> |
| <div id="content" class="big">This test should be run in the test harness.</div> |
| </div> |
| </div> |
| </body> |
| </html> |
| |