Commit 066c86f5 authored by Antonio Gomes's avatar Antonio Gomes Committed by Commit Bot

Factor UA-specific behavior out of css/css-flexbox/overflow-auto-006.html

... back to chromium web_test.

The way how 'overflow:auto' elements contribute their scrollbar
thickness to their intrinsic size is UA-specific [1].

This CL factors such checks out of css/css-flexbox/overflow-auto-006.html, back
into blink specific web_test directory. The new test is
t_p/blink/web_tests/css3/flexbox/overflow-auto-intrinsic-size.html

Note: The test originated from
web_tests/css3/flexbox/flexbox-height-with-overflow-auto.html,
and was moved to wpt/css/css-flexbox/flexbox-overflow-auto-002.html in
https://crrev.com/c/2120544 and then renamed to overflow-auto-006.html.

[1] https://www.w3.org/TR/CSS22/visufx.html#overflow

Issue=22580
BUG=1063749
R=robertma@chromium.org

Change-Id: Ief1c2861e39a7eb66de3786e399774f647527a3e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2135707Reviewed-by: default avatarRobert Ma <robertma@chromium.org>
Commit-Queue: Robert Ma <robertma@chromium.org>
Cr-Commit-Position: refs/heads/master@{#756292}
parent d4d65419
<!DOCTYPE html>
<html>
<title>CSS Flexbox: scrollbars on overflow auto accounted by intrinsic size.</title>
<link rel="stylesheet" href="resources/flexbox.css">
<link rel="help" href="https://www.w3.org/TR/css-flexbox-1/#flex-direction-property">
<link rel="help" href="https://www.w3.org/TR/CSS22/visufx.html#overflow">
<link rel="issue" href="https://github.com/web-platform-tests/wpt/issues/22580#issue-591447665">
<meta name="assert" content="How 'overflow: auto' elements contribute their scrollbar thickness to their intrinsic size is UA-specific behavior."/>
<style>
.flexbox {
border: 5px solid green;
position: relative;
width: 50px;
}
.inline-flexbox {
border: 5px solid green;
position: relative;
height: 50px;
}
.overflow {
border: 1px solid red;
overflow: auto;
min-width: 0;
min-height: 0;
}
.vertical {
writing-mode: vertical-rl;
}
</style>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="../../resources/check-layout-th.js"></script>
<body onload="checkLayout('.flexbox, .inline-flexbox')">
<div id=log></div>
<div class="flexbox vertical to-be-checked" check-height check-accounts-scrollbar>
<div class="overflow"><div style="width: 100px; height: 20px"></div></div>
</div>
<div class="flexbox row-reverse vertical to-be-checked" check-height check-accounts-scrollbar>
<div class="overflow"><div style="width: 100px; height: 20px"></div></div>
</div>
<div class="inline-flexbox column to-be-checked" check-width check-accounts-scrollbar>
<div class="overflow"><div style="width: 20px; height: 100px"></div></div>
</div>
<div class="inline-flexbox column-reverse to-be-checked" check-width check-accounts-scrollbar>
<div class="overflow"><div style="width: 20px; height: 100px"></div></div>
</div>
<div class="inline-flexbox column to-be-checked" check-width check-accounts-scrollbar>
<div class="overflow align-self-baseline"><div style="width: 20px; height: 100px"></div></div>
</div>
<div class="inline-flexbox column-reverse to-be-checked" check-width check-accounts-scrollbar>
<div class="overflow align-self-baseline"><div style="width: 20px; height: 100px"></div></div>
</div>
<!-- This div is only for measuring scrollbar size -->
<div id="measure" style="height: 100px; width: 100px; display: inline-block; overflow: auto;">
<div style="min-height: 300px;"></div>
</div>
<script>
var measure = document.getElementById('measure');
var scrollbarSize = measure.offsetWidth - measure.clientWidth;
var nodes = document.getElementsByClassName("to-be-checked");
for (var i = 0; i < nodes.length; i++) {
var node = nodes[i];
// Here, the things contributing height are:
//
// (a) each innermost div contributes an explicit height: 20px value.
// (b) the .overflow div contributes 2px of border (1px top + bottom),
// plus the height of its scrollbar from overflow:auto.
// (c) the .flexbox div contributes 10px of border (5px top + bottom).
//
// So, the total height is 20px + 2px + 10px + scrollbarHeight,
// which simplifies to 32px + scrollbarHeight.
//
// Analogously, the same logic applies for nodes where width is tested.
var size = 32;
if (node.hasAttribute("check-height")) {
var height = node.hasAttribute("check-accounts-scrollbar") ? scrollbarSize : 0;
node.setAttribute("data-expected-height", size + height);
} else {
var width = node.hasAttribute("check-accounts-scrollbar") ? scrollbarSize : 0;
node.setAttribute("data-expected-width", size + width);
}
}
</script>
</body>
</html>
...@@ -42,14 +42,6 @@ ...@@ -42,14 +42,6 @@
<div class="overflow"><div style="width: 100px; height: 20px"></div></div> <div class="overflow"><div style="width: 100px; height: 20px"></div></div>
</div> </div>
<div class="flexbox vertical to-be-checked" check-height check-accounts-scrollbar>
<div class="overflow"><div style="width: 100px; height: 20px"></div></div>
</div>
<div class="flexbox row-reverse vertical to-be-checked" check-height check-accounts-scrollbar>
<div class="overflow"><div style="width: 100px; height: 20px"></div></div>
</div>
<div class="flexbox to-be-checked" check-height check-accounts-scrollbar> <div class="flexbox to-be-checked" check-height check-accounts-scrollbar>
<div class="overflow align-self-baseline"><div style="width: 100px; height: 20px"></div></div> <div class="overflow align-self-baseline"><div style="width: 100px; height: 20px"></div></div>
</div> </div>
...@@ -66,14 +58,6 @@ ...@@ -66,14 +58,6 @@
<div class="overflow align-self-baseline"><div style="width: 100px; height: 20px"></div></div> <div class="overflow align-self-baseline"><div style="width: 100px; height: 20px"></div></div>
</div> </div>
<div class="inline-flexbox column to-be-checked" check-width check-accounts-scrollbar>
<div class="overflow"><div style="width: 20px; height: 100px"></div></div>
</div>
<div class="inline-flexbox column-reverse to-be-checked" check-width check-accounts-scrollbar>
<div class="overflow"><div style="width: 20px; height: 100px"></div></div>
</div>
<div class="inline-flexbox column vertical to-be-checked" check-width check-accounts-scrollbar> <div class="inline-flexbox column vertical to-be-checked" check-width check-accounts-scrollbar>
<div class="overflow"><div style="width: 20px; height: 100px"></div></div> <div class="overflow"><div style="width: 20px; height: 100px"></div></div>
</div> </div>
...@@ -82,14 +66,6 @@ ...@@ -82,14 +66,6 @@
<div class="overflow"><div style="width: 20px; height: 100px"></div></div> <div class="overflow"><div style="width: 20px; height: 100px"></div></div>
</div> </div>
<div class="inline-flexbox column to-be-checked" check-width check-accounts-scrollbar>
<div class="overflow align-self-baseline"><div style="width: 20px; height: 100px"></div></div>
</div>
<div class="inline-flexbox column-reverse to-be-checked" check-width check-accounts-scrollbar>
<div class="overflow align-self-baseline"><div style="width: 20px; height: 100px"></div></div>
</div>
<div class="inline-flexbox column vertical to-be-checked" check-width> <div class="inline-flexbox column vertical to-be-checked" check-width>
<div class="overflow align-self-baseline"><div style="width: 20px; height: 100px"></div></div> <div class="overflow align-self-baseline"><div style="width: 20px; height: 100px"></div></div>
</div> </div>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment