summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/compositing/fixed-position-scroll-offset-history-restore.html
blob: 4ed8da5b41852c80772ea2e1a3c3e83e5401840b (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
<!DOCTYPE html>
<html>
<body style="overflow:hidden">
  <div style="height:2000px;"></div>

  <!-- Red div to indicate test failure -->
  <div style="position: absolute; top: 250px; width: 200px; height: 100px; background-color: red;"></div>

  <!-- Green fixed-position, composited div which covers the red div after we scroll -->
  <div style="position: fixed; transform: translateZ(0); top: 50px; width: 200px; height: 100px; background-color: green;"></div>

<script>
if (window.testRunner) {
    testRunner.waitUntilDone();
}

onload = function() {
    if (window.localStorage.stage == 'two') {
        // We went foward and back again.
        // If the scroll position is restored correctly the red div won't be visible.
        delete window.localStorage.stage;
        if (window.testRunner) {
            testRunner.dumpAsTextWithPixelResults();
            testRunner.notifyDone();
        }
    } else {
        window.localStorage.stage = 'two';
        window.scrollTo(0, 200);
        setTimeout(function() {
            window.location.href = 'resources/fixed-position-scroll-offset-history-restore-2.html';
        }, 0);
    }
};
</script>
</body>
</html>