commit 662b9c663ab82aabc49d77f9913ad20cbf6986ff parent 9c23bfc9b1ed1ad66ab682015d40e24ad60b03b0 Author: Ian Kilpatrick <ikilpatrick@chromium.org> Date: Sun, 26 Oct 2025 21:13:29 +0000 Bug 1995567 [wpt PR 55573] - [anchor] Don't trigger a relayout unless the current option overflows., a=testonly Automatic update from web-platform-tests [anchor] Don't trigger a relayout unless the current option overflows. Previously we triggered relayout when any option became valid - even if we'd prefer the last-successful option. As a result we'd relayout the last-successful option, potentially causing it to change size. Now in non_overflowing_scroll_ranges we either store: - A single range for the successful option (so that we can invalidate when it doesn't have any space anymore). - A list of all ranges (who all don't fit - so that we can invalidate when one of them does have space). All behaviour changes should be behind the CSSAnchorUpdate flag. Bug: 438515315 Change-Id: Icb49c2b6b9f3c08aa8c6274b65576f59b64776b4 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7063463 Reviewed-by: Vladimir Levin <vmpstr@chromium.org> Commit-Queue: Ian Kilpatrick <ikilpatrick@chromium.org> Cr-Commit-Position: refs/heads/main@{#1533070} -- wpt-commits: bed39bc613c1f72f3f34a7a45b2aee832ec9ea8c wpt-pr: 55573 Diffstat:
| A | testing/web-platform/tests/css/css-anchor-position/anchor-scroll-position-try-015-ref.html | | | 3 | +++ |
| A | testing/web-platform/tests/css/css-anchor-position/anchor-scroll-position-try-015.tentative.html | | | 41 | +++++++++++++++++++++++++++++++++++++++++ |
2 files changed, 44 insertions(+), 0 deletions(-)
diff --git a/testing/web-platform/tests/css/css-anchor-position/anchor-scroll-position-try-015-ref.html b/testing/web-platform/tests/css/css-anchor-position/anchor-scroll-position-try-015-ref.html @@ -0,0 +1,3 @@ +<!DOCTYPE html> +<div style="width:100px; height:100px; background:blue;"></div> +<div style="width:100px; height:150px; background:green;"></div> diff --git a/testing/web-platform/tests/css/css-anchor-position/anchor-scroll-position-try-015.tentative.html b/testing/web-platform/tests/css/css-anchor-position/anchor-scroll-position-try-015.tentative.html @@ -0,0 +1,41 @@ +<!DOCTYPE html> +<title>Scrolling further up shouldn't trigger the anchored element to grow.</title> +<link rel="help" href="https://drafts.csswg.org/css-anchor-position/#position-try-fallbacks"> +<link rel="match" href="anchor-scroll-position-try-015-ref.html"> +<style> + #anchor { + anchor-name: --a; + margin-top: 200px; + width: 100px; + height: 100px; + background: blue; + } + #anchored { + position: absolute; + position-anchor: --a; + position-area: top center; + position-try-fallbacks: flip-block; + width: 100%; + height: 100%; + min-height: 100px; + background: green; + } +</style> + +<div style="position:relative; width:200px; height:300px;"> + <div id="scroller" style="overflow:scroll; scrollbar-width:none; width:100%; height:100%;"> + <div id="anchor"></div> + <div style="width:1000px; height:1000px;"></div> + <div id="anchored"></div> + </div> +</div> + +<script> +scroller.scrollTop = 150; +requestAnimationFrame(() => { + requestAnimationFrame(() => { + scroller.scrollTop = 200; + document.documentElement.classList.remove('reftest-wait'); + }); +}); +</script>