aboutsummaryrefslogtreecommitdiffstats
path: root/tests/wpt/web-platform-tests/css/css-overflow/scrollbar-gutter-001.html
blob: fe1e95482857613cfbcee112c8fbfb7e42b5aaf0 (plain) (blame)
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
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
<!doctype html>
<meta charset="utf-8">
<title>CSS Overflow: test scrollbar-gutter with horizontal left to right content</title>
<link rel="author" title="Felipe Erias Morandeira" href="mailto:felipeerias@igalia.com" />
<link rel="help" href="https://drafts.csswg.org/css-overflow-4/#scrollbar-gutter-property" />
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/css/support/parsing-testcommon.js"></script>
<style>
  .line {
    display: flex;
  }

  .container {
    writing-mode: horizontal-tb;
    direction: ltr;

    height: 200px;
    width: 200px;
    margin: 10px;
    padding: 0px;
    border-width: 0px;
    overflow-x: auto;
    flex: none;
    background: deepskyblue;
  }

  .content {
    width: 100%;
    height: 100%;
    padding: 0px;
    border-width: 0px;
    background: lightsalmon;
  }

  /* scrollbar-gutter
  Note: not testing "stable" because the decision to use overlay scrollbars
  is up to the browser. The "always" keyword takes effect regardless of
  whether classical or overlay scrollbars are being used.*/
  .sg_auto {
    scrollbar-gutter: auto;
  }

  .sg_always {
    scrollbar-gutter: always;
  }

  .sg_always_both {
    scrollbar-gutter: always both;
  }

  .sg_always_force {
    scrollbar-gutter: always force;
  }

  .sg_always_both_force {
    scrollbar-gutter: always both force;
  }

  /* overflow */
  .container.ov_auto {
    overflow-y: auto;
  }

  .container.ov_scroll {
    overflow-y: scroll;
  }

  .container.ov_visible {
    overflow: visible;
  }

  .container.ov_hidden {
    overflow-y: hidden;
  }

  .container.ov_clip {
    overflow-y: clip;
  }
