Skip to content

Commit 77b39c3

Browse files
authored
1 parent e07b5f3 commit 77b39c3

14 files changed

Lines changed: 654 additions & 0 deletions
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
<!DOCTYPE html>
2+
<meta charset="utf-8">
3+
<title>An absolutely positioned box is still relaid out after a scrollable descendant gains a scrollbar, in vertical-lr</title>
4+
<link rel="help" href="https://drafts.csswg.org/css-overflow-3/#scrollbar-sizing">
5+
<style>
6+
/* Avoid auto scrollbars on the viewport, because that might trigger re-layout
7+
(and thus hide bugs). */
8+
body { overflow: hidden; }
9+
10+
/* Always-on scrollbars, so that the scrollbar below really does consume space and
11+
change #scroller's content box. */
12+
#scroller::-webkit-scrollbar { width: 15px; height: 15px; }
13+
14+
/* Same structure as abspos-relayout-with-scrollable-descendant.html, but in
15+
vertical-lr, so the axes swap: it is a vertical scrollbar that consumes the flex
16+
container's block-axis space, and the flex container's block size is its width.
17+
18+
The wrapper needs a definite block size of its own. It is orthogonal to the body,
19+
so with an indefinite one it would be sized from its contents and would absorb the
20+
scrollbar change before #flexContainer could. */
21+
#wrapper { writing-mode: vertical-lr; height: 800px; }
22+
23+
#positionedInline { position: relative; }
24+
25+
#inlineBlock { display: inline-block; height: 600px; vertical-align: top; }
26+
27+
#flexContainer { display: flex; height: 500px; }
28+
29+
#flexItem { flex: 0 0 auto; height: 100px; width: 30px; }
30+
31+
#positionedFlexItem { position: relative; flex: 1 1 auto; }
32+
33+
#scroller { position: absolute; top: 0; left: 0; height: 100%; width: 60px; overflow-y: auto; overflow-x: hidden; }
34+
#overflowingContent { height: 300px; width: 20px; }
35+
36+
#targetContainingBlock { display: inline-block; position: relative; height: 300px; width: 120px; vertical-align: top; }
37+
#target { position: absolute; top: 0; left: 0; height: 100px; width: 20px; }
38+
</style>
39+
40+
<div id="wrapper"><span id="positionedInline"><span id="inlineBlock"><div id="flexContainer"><div id="flexItem"></div><div id="positionedFlexItem"><div id="scroller"><div id="overflowingContent"></div></div></div></div></span><span id="targetContainingBlock"><div id="target"></div></span></span></div>
41+
42+
<script src="/resources/testharness.js"></script>
43+
<script src="/resources/testharnessreport.js"></script>
44+
<script>
45+
// #positionedFlexItem is 400px along the flex axis to begin with, so #scroller is
46+
// 400px and its 300px of content does not overflow.
47+
document.body.offsetHeight;
48+
49+
// Growing #flexItem shrinks #positionedFlexItem, and therefore #scroller, to 50px.
50+
// The 300px of content now overflows, so a vertical scrollbar appears while
51+
// #flexContainer is being laid out.
52+
flexItem.style.height = "450px";
53+
document.body.offsetHeight;
54+
55+
test(() => {
56+
assert_greater_than(scroller.offsetWidth - scroller.clientWidth, 0,
57+
"a vertical scrollbar should consume block-axis space in vertical-lr");
58+
}, "A vertical scrollbar appears inside the flex container during its layout");
59+
60+
test(() => {
61+
target.style.width = "80px";
62+
assert_equals(target.offsetWidth, 80);
63+
}, "An out-of-flow box under the same positioned inline is relaid out after the scrollbar change");
64+
</script>
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
<!DOCTYPE html>
2+
<meta charset="utf-8">
3+
<title>An absolutely positioned box is still relaid out after a scrollable descendant gains a scrollbar</title>
4+
<link rel="help" href="https://drafts.csswg.org/css-overflow-3/#scrollbar-sizing">
5+
<style>
6+
/* Avoid auto scrollbars on the viewport, because that might trigger re-layout
7+
(and thus hide bugs). */
8+
body { overflow: hidden; }
9+
10+
/* Always-on scrollbars, so that the scrollbar below really does consume space and
11+
change #scroller's content box. */
12+
#scroller::-webkit-scrollbar { width: 15px; height: 15px; }
13+
14+
/* A relatively positioned inline. It is both the parent of #inlineBlock and the
15+
containing block of #target, so the two branches below meet at this inline. */
16+
#positionedInline { position: relative; }
17+
18+
/* Inline-level, so that #positionedInline is its actual parent rather than an
19+
anonymous block. Fixed inline size, so its own size does not depend on its
20+
contents. */
21+
#inlineBlock { display: inline-block; width: 600px; vertical-align: top; }
22+
23+
/* Block-level flex container with an auto block size, so its size depends on its
24+
contents and a scrollbar appearing inside it can change that size. */
25+
#flexContainer { display: flex; width: 500px; }
26+
27+
/* Growing this along the main axis shrinks #positionedFlexItem, and with it
28+
#scroller. */
29+
#flexItem { flex: 0 0 auto; width: 100px; height: 30px; }
30+
31+
#positionedFlexItem { position: relative; flex: 1 1 auto; }
32+
33+
/* Out of flow, and its inline size follows #positionedFlexItem. The scrollbar
34+
therefore appears as a consequence of the flex layout, rather than as a
35+
consequence of a style change on #scroller or its contents. */
36+
#scroller { position: absolute; top: 0; left: 0; width: 100%; height: 60px; overflow-x: auto; overflow-y: hidden; }
37+
#overflowingContent { width: 300px; height: 20px; }
38+
39+
/* #target's containing block, also inline-level under #positionedInline. */
40+
#targetContainingBlock { display: inline-block; position: relative; width: 300px; height: 120px; vertical-align: top; }
41+
#target { position: absolute; top: 0; left: 0; width: 100px; height: 20px; }
42+
</style>
43+
44+
<span id="positionedInline"><span id="inlineBlock"><div id="flexContainer"><div id="flexItem"></div><div id="positionedFlexItem"><div id="scroller"><div id="overflowingContent"></div></div></div></div></span><span id="targetContainingBlock"><div id="target"></div></span></span>
45+
46+
<script src="/resources/testharness.js"></script>
47+
<script src="/resources/testharnessreport.js"></script>
48+
<script>
49+
// #positionedFlexItem is 400px wide to begin with, so #scroller is 400px and its
50+
// 300px of content does not overflow.
51+
document.body.offsetHeight;
52+
53+
// Growing #flexItem shrinks #positionedFlexItem, and therefore #scroller, to 50px.
54+
// The 300px of content now overflows, so a horizontal scrollbar appears while
55+
// #flexContainer is being laid out.
56+
flexItem.style.width = "450px";
57+
document.body.offsetHeight;
58+
59+
test(() => {
60+
assert_greater_than(scroller.offsetHeight - scroller.clientHeight, 0,
61+
"a horizontal scrollbar should consume block-axis space");
62+
}, "A horizontal scrollbar appears inside the flex container during its layout");
63+
64+
test(() => {
65+
target.style.height = "80px";
66+
assert_equals(target.offsetHeight, 80);
67+
}, "An out-of-flow box under the same positioned inline is relaid out after the scrollbar change");
68+
</script>
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<style>
5+
.container {
6+
width: 500px;
7+
outline: 1px solid black;
8+
}
9+
10+
.flex-container {
11+
display:flex;
12+
flex-direction: column;
13+
outline: 1px solid green;
14+
}
15+
16+
.flex-item {
17+
width: 300px;
18+
outline: 1px solid magenta;
19+
}
20+
21+
.content {
22+
overflow-x: scroll;
23+
white-space: pre;
24+
}
25+
26+
.sibling {
27+
width: 100px;
28+
height: 100px;
29+
border: 4px solid blue;
30+
}
31+
</style>
32+
</head>
33+
<body>
34+
<div class=container>
35+
<div class=flex-container>
36+
<div class=flex-item>
37+
<div class=content>PASS if always-on scrollbar does not overlap the blue box below</div>
38+
</div>
39+
</div>
40+
<div class=sibling></div>
41+
</div>
42+
</body>
43+
</html>
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<link rel="match" href="flex-column-container-with-scrollable-descendant-ref.html">
5+
<link rel="help" href="https://drafts.csswg.org/css-overflow-3/#scrollbar-sizing">
6+
<style>
7+
.container {
8+
width: 500px;
9+
outline: 1px solid black;
10+
}
11+
12+
.flex-container {
13+
display:flex;
14+
flex-direction: column;
15+
outline: 1px solid green;
16+
}
17+
18+
.flex-item {
19+
width: 300px;
20+
outline: 1px solid magenta;
21+
}
22+
23+
.content {
24+
overflow: auto;
25+
white-space: pre;
26+
}
27+
28+
.sibling {
29+
width: 100px;
30+
height: 100px;
31+
border: 4px solid blue;
32+
}
33+
</style>
34+
</head>
35+
<body>
36+
<div class=container>
37+
<div class=flex-container>
38+
<div class=flex-item>
39+
<div class=content>PASS if always-on scrollbar does not overlap the blue box below</div>
40+
</div>
41+
</div>
42+
<div class=sibling></div>
43+
</div>
44+
</body>
45+
</html>
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<style>
5+
.container {
6+
width: 500px;
7+
}
8+
.flex-container {
9+
display: flex;
10+
}
11+
.flex-item {
12+
width: 300px;
13+
}
14+
.short-item {
15+
width: 100px;
16+
height: 10px;
17+
background-color: magenta;
18+
}
19+
.scroller {
20+
overflow-x: scroll;
21+
white-space: pre;
22+
}
23+
.sibling {
24+
width: 100px;
25+
height: 100px;
26+
border: 4px solid blue;
27+
}
28+
</style>
29+
</head>
30+
<body>
31+
<div class=container>
32+
<div class=flex-container>
33+
<div class=flex-item>
34+
<div class=scroller>PASS if always-on scrollbar does not overlap the blue box below</div>
35+
</div>
36+
<div class=short-item></div>
37+
</div>
38+
<div class=sibling></div>
39+
</div>
40+
</body>
41+
</html>
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<link rel="match" href="flex-container-multiple-items-with-scrollable-descendant-ref.html">
5+
<link rel="help" href="https://drafts.csswg.org/css-overflow-3/#scrollbar-sizing">
6+
<style>
7+
.container {
8+
width: 500px;
9+
}
10+
.flex-container {
11+
display: flex;
12+
}
13+
.flex-item {
14+
width: 300px;
15+
}
16+
.short-item {
17+
width: 100px;
18+
height: 10px;
19+
background-color: magenta;
20+
}
21+
.scroller {
22+
overflow: auto;
23+
white-space: pre;
24+
}
25+
.sibling {
26+
width: 100px;
27+
height: 100px;
28+
border: 4px solid blue;
29+
}
30+
</style>
31+
</head>
32+
<body>
33+
<div class=container>
34+
<div class=flex-container>
35+
<div class=flex-item>
36+
<div class=scroller>PASS if always-on scrollbar does not overlap the blue box below</div>
37+
</div>
38+
<div class=short-item></div>
39+
</div>
40+
<div class=sibling></div>
41+
</div>
42+
</body>
43+
</html>
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<style>
5+
.container {
6+
width: 500px;
7+
outline: 1px solid black;
8+
}
9+
10+
.flex-container {
11+
display:flex;
12+
outline: 1px solid green;
13+
}
14+
15+
.flex-item {
16+
width: 300px;
17+
outline: 1px solid magenta;
18+
}
19+
20+
.content {
21+
overflow-x: scroll;
22+
white-space: pre;
23+
}
24+
25+
.sibling {
26+
width: 100px;
27+
height: 100px;
28+
border: 4px solid blue;
29+
}
30+
</style>
31+
</head>
32+
<body>
33+
<div class=container>
34+
<div class=flex-container>
35+
<div class=flex-item>
36+
<div class=content>PASS if always-on scrollbar does not overlap the blue box below</div>
37+
</div>
38+
</div>
39+
<div class=sibling></div>
40+
</div>
41+
</body>
42+
</html>
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<link rel="match" href="flex-container-with-scrollable-descendant-ref.html">
5+
<link rel="help" href="https://drafts.csswg.org/css-overflow-3/#scrollbar-sizing">
6+
<style>
7+
.container {
8+
width: 500px;
9+
outline: 1px solid black;
10+
}
11+
12+
.flex-container {
13+
display:flex;
14+
outline: 1px solid green;
15+
}
16+
17+
.flex-item {
18+
width: 300px;
19+
outline: 1px solid magenta;
20+
}
21+
22+
.content {
23+
overflow: auto;
24+
white-space: pre;
25+
}
26+
27+
.sibling {
28+
width: 100px;
29+
height: 100px;
30+
border: 4px solid blue;
31+
}
32+
</style>
33+
</head>
34+
<body>
35+
<div class=container>
36+
<div class=flex-container>
37+
<div class=flex-item>
38+
<div class=content>PASS if always-on scrollbar does not overlap the blue box below</div>
39+
</div>
40+
</div>
41+
<div class=sibling></div>
42+
</div>
43+
</body>
44+
</html>

0 commit comments

Comments
 (0)