Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <html> | 2 <html> |
| 3 <head><title>Tests that a momentum scroll (i.e. a fling) eventually resets back to no-overhang state</title></head> | 3 <head><title>Tests that a momentum scroll (i.e. a fling) doesn't jump vertically </title></head> |
| 4 <body> | 4 <body> |
| 5 <div id="box" style="height:800px; background: red; border:2px solid black; widt h:100%"></div> | 5 <div id="box" style="height:800px; background: red; border:2px solid black; widt h:100%"></div> |
| 6 <div id="info">This test requires DRT.</div> | 6 <div id="info">This test requires DRT.</div> |
| 7 <script> | 7 <script> |
| 8 if (window.internals) { | 8 if (window.internals) { |
| 9 document.getElementById('info').style.visibility = 'hidden'; | 9 document.getElementById('info').style.visibility = 'hidden'; |
| 10 internals.settings.setMockScrollbarsEnabled(false); | 10 internals.settings.setMockScrollbarsEnabled(false); |
| 11 | 11 |
| 12 eventSender.mouseMoveTo(10, 10); | 12 eventSender.mouseMoveTo(10, 10); |
| 13 eventSender.mouseDragBegin(); | 13 eventSender.mouseDragBegin(); |
| 14 eventSender.mouseDragEnd(); | 14 eventSender.mouseDragEnd(); |
| 15 | 15 |
| 16 // Simulate a momentum scroll following the end of a normal scroll. | 16 // Simulate a momentum scroll following the end of a normal scroll. |
| 17 eventSender.mouseMomentumBegin(); | 17 eventSender.mouseMomentumBegin(); |
| 18 eventSender.mouseMomentumScrollBy(0, 250, false, true); | 18 eventSender.mouseMomentumScrollBy(250, -250, false, true); |
| 19 eventSender.mouseMomentumEnd(); | 19 eventSender.mouseMomentumEnd(); |
| 20 | 20 |
| 21 // The momentum scroll above should have resulted in overflow above the page. | 21 // The momentum scroll above should have resulted in overflow above the page. |
| 22 // Ensure that it has (via scrollTop) and register an onscroll listener to | 22 // Ensure that it has (via scrollTop) and register an onscroll listener to |
| 23 // ensure that the timer restores the position. | 23 // ensure that the timer restores the x position but keeps y unchanged. |
| 24 if (document.documentElement.scrollTop == 0) { | 24 if (document.documentElement.scrollTop == 0) { |
| 25 // FAIL: Above didn't result in overscroll. | 25 // FAIL: Above didn't result in overscroll. |
| 26 document.getElementById('box').style.background = 'blue'; | 26 document.getElementById('box').style.background = 'blue'; |
| 27 return; | 27 } else { |
| 28 document.getElementById('box').style.background = 'green'; | |
| 29 //// Wait for the timer to restore the position. | |
| 30 //testRunner.waitUntilDone(); | |
|
eseidel
2014/05/29 00:12:20
Did you mean to comment out this code?
| |
| 31 //var startedScrolling = false; | |
| 32 //window.onscroll = function() { | |
| 33 // if (document.documentElement.scrollLeft == 0) { | |
| 34 // if (document.documentElement.scrollTop != 250) { | |
| 35 // // FAIL: Horizontal position shouldn't have snapped ba ck. | |
| 36 // documentElement.getElementById('box').style.background = 'gray'; | |
| 37 // } | |
| 38 // testRunner.notifyDone(); | |
| 39 // } | |
| 40 //}; | |
| 28 } | 41 } |
| 29 | |
| 30 document.getElementById('box').style.background = 'green'; | |
| 31 // Wait for the timer to restore the position. | |
| 32 testRunner.waitUntilDone(); | |
| 33 var startedScrolling = false; | |
| 34 window.onscroll = function() { | |
| 35 if (document.documentElement.scrollTop == 0) { | |
| 36 testRunner.notifyDone(); | |
| 37 } | |
| 38 }; | |
| 39 } | 42 } |
| 40 </script> | 43 </script> |
| 41 </body> | 44 </body> |
| 42 </html> | 45 </html> |
| OLD | NEW |