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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
|
<!doctype html>
<meta charset="utf-8">
<title>CSS Overflow: test scrollbar-gutter: always (classic scrollbars)</title>
<link rel="author" title="Felipe Erias Morandeira" href="mailto:felipeerias@gmail.com"/>
<link rel="help" href="https://www.w3.org/TR/css-overflow-4/#scollbar-gutter-property"/>
<meta name="assert" content="Test scrollbar-gutter: always with custom classic scrollbars">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/css/support/parsing-testcommon.js"></script>
<style>
.container {
scrollbar-gutter: always;
height: 200px;
width: 200px;
margin: 1px;
padding: 0px;
border: none;
background: deepskyblue;
}
.content {
height: 100%;
width: 100%;
background: lightsalmon;
}
/* ensure that we are using classic scrollbars */
.classic {
scrollbar-width: 20px;
scrollbar-color: hsla(0, 0%, 20%, 0.6) hsla(0, 0%, 40%, 0.3);
}
.classic::-webkit-scrollbar {
width: 20px;
height: 20px;
}
.classic::-webkit-scrollbar-track {
background-color: hsla(0, 0%, 40%, 0.4);
}
.classic::-webkit-scrollbar-thumb {
background-color: hsla(0, 0%, 20%, 0.8);
border-radius: 10px;
}
/* writing modes */
.horizontal {
writing-mode: horizontal-tb;
overflow-x: auto;
}
.vertical {
writing-mode: vertical-rl;
overflow-y: auto;
}
/* overflow on the block direction */
.horizontal.auto { overflow-y: auto; }
.horizontal.scroll { overflow-y: scroll; }
.horizontal.visible { overflow: visible; }
.horizontal.hidden { overflow-y: hidden; }
.vertical.auto { overflow-x: auto; }
.vertical.scroll { overflow-x: scroll; }
.vertical.visible { overflow: visible; }
.vertical.hidden { overflow-x: hidden; }
/* Note: not testing with overflow: clip; */
</style>
<script type="text/javascript">
function performTest() {
setup({explicit_done: true});
test(function() {
let container = document.getElementById('container_auto_h');
let content = document.getElementById('content_auto_h');
assert_equals(container.scrollWidth, 180, "visible/auto scrollWidth");
assert_equals(container.clientWidth, 180, "visible/auto clientWidth");
assert_equals(container.clientWidth, content.clientWidth, "visible/auto clientWidth");
assert_not_equals(container.offsetWidth, content.offsetWidth, "visible/auto offsetWidth");
}, "Unexpected layout: overflow auto, scrollbar-gutter always, horizontal-tb");
test(function() {
let container = document.getElementById('container_scroll_h');
let content = document.getElementById('content_scroll_h');
assert_equals(container.scrollWidth, 180, "scroll/auto scrollWidth");
assert_equals(container.clientWidth, 180, "scroll/auto clientWidth");
assert_equals(container.clientWidth, content.clientWidth, "scroll/auto clientWidth");
assert_not_equals(container.offsetWidth, content.offsetWidth, "scroll/auto offsetWidth");
}, "Unexpected layout: overflow scroll, scrollbar-gutter always, horizontal-tb");
test(function() {
let container = document.getElementById('container_visible_h');
let content = document.getElementById('content_visible_h');
assert_equals(container.scrollWidth, 200, "visible/auto scrollWidth");
assert_equals(container.clientWidth, 200, "visible/auto clientWidth");
assert_equals(container.clientWidth, content.clientWidth, "visible/auto clientWidth");
assert_equals(container.offsetWidth, content.offsetWidth, "visible/auto offsetWidth");
}, "Unexpected layout: overflow visible, scrollbar-gutter always, horizontal-tb");
test(function() {
let container = document.getElementById('container_hidden_h');
let content = document.getElementById('content_hidden_h');
assert_equals(container.scrollWidth, 200, "hidden/auto scrollWidth");
assert_equals(container.clientWidth, 200, "hidden/auto clientWidth");
assert_equals(container.clientWidth, content.clientWidth, "hidden/auto clientWidth");
assert_equals(container.offsetWidth, content.offsetWidth, "hidden/auto offsetWidth");
}, "Unexpected layout: overflow hidden, scrollbar-gutter always, horizontal-tb");
test(function() {
let container = document.getElementById('container_auto_v');
let content = document.getElementById('content_auto_v');
assert_equals(container.scrollHeight, 180, "visible/auto scrollHeight");
assert_equals(container.clientHeight, 180, "visible/auto clientHeight");
assert_equals(container.clientHeight, content.clientHeight, "visible/auto clientHeight");
assert_not_equals(container.offsetHeight, content.offsetHeight, "visible/auto offsetHeight");
}, "Unexpected layout: overflow auto, scrollbar-gutter always, vertical-rl");
test(function() {
let container = document.getElementById('container_scroll_v');
let content = document.getElementById('content_scroll_v');
assert_equals(container.scrollHeight, 180, "scroll/auto scrollHeight");
assert_equals(container.clientHeight, 180, "scroll/auto clientHeight");
assert_equals(container.clientHeight, content.clientHeight, "scroll/auto clientHeight");
assert_not_equals(container.offsetHeight, content.offsetHeight, "scroll/auto offsetHeight");
}, "Unexpected layout: overflow scroll, scrollbar-gutter always, vertical-rl");
test(function() {
let container = document.getElementById('container_visible_v');
let content = document.getElementById('content_visible_v');
assert_equals(container.scrollHeight, 200, "visible/auto scrollHeight");
assert_equals(container.clientHeight, 200, "visible/auto clientHeight");
assert_equals(container.clientHeight, content.clientHeight, "visible/auto clientHeight");
assert_equals(container.offsetHeight, content.offsetHeight, "visible/auto offsetHeight");
}, "Unexpected layout: overflow visible, scrollbar-gutter always, vertical-rl");
test(function() {
let container = document.getElementById('container_hidden_v');
let content = document.getElementById('content_hidden_v');
assert_equals(container.scrollHeight, 200, "hidden/auto scrollHeight");
assert_equals(container.clientHeight, 200, "hidden/auto clientHeight");
assert_equals(container.clientHeight, content.clientHeight, "hidden/auto clientHeight");
assert_equals(container.offsetHeight, content.offsetHeight, "hidden/auto offsetHeight");
}, "Unexpected layout: overflow hidden, scrollbar-gutter always, vertical-rl");
done();
}
</script>
<body onload="performTest()">
Test scrollbar-gutter: always, writing-mode: horizontal-tb
<div class="container classic horizontal auto" id="container_auto_h">
<div class="content" id="content_auto_h">overflow-y: auto</div>
</div>
<div class="container classic horizontal scroll" id="container_scroll_h">
<div class="content" id="content_scroll_h">overflow-y: scroll</div>
</div>
<div class="container classic horizontal visible" id="container_visible_h">
<div class="content" id="content_visible_h">overflow: visible</div>
</div>
<div class="container classic horizontal hidden" id="container_hidden_h">
<div class="content" id="content_hidden_h">overflow-y: hidden</div>
</div>
writing-mode: vertical-rl;
<div class="container classic vertical auto" id="container_auto_v">
<div class="content" id="content_auto_v">overflow-x: auto</div>
</div>
<div class="container classic vertical scroll" id="container_scroll_v">
<div class="content" id="content_scroll_v">overflow-x: scroll</div>
</div>
<div class="container classic vertical visible" id="container_visible_v">
<div class="content" id="content_visible_v">overflow: visible</div>
</div>
<div class="container classic vertical hidden" id="container_hidden_v">
<div class="content" id="content_hidden_v">overflow-x: hidden</div>
</div>
</body>
|