fune/testing/web-platform/tests/css/css-flexbox/scrollbars-ref.html
Daniel Holbert d703d5215e Bug 1744171 [wpt PR 31865] - Remove 'font-size: 0' from some css-flexbox scrollbars reference cases., a=testonly
Automatic update from web-platform-tests
Remove 'font-size: 0' from some css-flexbox scrollbars reference cases. (#31865)

The zero font-size is essentially non-functional, but it causes a slight
rendering difference in Firefox's scrollbar-thumb-sizing (and results in a test
failure), for what turns out to be good reasons:

Essentially, the scrollbar thumb is a reflection of the pagedown-distance; and
in Firefox, we use a slightly-larger pagedown-distance if the scrollport has a
sufficiently-small font size, because we only aim to have a few lines of
overlap between the old and new scrollport during a pagedown operation.  And "a
few lines of overlap" is based on the scrollport's font-size.  So the
pagedown-distance is dependent on the font-size, and therefore so is the
scrollbar thumb size.

(See https://bugzilla.mozilla.org/show_bug.cgi?id=1743924#c9 for more.)
--

wpt-commits: fe3d72be65dc9e592c94051a885511ee37b65880
wpt-pr: 31865
2021-12-20 11:37:59 +00:00

138 lines
3.5 KiB
HTML

<!DOCTYPE html>
<head>
<script src="support/scrollbars.js"></script>
<style>
.horizontal-header {
width: 120px;
}
.vertical-header {
width: 60px;
}
.container-row {
display: flex;
flex-direction: row;
align-items: flex-start;
justify-content: flex-start;
}
.container {
flex: none;
margin: 5px;
}
.ltr {
direction: ltr;
}
.rtl {
direction: rtl;
}
.horizontal {
writing-mode: horizontal-tb;
}
.flipped-blocks {
writing-mode: vertical-rl;
}
.flipped-lines {
writing-mode: vertical-lr;
}
.flex {
border: 2px solid red;
overflow: scroll;
max-width: 100px;
max-height: 100px;
white-space: nowrap;
}
.row > div, .row-reverse > div {
display: inline-flex;
margin: 3px;
}
.column > div, .column-reverse > div {
display: flex;
margin: 3px;
}
/* Adjust margins to account for collapsing. */
.horizontal > .column > .leaf1, .horizontal > .column > .leaf2 {
margin: 3px 3px 6px 3px;
}
.flipped-blocks > .column > .leaf1, .flipped-blocks > .column > .leaf2 {
margin: 3px 3px 3px 6px;
}
.flipped-lines > .column > .leaf1, .flipped-lines > .column > .leaf2 {
margin: 3px 6px 3px 3px;
}
.horizontal > .column-reverse > .leaf1, .horizontal > .column-reverse > .leaf2 {
margin: 6px 3px 3px 3px;
}
.flipped-blocks > .column-reverse > .leaf1, .flipped-blocks > .column-reverse > .leaf2 {
margin: 3px 6px 3px 3px;
}
.flipped-lines > .column-reverse > .leaf1, .flipped-lines > .column-reverse > .leaf2 {
margin: 3px 3px 3px 6px;
}
.flex > div {
width: 30px;
height: 30px;
border: 2px solid blue;
flex-direction: column;
justify-content: center;
}
.flex > div > div {
font-size: 20px;
text-align: center;
flex: none;
}
</style>
</head>
<div class="container-row">
<div class="vertical-header ltr horizontal"></div>
<div class="horizontal-header ltr horizontal">ltr<br>horizontal-tb</div>
<div class="vertical-header ltr flipped-blocks">ltr<br>vertical-rl</div>
<div class="vertical-header ltr flipped-blocks">ltr<br>vertical-lr</div>
<div class="horizontal-header rtl horizontal">rtl<br>horizontal-tb</div>
<div class="vertical-header rtl flipped-blocks">rtl<br>vertical-rl</div>
<div class="vertical-header rtl flipped-blocks">rtl<br>vertical-lr</div>
</div>
<script>
// Override createContentNode to emulate reverse flow direction.
createContentNode = (flexDirection, textDirection, writingMode) => {
var flexNode = document.createElement("div");
flexNode.className = "flex " + flexDirection;
flexNode.title = "flex-direction: " + flexDirection + "; direction: " + textDirection + "; writing-mode: " + writingMode;
for (var i = 1; i < 4; i++)
flexNode.appendChild(createLeafNode(flexDirection.endsWith("reverse") ? 4 - i : i));
return flexNode;
}
flexDirections.forEach((flexDirection) => {
var containerRow = createContainerRow(flexDirection);
document.body.appendChild(containerRow);
});
// Scroll all flex containers to the emulated beginning of flow.
var nodes = document.querySelectorAll(".ltr > .row-reverse");
for (var i = 0; i < nodes.length; i++) {
nodes[i].scrollLeft = 10000;
nodes[i].scrollTop = 10000;
}
nodes = document.querySelectorAll(".rtl > .row-reverse");
for (var i = 0; i < nodes.length; i++) {
nodes[i].scrollLeft = -10000;
nodes[i].scrollTop = -10000;
}
nodes = document.querySelectorAll(".column-reverse");
for (var i = 0; i < nodes.length; i++) {
nodes[i].scrollLeft = 10000;
nodes[i].scrollTop = 10000;
}
nodes = document.querySelectorAll(".flipped-blocks > .column-reverse");
for (var i = 0; i < nodes.length; i++) {
nodes[i].scrollLeft = -10000;
nodes[i].scrollTop = 0;
}
</script>