From 13cc952c857fcfd70d647a91a337f6dbbf1d2f92 Mon Sep 17 00:00:00 2001 From: David Awogbemila Date: Fri, 9 Feb 2024 22:11:38 +0000 Subject: [PATCH] Bug 1877878 [wpt PR 44338] - [css-scroll-snap-2] Prioritize focused snap targets, a=testonly Automatic update from web-platform-tests [css-scroll-snap-2] Prioritize focused snap targets An agreed upon proposal[1] by the CSS working group specifies that where multiple scroll snap targets are visually equally aligned, scroll containers should give priority to focused elements. Blink did this for programmatic scrolls but not for user scrolls. This patch prioritizes focused elements for both types of scrolls by relying on a bit in SnapAreaData. [1]https://github.com/w3c/csswg-drafts/issues/9622 Bug: 1523819 Change-Id: I81e2aaf0845e9763abb463a960614beb37b05a8a Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5255777 Reviewed-by: Steve Kobes Commit-Queue: David Awogbemila Cr-Commit-Position: refs/heads/main@{#1256790} -- wpt-commits: d56b1391cbf0979b0f333a1cae23875acb06be1b wpt-pr: 44338 --- .../prefer-focused-element.html | 128 +++++++++++++++ .../prefer-focused-nested-containers.html | 109 +++++++++++++ .../resources/common.js | 148 ++++++++++++++++++ 3 files changed, 385 insertions(+) create mode 100644 testing/web-platform/tests/css/css-scroll-snap/snap-after-relayout/multiple-aligned-targets/prefer-focused-element.html create mode 100644 testing/web-platform/tests/css/css-scroll-snap/snap-after-relayout/multiple-aligned-targets/prefer-focused-nested-containers.html create mode 100644 testing/web-platform/tests/css/css-scroll-snap/snap-after-relayout/multiple-aligned-targets/resources/common.js diff --git a/testing/web-platform/tests/css/css-scroll-snap/snap-after-relayout/multiple-aligned-targets/prefer-focused-element.html b/testing/web-platform/tests/css/css-scroll-snap/snap-after-relayout/multiple-aligned-targets/prefer-focused-element.html new file mode 100644 index 000000000000..f15a291f08a8 --- /dev/null +++ b/testing/web-platform/tests/css/css-scroll-snap/snap-after-relayout/multiple-aligned-targets/prefer-focused-element.html @@ -0,0 +1,128 @@ + + + + + + + + + + + + + + +
+
+
top left
+
top right
+
bottom left
+
bottom right
+
+ + + diff --git a/testing/web-platform/tests/css/css-scroll-snap/snap-after-relayout/multiple-aligned-targets/prefer-focused-nested-containers.html b/testing/web-platform/tests/css/css-scroll-snap/snap-after-relayout/multiple-aligned-targets/prefer-focused-nested-containers.html new file mode 100644 index 000000000000..a6a087316fdc --- /dev/null +++ b/testing/web-platform/tests/css/css-scroll-snap/snap-after-relayout/multiple-aligned-targets/prefer-focused-nested-containers.html @@ -0,0 +1,109 @@ + + + + + + + + + + + + + + +
+
+
LPH (outer)
+
RPH (outer)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + + diff --git a/testing/web-platform/tests/css/css-scroll-snap/snap-after-relayout/multiple-aligned-targets/resources/common.js b/testing/web-platform/tests/css/css-scroll-snap/snap-after-relayout/multiple-aligned-targets/resources/common.js new file mode 100644 index 000000000000..6ceec9118c5a --- /dev/null +++ b/testing/web-platform/tests/css/css-scroll-snap/snap-after-relayout/multiple-aligned-targets/resources/common.js @@ -0,0 +1,148 @@ +// Utility functions for scroll snap tests which verify User-Agents' snap point +// selection logic when multiple snap targets are aligned. +// It depends on methods in /resources/testdriver-actions.js and +// /dom/event/scrolling/scroll_support.js so html files using these functions +// should include those files as