</style>
<body>

  <div class="line">
    <div class="container ov_auto sg_auto" id="container_auto_auto">
      <div class="content" id="content_auto_auto">auto/auto</div>
    </div>

    <div class="container ov_scroll sg_auto" id="container_scroll_auto">
      <div class="content" id="content_scroll_auto">scroll/auto</div>
    </div>

    <div class="container ov_visible sg_auto" id="container_visible_auto">
      <div class="content" id="content_visible_auto">visible/auto</div>
    </div>

    <div class="container ov_hidden sg_auto" id="container_hidden_auto">
      <div class="content" id="content_hidden_auto">hidden/auto</div>
    </div>

    <div class="container ov_clip sg_auto" id="container_clip_auto">
      <div class="content" id="content_clip_auto">clip/auto</div>
    </div>
  </div>

  <div class="line">
    <div class="container ov_auto sg_always" id="container_auto_always">
      <div class="content" id="content_auto_always">auto/always</div>
    </div>

    <div class="container ov_scroll sg_always" id="container_scroll_always">
      <div class="content" id="content_scroll_always">scroll/always</div>
    </div>

    <div class="container ov_visible sg_always" id="container_visible_always">
      <div class="content" id="content_visible_always">visible/always</div>
    </div>

    <div class="container ov_hidden sg_always" id="container_hidden_always">
      <div class="content" id="content_hidden_always">hidden/always</div>
    </div>

    <div class="container ov_clip sg_always" id="container_clip_always">
      <div class="content" id="content_clip_always">clip/always</div>
    </div>
  </div>

  <div class="line">
    <div class="container ov_auto sg_always_force" id="container_auto_always_force">
      <div class="content" id="content_auto_always_force">auto/always force</div>
    </div>

    <div class="container ov_scroll sg_always_force" id="container_scroll_always_force">
      <div class="content" id="content_scroll_always_force">scroll/always force</div>
    </div>

    <div class="container ov_visible sg_always_force" id="container_visible_always_force">
      <div class="content" id="content_visible_always_force">visible/always force</div>
    </div>

    <div class="container ov_hidden sg_always_force" id="container_hidden_always_force">
      <div class="content" id="content_hidden_always_force">hidden/always force</div>
    </div>

    <div class="container ov_clip sg_always_force" id="container_clip_always_force">
      <div class="content" id="content_clip_always_force">clip/always force</div>
    </div>
  </div>

  <div class="line">
    <div class="container ov_auto sg_always_both" id="container_auto_always_both">
      <div class="content" id="content_auto_always_both">auto/always both</div>
    </div>

    <div class="container ov_scroll sg_always_both" id="container_scroll_always_both">
      <div class="content" id="content_scroll_always_both">scroll/always both</div>
    </div>

    <div class="container ov_visible sg_always_both" id="container_visible_always_both">
      <div class="content" id="content_visible_always_both">visible/always both</div>
    </div>

    <div class="container ov_hidden sg_always_both" id="container_hidden_always_both">
      <div class="content" id="content_hidden_always_both">hidden/always both</div>
    </div>

    <div class="container ov_clip sg_always_both" id="container_clip_always_both">
      <div class="content" id="content_clip_always_both">clip/always both</div>
    </div>
  </div>

  <div class="line">
    <div class="container ov_auto sg_always_both_force" id="container_auto_always_both_force">
      <div class="content" id="content_auto_always_both_force">auto/always both force</div>
    </div>

    <div class="container ov_scroll sg_always_both_force" id="container_scroll_always_both_force">
      <div class="content" id="content_scroll_always_both_force">scroll/always both force</div>
    </div>

    <div class="container ov_visible sg_always_both_force" id="container_visible_always_both_force">
      <div class="content" id="content_visible_always_both_force">visible/always both force</div>
    </div>

    <div class="container ov_hidden sg_always_both_force" id="container_hidden_always_both_force">
      <div class="content" id="content_hidden_always_both_force">hidden/always both force</div>
    </div>

    <div class="container ov_clip sg_always_both_force" id="container_clip_always_both_force">
      <div class="content" id="content_clip_always_both_force">clip/always both force</div>
    </div>
  </div>

  <script type="text/javascript">
    setup({ explicit_done: true });

    // scrollbar-gutter: auto

    test(function () {
      let container = document.getElementById('container_auto_auto');
      let content = document.getElementById('content_auto_auto');
      assert_equals(container.offsetWidth, content.offsetWidth, "content width");
      assert_equals(container.offsetLeft, content.offsetLeft, "content position");
    }, "overflow auto, scrollbar-gutter auto");

    test(function () {
      let container = document.getElementById('container_scroll_auto');
      let content = document.getElementById('content_scroll_auto');
      assert_greater_than(container.offsetWidth, content.offsetWidth, "content width");
      assert_equals(container.offsetLeft, content.offsetLeft, "content position");
    }, "overflow scroll, scrollbar-gutter auto");

    test(function () {
      let container = document.getElementById('container_visible_auto');
      let content = document.getElementById('content_visible_auto');
      assert_equals(container.offsetWidth, content.offsetWidth, "content width");
      assert_equals(container.offsetLeft, content.offsetLeft, "content position");
    }, "overflow visible, scrollbar-gutter auto");

    test(function () {
      let container = document.getElementById('container_hidden_auto');
      let content = document.getElementById('content_hidden_auto');
      assert_equals(container.offsetWidth, content.offsetWidth, "content width");
      assert_equals(container.offsetLeft, content.offsetLeft, "content position");
    }, "overflow hidden, scrollbar-gutter auto");

    test(function () {
      let container = document.getElementById('container_clip_auto');
      let content = document.getElementById('content_clip_auto');
      assert_equals(container.offsetWidth, content.offsetWidth, "content width");
      assert_equals(container.offsetLeft, content.offsetLeft, "content position");
    }, "overflow clip, scrollbar-gutter auto");

    // scrollbar-gutter: always

    test(function () {
      let container = document.getElementById('container_auto_always');
      let content = document.getElementById('content_auto_always');
      assert_greater_than(container.offsetWidth, content.offsetWidth, "content width");
      assert_equals(container.offsetLeft, content.offsetLeft, "content position");
    }, "overflow auto, scrollbar-gutter always");

    test(function () {
      let container = document.getElementById('container_scroll_always');
      let content = document.getElementById('content_scroll_always');
      assert_greater_than(container.offsetWidth, content.offsetWidth, "content width");
      assert_equals(container.offsetLeft, content.offsetLeft, "content position");
    }, "overflow scroll, scrollbar-gutter always");

    test(function () {
      let container = document.getElementById('container_visible_always');
      let content = document.getElementById('content_visible_always');
      assert_equals(container.offsetWidth, content.offsetWidth, "content width");
      assert_equals(container.offsetLeft, content.offsetLeft, "content position");
    }, "overflow visible, scrollbar-gutter always");

    test(function () {
      let container = document.getElementById('container_hidden_always');
      let content = document.getElementById('content_hidden_always');
      assert_equals(container.offsetWidth, content.offsetWidth, "content width");
      assert_equals(container.offsetLeft, content.offsetLeft, "content position");
    }, "overflow hidden, scrollbar-gutter always");

    test(function () {
      let container = document.getElementById('container_clip_always');
      let content = document.getElementById('content_clip_always');
      assert_equals(container.offsetWidth, content.offsetWidth, "content width");
      assert_equals(container.offsetLeft, content.offsetLeft, "content position");
    }, "overflow clip, scrollbar-gutter always");

    // scrollbar-gutter: always force

    test(function () {
      let container = document.getElementById('container_auto_always_force');
      let content = document.getElementById('content_auto_always_force');
      assert_greater_than(container.offsetWidth, content.offsetWidth, "content width");
      assert_equals(container.offsetLeft, content.offsetLeft, "content position");
    }, "overflow auto, scrollbar-gutter always force");

    test(function () {
      let container = document.getElementById('container_scroll_always_force');
      let content = document.getElementById('content_scroll_always_force');
      assert_greater_than(container.offsetWidth, content.offsetWidth, "content width");
      assert_equals(container.offsetLeft, content.offsetLeft, "content position");
    }, "overflow scroll, scrollbar-gutter always force");

    test(function () {
      let container = document.getElementById('container_visible_always_force');
      let content = document.getElementById('content_visible_always_force');
      assert_greater_than(container.offsetWidth, content.offsetWidth, "content width");
      assert_equals(container.offsetLeft, content.offsetLeft, "content position");
    }, "overflow visible, scrollbar-gutter always force");

    test(function () {
      let container = document.getElementById('container_hidden_always_force');
      let content = document.getElementById('content_hidden_always_force');
      assert_greater_than(container.offsetWidth, content.offsetWidth, "content width");
      assert_equals(container.offsetLeft, content.offsetLeft, "content position");
    }, "overflow hidden, scrollbar-gutter always force");

    test(function () {
      let container = document.getElementById('container_clip_always_force');
      let content = document.getElementById('content_clip_always_force');
      assert_greater_than(container.offsetWidth, content.offsetWidth, "content width");
      assert_equals(container.offsetLeft, content.offsetLeft, "content position");
    }, "overflow clip, scrollbar-gutter always force");

    // scrollbar-gutter: always both

    test(function () {
      let container = document.getElementById('container_auto_always_both');
      let content = document.getElementById('content_auto_always_both');
      assert_greater_than(container.offsetWidth, content.offsetWidth, "content width");
      assert_less_than(container.offsetLeft, content.offsetLeft, "content position");
      let reference = document.getElementById('content_auto_always');
      assert_less_than(content.offsetWidth, reference.offsetWidth, "compare with \"always\"");
    }, "overflow auto, scrollbar-gutter always both");

    test(function () {
      let container = document.getElementById('container_scroll_always_both');
      let content = document.getElementById('content_scroll_always_both');
      assert_greater_than(container.offsetWidth, content.offsetWidth, "content width");
      assert_less_than(container.offsetLeft, content.offsetLeft, "content position");
      let reference = document.getElementById('content_auto_always');
      assert_less_than(content.offsetWidth, reference.offsetWidth, "compare with \"always\"");
    }, "overflow scroll, scrollbar-gutter always both");

    test(function () {
      let container = document.getElementById('container_visible_always_both');
      let content = document.getElementById('content_visible_always_both');
      assert_equals(container.offsetWidth, content.offsetWidth, "content width");
      assert_equals(container.offsetLeft, content.offsetLeft, "content position");
    }, "overflow visible, scrollbar-gutter always both");

    test(function () {
      let container = document.getElementById('container_hidden_always_both');
      let content = document.getElementById('content_hidden_always_both');
      assert_equals(container.offsetWidth, content.offsetWidth, "content width");
      assert_equals(container.offsetLeft, content.offsetLeft, "content position");
    }, "overflow hidden, scrollbar-gutter always both");

    test(function () {
      let container = document.getElementById('container_clip_always_both');
      let content = document.getElementById('content_clip_always_both');
      assert_equals(container.offsetWidth, content.offsetWidth, "content width");
      assert_equals(container.offsetLeft, content.offsetLeft, "content position");
    }, "overflow clip, scrollbar-gutter always both");

    // scrollbar-gutter: always both force

    test(function () {
      let container = document.getElementById('container_auto_always_both_force');
      let content = document.getElementById('content_auto_always_both_force');
      assert_greater_than(container.offsetWidth, content.offsetWidth, "content width");
      assert_less_than(container.offsetLeft, content.offsetLeft, "content position");
      let reference = document.getElementById('content_auto_always_force');
      assert_less_than(content.offsetWidth, reference.offsetWidth, "compare with \"always force\"");
    }, "overflow auto, scrollbar-gutter always both force");

    test(function () {
      let container = document.getElementById('container_scroll_always_both_force');
      let content = document.getElementById('content_scroll_always_both_force');
      assert_greater_than(container.offsetWidth, content.offsetWidth, "content width");
      assert_less_than(container.offsetLeft, content.offsetLeft, "content position");
      let reference = document.getElementById('content_scroll_always_force');
      assert_less_than(content.offsetWidth, reference.offsetWidth, "compare with \"always force\"");
    }, "overflow scroll, scrollbar-gutter always both force");

    test(function () {
      let container = document.getElementById('container_visible_always_both_force');
      let content = document.getElementById('content_visible_always_both_force');
      assert_greater_than(container.offsetWidth, content.offsetWidth, "content width");
      assert_less_than(container.offsetLeft, content.offsetLeft, "content position");
      let reference = document.getElementById('content_visible_always_force');
      assert_less_than(content.offsetWidth, reference.offsetWidth, "compare with \"always force\"");
    }, "overflow visible, scrollbar-gutter always both force");

    test(function () {
      let container = document.getElementById('container_hidden_always_both_force');
      let content = document.getElementById('content_hidden_always_both_force');
      assert_greater_than(container.offsetWidth, content.offsetWidth, "content width");
      assert_less_than(container.offsetLeft, content.offsetLeft, "content position");
      let reference = document.getElementById('content_hidden_always_force');
      assert_less_than(content.offsetWidth, reference.offsetWidth, "compare with \"always force\"");
    }, "overflow hidden, scrollbar-gutter always both force");

    test(function () {
      let container = document.getElementById('container_clip_always_both_force');
      let content = document.getElementById('content_clip_always_both_force');
      assert_greater_than(container.offsetWidth, content.offsetWidth, "content width");
      assert_less_than(container.offsetLeft, content.offsetLeft, "content position");
      let reference = document.getElementById('content_clip_always_force');
      assert_less_than(content.offsetWidth, reference.offsetWidth, "compare with \"always force\"");
    }, "overflow clip, scrollbar-gutter always both force");

    done();

  </script>
</body>