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) eventually resets back
to no-overhang state</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(0, 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 position. |
24 if (document.body.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 return; |
28 } | 28 } |
29 | 29 |
30 document.getElementById('box').style.background = 'green'; | 30 document.getElementById('box').style.background = 'green'; |
31 // Wait for the timer to restore the position. | 31 // Wait for the timer to restore the position. |
32 testRunner.waitUntilDone(); | 32 testRunner.waitUntilDone(); |
33 var startedScrolling = false; | 33 var startedScrolling = false; |
34 window.onscroll = function() { | 34 window.onscroll = function() { |
35 if (document.body.scrollTop == 0) { | 35 if (document.documentElement.scrollTop == 0) { |
36 testRunner.notifyDone(); | 36 testRunner.notifyDone(); |
37 } | 37 } |
38 }; | 38 }; |
39 } | 39 } |
40 </script> | 40 </script> |
41 </body> | 41 </body> |
42 </html> | 42 </html> |
OLD | NEW |