summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/fast/sub-pixel/sub-pixel-iframe-copy-on-scroll.html
blob: ab5528c0263d2d813168ed674f977d14d1376d53 (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
54
55
56
57
58
59
<!DOCTYPE html>
<html>
<head>
<style type="text/css" media="screen">
.subpixelPusher {
    position: relative;
    top: 0.4px;
}
.container {
    display: inline-block;
}
</style>
<script src="../repaint/resources/repaint.js" type="text/javascript"></script>
<script>
if (window.testRunner) {
  testRunner.waitUntilDone();
  internals.settings.setMockScrollbarsEnabled(true);
}

function setupIframes() {
  setupIframe(document.getElementById('iframe1').contentWindow.document);
  setupIframe(document.getElementById('iframe2').contentWindow.document);
  document.getElementById('iframe1').contentWindow.scrollTo(0, 10);
}

function setupIframe(iframe) {
  iframe.open('text/html', 'replace');
  iframe.write("<!DOCTYPE html>\n<html><body style=\"background-color: silver;height: 1000px;\"></body>");
  iframe.close();
}

function repaintTest() {
  document.getElementById('iframe1').contentWindow.scrollTo(0, 0);
  document.getElementById('iframe2').contentWindow.scrollTo(0, 10);
  if (window.testRunner)
    testRunner.notifyDone();
}
</script>
</head>
<body onload="setupIframes();runRepaintTest()">
  <p>The iframes below should remain grey with no repaint artifacts when scrolling.</p>
  <div>
    <div class="container">
      <div class="subpixelPusher">
        <div class="subpixelPusher">
        <iframe id="iframe1"  style="width: 150px; height: 200px;"></iframe>
      </div>
      </div>
    </div>
    <div class="container">
      <div class="subpixelPusher">
        <div class="subpixelPusher">
          <iframe id="iframe2"  style="width: 150px; height: 200px;"></iframe>
        </div>
      </div>
    </div>
  </div>
</body>
</html>