summaryrefslogtreecommitdiffstats
path: root/gfx/layers/apz/test/reftest/frame-reconstruction-scroll-clamping.html
blob: 479363f3fb244c14c9e912f8eea44e1a8a9773b9 (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
48
49
50
51
52
53
<html class="reftest-wait">
<!--
For bug 1266833; syncing the scroll offset to APZ properly when the scroll
position is clamped to a smaller value during a frame reconstruction.
-->
<script>
    function run() {
        document.body.scrollTop = document.body.scrollTopMax;

        // Let the scroll position propagate to APZ before we do the frame
        // reconstruction. Ideally we would wait for flushApzRepaints here but
        // we don't have access to DOMWindowUtils in a reftest, so we just wait
        // 100ms to approximate it. With bug 1266833 fixed, this test should
        // never fail regardless of what this timeout value is.
        setTimeout(frameReconstruction, 100);
    }

    function frameReconstruction() {
        document.body.classList.toggle('noscroll');
        document.documentElement.classList.toggle('reconstruct-body');
        document.getElementById('spacer').style.height = '100%';
        document.documentElement.classList.remove('reftest-wait');
    }
</script>
<style>
    html, body {
        margin: 0;
        padding: 0;
        background-color: green;
    }

    .noscroll {
        overflow: hidden;
        height: 100%;
    }

    /* Toggling this on and off triggers a frame reconstruction on the <body> */
    html.reconstruct-body::before {
        top: 0;
        content: '';
        display: block;
        height: 2px;
        position: absolute;
        width: 100%;
        z-index: 99;
    }
</style>
<body onload="setTimeout(run, 0)">
 <div id="spacer" style="height: 5000px">
  This is the top of the page.
 </div>
 This is the bottom of the page.
</body>