commit f32d783634fbff2bfb28e319035b96a3a67411af parent f0a2491bc5db45679fff6cd09fb212b758449f02 Author: Ian Kilpatrick <ikilpatrick@chromium.org> Date: Wed, 15 Oct 2025 08:23:38 +0000 Bug 1993633 [wpt PR 55160] - [anchor] Fix anchor-scroll-position-try-{008,009,010}, a=testonly Automatic update from web-platform-tests [anchor] Fix anchor-scroll-position-try-{008,009,010} These tests we likely written prior to the "remembering" logic being present. The tests selected the "last" fallback, then progressively scrolled such that other fallbacks were valid, however they still left enough space for the "last" fallback to be valid, not allowing switching. Scroll a full viewport width/height each time so the "last" fallback becomes completely invalid. Bug: 438515315 Change-Id: Ie5c6fb27c8cd495dd37ba4828ef285d506b3f4f1 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6997235 Commit-Queue: Ian Kilpatrick <ikilpatrick@chromium.org> Auto-Submit: Ian Kilpatrick <ikilpatrick@chromium.org> Reviewed-by: Vladimir Levin <vmpstr@chromium.org> Cr-Commit-Position: refs/heads/main@{#1522959} -- wpt-commits: c3e90b813f4a6bfde8237cd1e6e5bd178a3fda31 wpt-pr: 55160 Diffstat:
3 files changed, 18 insertions(+), 12 deletions(-)
diff --git a/testing/web-platform/tests/css/css-anchor-position/anchor-scroll-position-try-008.html b/testing/web-platform/tests/css/css-anchor-position/anchor-scroll-position-try-008.html @@ -38,6 +38,7 @@ html { position-try-fallbacks: --pf1, --pf2, --pf3; inset-block-start: anchor(end); inset-inline-start: anchor(end); + position-visibility: always; } @position-try --pf1 { @@ -62,6 +63,7 @@ html { <script> let vw = window.innerWidth; +let vh = window.innerHeight; promise_test(async () => { await waitUntilNextAnimationFrame(); @@ -71,7 +73,7 @@ promise_test(async () => { promise_test(async () => { // Scroll left to have enough space left to the anchor, but not enough above. - document.documentElement.scrollLeft = -250; + document.documentElement.scrollLeft = -vw; document.documentElement.scrollTop = -150; await waitUntilNextAnimationFrame(); assert_fallback_position(anchored, anchor, 'left'); @@ -81,7 +83,7 @@ promise_test(async () => { promise_test(async () => { // Scroll up to have enough space above the anchor, but not enough left. document.documentElement.scrollLeft = -150; - document.documentElement.scrollTop = -250; + document.documentElement.scrollTop = -vh; await waitUntilNextAnimationFrame(); assert_fallback_position(anchored, anchor, 'right'); assert_fallback_position(anchored, anchor, 'top'); @@ -89,8 +91,8 @@ promise_test(async () => { promise_test(async () => { // Scroll up and left to have enough space on both axes. - document.documentElement.scrollLeft = -vw + 99; - document.documentElement.scrollTop = -250; + document.documentElement.scrollLeft = -vw; + document.documentElement.scrollTop = -vh; await waitUntilNextAnimationFrame(); assert_fallback_position(anchored, anchor, 'left'); assert_fallback_position(anchored, anchor, 'top'); diff --git a/testing/web-platform/tests/css/css-anchor-position/anchor-scroll-position-try-009.html b/testing/web-platform/tests/css/css-anchor-position/anchor-scroll-position-try-009.html @@ -37,6 +37,7 @@ html { position-try-fallbacks: --pf1, --pf2, --pf3; inset-block-start: anchor(end); inset-inline-start: anchor(end); + position-visibility: always; } @position-try --pf1 { @@ -61,6 +62,7 @@ html { <script> let vw = window.innerWidth; +let vh = window.innerHeight; promise_test(async () => { await waitUntilNextAnimationFrame(); @@ -70,7 +72,7 @@ promise_test(async () => { promise_test(async () => { // Scroll left to have enough space right to the anchor, but not enough below. - document.documentElement.scrollLeft = 250; + document.documentElement.scrollLeft = vw; document.documentElement.scrollTop = 150; await waitUntilNextAnimationFrame(); assert_fallback_position(anchored, anchor, 'right'); @@ -80,7 +82,7 @@ promise_test(async () => { promise_test(async () => { // Scroll down to have enough space below the anchor, but not enough right. document.documentElement.scrollLeft = 150; - document.documentElement.scrollTop = 250; + document.documentElement.scrollTop = vh; await waitUntilNextAnimationFrame(); assert_fallback_position(anchored, anchor, 'left'); assert_fallback_position(anchored, anchor, 'bottom'); @@ -88,8 +90,8 @@ promise_test(async () => { promise_test(async () => { // Scroll down and right to have enough space on both axes. - document.documentElement.scrollLeft = vw - 99; - document.documentElement.scrollTop = 250; + document.documentElement.scrollLeft = vw; + document.documentElement.scrollTop = vh; await waitUntilNextAnimationFrame(); assert_fallback_position(anchored, anchor, 'right'); assert_fallback_position(anchored, anchor, 'bottom'); diff --git a/testing/web-platform/tests/css/css-anchor-position/anchor-scroll-position-try-010.html b/testing/web-platform/tests/css/css-anchor-position/anchor-scroll-position-try-010.html @@ -38,6 +38,7 @@ html { position-try-fallbacks: --pf1, --pf2, --pf3; inset-block-start: anchor(end); inset-inline-start: anchor(end); + position-visibility: always; } @position-try --pf1 { @@ -62,6 +63,7 @@ html { <script> let vw = window.innerWidth; +let vh = window.innerHeight; promise_test(async () => { await waitUntilNextAnimationFrame(); @@ -71,7 +73,7 @@ promise_test(async () => { promise_test(async () => { // Scroll left to have enough space right to the anchor, but not enough above. - document.documentElement.scrollLeft = 250; + document.documentElement.scrollLeft = vw; document.documentElement.scrollTop = -150; await waitUntilNextAnimationFrame(); assert_fallback_position(anchored, anchor, 'right'); @@ -81,7 +83,7 @@ promise_test(async () => { promise_test(async () => { // Scroll up to have enough space above the anchor, but not enough right. document.documentElement.scrollLeft = 150; - document.documentElement.scrollTop = -250; + document.documentElement.scrollTop = -vh; await waitUntilNextAnimationFrame(); assert_fallback_position(anchored, anchor, 'left'); assert_fallback_position(anchored, anchor, 'top'); @@ -89,8 +91,8 @@ promise_test(async () => { promise_test(async () => { // Scroll up and right to have enough space on both axes. - document.documentElement.scrollLeft = vw - 99; - document.documentElement.scrollTop = -250; + document.documentElement.scrollLeft = vw; + document.documentElement.scrollTop = -vh; await waitUntilNextAnimationFrame(); assert_fallback_position(anchored, anchor, 'right'); assert_fallback_position(anchored, anchor, 'top');