Skip to content

Commit c6246b7

Browse files
authored
1 parent 77b39c3 commit c6246b7

1 file changed

Lines changed: 89 additions & 0 deletions

File tree

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
<!DOCTYPE html>
2+
<title>CSS Overflow: Scrollable overflow from the contents of a grid container</title>
3+
<link rel="help" href="https://drafts.csswg.org/css-overflow-3/#scrollable">
4+
<link rel="help" href="https://drafts.csswg.org/css-grid-2/#grid-model">
5+
<meta name="assert" content="A grid container whose own overflow is visible propagates the scrollable overflow of its grid items, of their descendants, and of the out-of-flow boxes it is the containing block for, to an ancestor scroller. Fixed positioned boxes do not scroll with the content and so do not contribute.">
6+
<script src="/resources/testharness.js"></script>
7+
<script src="/resources/testharnessreport.js"></script>
8+
<style>
9+
.scroller {
10+
overflow: scroll;
11+
width: 120px;
12+
height: 60px;
13+
}
14+
15+
.grid {
16+
display: grid;
17+
grid-template-columns: 100px;
18+
}
19+
</style>
20+
21+
<div class="scroller" id="wideItem">
22+
<div class="grid">
23+
<div style="width: 400px; height: 20px"></div>
24+
</div>
25+
</div>
26+
27+
<div class="scroller" id="tallItem" style="width: 200px; height: 40px">
28+
<div class="grid" style="grid-template-rows: 30px">
29+
<div style="height: 300px"></div>
30+
</div>
31+
</div>
32+
33+
<div class="scroller" id="wideDescendant">
34+
<div class="grid">
35+
<div style="height: 20px">
36+
<div style="width: 400px; height: 15px"></div>
37+
</div>
38+
</div>
39+
</div>
40+
41+
<div class="scroller" id="relativePositionedItem">
42+
<div class="grid">
43+
<div style="position: relative; left: 200px; width: 50px; height: 20px"></div>
44+
</div>
45+
</div>
46+
47+
<div class="scroller" id="absolutePositionedDescendant">
48+
<div class="grid" style="position: relative">
49+
<div style="height: 20px">
50+
<div style="position: absolute; left: 300px; top: 100px; width: 40px; height: 40px"></div>
51+
</div>
52+
</div>
53+
</div>
54+
55+
<div class="scroller" id="fixedPositionedDescendant">
56+
<div class="grid" style="position: relative">
57+
<div style="height: 20px">
58+
<div style="position: fixed; left: 300px; top: 400px; width: 40px; height: 40px"></div>
59+
</div>
60+
</div>
61+
</div>
62+
63+
<script>
64+
test(() => {
65+
assert_equals(wideItem.scrollWidth, 400);
66+
}, "A grid item wider than its column contributes to the inline scrollable overflow");
67+
68+
test(() => {
69+
assert_equals(tallItem.scrollHeight, 300);
70+
}, "A grid item taller than its row contributes to the block scrollable overflow");
71+
72+
test(() => {
73+
assert_equals(wideDescendant.scrollWidth, 400);
74+
}, "A descendant of a grid item contributes to the inline scrollable overflow");
75+
76+
test(() => {
77+
assert_equals(relativePositionedItem.scrollWidth, 250);
78+
}, "A relatively positioned grid item contributes its offset position");
79+
80+
test(() => {
81+
assert_equals(absolutePositionedDescendant.scrollWidth, 340);
82+
}, "An absolutely positioned box whose containing block is the grid container contributes to the scrollable overflow");
83+
84+
test(() => {
85+
// Compared against clientWidth because the scroller's client width depends on the
86+
// user agent's scrollbar width.
87+
assert_equals(fixedPositionedDescendant.scrollWidth, fixedPositionedDescendant.clientWidth);
88+
}, "A fixed positioned box does not contribute to the scrollable overflow");
89+
</script>

0 commit comments

Comments
 (0)