Momentum scrolling ends at the wrong place when a scrolling overflow element has...
[WebKit-https.git] / LayoutTests / fast / scrolling / momentum-scroll-with-borders.html
1 <!DOCTYPE html>
2
3 <html>
4 <head>
5     <style>
6         #scrolling {
7             height: 300px;
8             width: 300px;
9             border: 100px solid gray;
10             border-left-width: 0px;
11             border-right-width: 0px;
12             overflow-y: scroll;
13         }
14         
15         .content {
16             height: 1000px;
17             width: 100%;
18             background-image: repeating-linear-gradient(silver, white 200px);
19         }
20     </style>
21     <script>
22         function checkForScroll()
23         {
24             var scroller = document.getElementById("scrolling");
25             var expectedScrollTop = 700;
26             
27             if (scroller.scrollTop == expectedScrollTop)
28                 document.getElementById('result').textContent = "PASS: scrollTop was " + expectedScrollTop;
29             else
30                 document.getElementById('result').textContent = "FAIL: scrollTop was " + scroller.scrollTop;
31
32             testRunner.notifyDone();
33         }
34         
35         function scrollTest()
36         {
37             eventSender.mouseMoveTo(100, 120);
38
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, 0, 'ended', 'none');
43             eventSender.mouseScrollByWithWheelAndMomentumPhases(0, -3, 'none', 'begin');
44             
45             let remainingScrolls = 15;
46             let sendMomentumScroll = function() {
47                 eventSender.mouseScrollByWithWheelAndMomentumPhases(0, -5, 'none', 'continue');
48                 if (!--remainingScrolls) {
49                     eventSender.callAfterScrollingCompletes(checkForScroll);
50                     return;
51                 }
52                 requestAnimationFrame(sendMomentumScroll);
53             }
54             requestAnimationFrame(sendMomentumScroll);
55         }
56
57         function startTest()
58         {
59             if (window.eventSender) {
60                 testRunner.dumpAsText();
61                 testRunner.waitUntilDone();
62
63                 eventSender.monitorWheelEvents();
64                 setTimeout(scrollTest, 0);
65             }
66         }
67         
68         window.addEventListener('load', startTest, false);
69     </script>
70 </head>
71 <body>
72 <div id="scrolling">
73     <div class="content"></div>
74 </div>
75 <div id="result"></div>
76 </body>
77 </html>