summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/css/css-contain/content-visibility/content-visibility-072.html
blob: 9fc8b11ceb280784f2aff19c9006ea35ada56a26 (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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
<!doctype HTML>
<html>
<meta charset="utf8">
<title>Content Visibility: nested forced layouts</title>
<link rel="author" title="Vladimir Levin" href="mailto:vmpstr@chromium.org">
<link rel="help" href="https://drafts.csswg.org/css-contain/#content-visibility">
<meta name="assert" content="nested content-visibility items are all processed when layout is forced">

<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>

<style>
body, html {
  padding: 0;
  margin: 0;
}
.spacer {
  height: 3000px;
}
.target {
  width: 12px;
  height: 34px;

  position: relative;
  left: 5px;
  top: 7px;
}

.auto {
  content-visibility: auto;
}
.hidden {
  content-visibility: hidden;
}
</style>

<div class=spacer></div>
<div class=auto>
  <div class=auto>
    <div class=target id=one></div>
  </div>
</div>

<div class=auto>
  <div class=hidden>
    <div class=target id=two></div>
  </div>
</div>

<div class=hidden>
  <div class=auto>
    <div class=target id=three></div>
  </div>
</div>

<div class=hidden>
  <div class=hidden>
    <div class=target id=four></div>
  </div>
</div>

<div class=hidden>
  <div class=hidden>
    <div class=hidden>
      <div class=hidden>
        <div class=hidden>
          <div class=target id=five></div>
        </div>
      </div>
    </div>
  </div>
</div>

<script>
const ids = ["one", "two", "three", "four", "five"];
for (let i = 0; i < ids.length; ++i) {
  test(() => {
    const r = document.getElementById(ids[i]).getBoundingClientRect();
    assert_equals(r.x, 5, "x");
    assert_equals(r.y, 3007, "y");
    assert_equals(r.width, 12, "width");
    assert_equals(r.height, 34, "y");
  }, `${ids[i]}.getBoundingClientRect(): `);
}
</script>
</html>