summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/fast/scroll-behavior/smooth-scroll/track-scroll.html
blob: 1b90c01a0257329f1e9f909dcc6b3e08f63c8c19 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<!DOCTYPE html>
<script src="../../../resources/js-test.js"></script>
<style>
body {
    height: 1800px;
}
</style>
<body>
<script>
window.jsTestIsAsync = true;

description("This test scrolls by clicking in the scrollbar track.");

// Compute ScrollableArea::pageStep.
var pageStep = innerHeight * 0.875;
if (navigator.userAgent.indexOf("Mac OS X") >= 0)
    pageStep = Math.max(pageStep, innerHeight - 40);

onload = function() {
    if (!window.eventSender || !window.internals) {
        finishJSTest();
        return;
    }

    // Turn on smooth scrolling.
    internals.settings.setScrollAnimatorEnabled(true);

    // Click in the vertical scrollbar track, below the thumb.
    eventSender.mouseMoveTo(790, 280);
    eventSender.mouseDown();
    eventSender.mouseUp();

    // A second click should have no effect since we will be under the thumb
    // by the time the animation completes.
    eventSender.mouseDown();
    eventSender.mouseUp();

    shouldBecomeEqual("scrollY", "pageStep", function() {
        requestAnimationFrame(function() {
            // Make sure we stopped here.
            shouldBe("scrollY", "pageStep");
            finishJSTest();
       });
    });
};
</script>
</body>