fune/testing/web-platform/tests/css/css-position/position-absolute-dynamic-relayout-002.html
Ian Kilpatrick 41f5deb644 Bug 1593021 [wpt PR 20021] - [LayoutNG] Disable first-tier OOF-cache when borders/scrollbars are present., a=testonly
Automatic update from web-platform-tests
[LayoutNG] Disable first-tier OOF-cache when borders/scrollbars are present.

The first-tier OOF-cache attempts to skip all the OOF sizing and positioning
work required, as the other cache simply compares the constraint spaces
which can be (relatively) expensive to determine.

This first-tier cache works by comparing the available-size given to the
OOF-positioned descendant. If equal we can skip the OOF-positioned sizing
and positioning steps.

This mostly worked, however had an issue where the containing-block may have
added/removed a borders/scrollbars, but the available-size given remained
the same.

This resulted in an incorrectly positioned OOF-positioned node.

This fix disallows the first-tier cache when borders/scrollbars are present.
This is sufficiently rare that this cache still has a relatively high
hit-rate and is still relative cheap to calculate.

Bug: 1013866
Change-Id: I71d41d2c4b47bcff6412f395db2deabf2f6f3a8f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1891768
Commit-Queue: Ian Kilpatrick <ikilpatrick@chromium.org>
Reviewed-by: Aleks Totic <atotic@chromium.org>
Reviewed-by: Morten Stenshorne <mstensho@chromium.org>
Cr-Commit-Position: refs/heads/master@{#714394}

--

wpt-commits: 87f0b7482549a035c7bd682f506f6bd88f569b60
wpt-pr: 20021
2019-11-29 10:56:07 +00:00

14 lines
797 B
HTML

<!DOCTYPE html>
<link rel="match" href="../reference/ref-filled-green-100px-square.xht">
<link rel="help" href="https://www.w3.org/TR/css-position-3/" />
<meta name="assert" content="This test checks that a dynamic change padding-box location, but no change in available-size positions correctly an absolute child correctly."/>
<p>Test passes if there is a filled green square and <strong>no red</strong>.</p>
<div id="target" style="position: relative; background: red; margin: 25px; width: 50px; height: 50px;">
<div style="position: absolute; top: 0; left: 0; width: 50px; height: 50px; background: green;"></div>
</div>
<script>
document.body.offsetTop;
const target = document.getElementById('target');
target.style.border = '25px solid green';
target.style.margin = '0';
</script>