summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/css/css-overflow/scrollbar-gutter-001.html
blob: 4486471cde560c24058fb168f43629f8da833654 (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
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
<!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 */
  .sg_auto {
    scrollbar-gutter: auto;
  }

  .sg_stable {
    scrollbar-gutter: stable;
  }

  .sg_stable_mirror {
    scrollbar-gutter: stable both-edges;
  }

  /* 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: 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_stable" id="container_auto_stable">
      <div class="content" id="content_auto_stable">auto/stable</div>
    </div>

    <div class="container ov_scroll sg_stable" id="container_scroll_stable">
      <div class="content" id="content_scroll_stable">scroll/stable</div>
    </div>

    <div class="container ov_visible sg_stable" id="container_visible_stable">
      <div class="content" id="content_visible_stable">visible/stable</div>
    </div>

    <div class="container ov_hidden sg_stable" id="container_hidden_stable">
      <div class="content" id="content_hidden_stable">hidden/stable</div>
    </div>

    <div class="container ov_clip sg_stable" id="container_clip_stable">
      <div class="content" id="content_clip_stable">clip/stable</div>
    </div>
  </div>

  <div class="line">
    <div class="container ov_auto sg_stable_mirror" id="container_auto_stable_mirror">
      <div class="content" id="content_auto_stable_mirror">auto/stable both-edges</div>
    </div>

    <div class="container ov_scroll sg_stable_mirror" id="container_scroll_stable_mirror">
      <div class="content" id="content_scroll_stable_mirror">scroll/stable both-edges</div>
    </div>

    <div class="container ov_visible sg_stable_mirror" id="container_visible_stable_mirror">
      <div class="content" id="content_visible_stable_mirror">visible/stable both-edges</div>
    </div>

    <div class="container ov_hidden sg_stable_mirror" id="container_hidden_stable_mirror">
      <div class="content" id="content_hidden_stable_mirror">hidden/stable both-edges</div>
    </div>

    <div class="container ov_clip sg_stable_mirror" id="container_clip_stable_mirror">
      <div class="content" id="content_clip_stable_mirror">clip/stable both-edges</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: stable

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

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

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

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

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

    // scrollbar-gutter: stable both-edges

    test(function () {
      let container = document.getElementById('container_auto_stable_mirror');
      let content = document.getElementById('content_auto_stable_mirror');
      assert_greater_than(container.offsetWidth, content.offsetWidth, "content width");
      assert_less_than(container.offsetLeft, content.offsetLeft, "content position");
      let reference = document.getElementById('content_auto_stable');
      assert_less_than(content.offsetWidth, reference.offsetWidth, "compare with \"stable\"");
    }, "overflow auto, scrollbar-gutter stable both-edges");

    test(function () {
      let container = document.getElementById('container_scroll_stable_mirror');
      let content = document.getElementById('content_scroll_stable_mirror');
      assert_greater_than(container.offsetWidth, content.offsetWidth, "content width");
      assert_less_than(container.offsetLeft, content.offsetLeft, "content position");
      let reference = document.getElementById('content_auto_stable');
      assert_less_than(content.offsetWidth, reference.offsetWidth, "compare with \"stable\"");
    }, "overflow scroll, scrollbar-gutter stable both-edges");

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

    test(function () {
      let container = document.getElementById('container_hidden_stable_mirror');
      let content = document.getElementById('content_hidden_stable_mirror');
      assert_greater_than(container.offsetWidth, content.offsetWidth, "content width");
      assert_less_than(container.offsetLeft, content.offsetLeft, "content position");
      let reference = document.getElementById('content_auto_stable');
      assert_less_than(content.offsetWidth, reference.offsetWidth, "compare with \"stable\"");
    }, "overflow hidden, scrollbar-gutter stable both-edges");

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

    done();

  </script>
</body>