commit f98c2038827fcf91c59e76098fc1bd560a214435
parent ae5167bf7831216b5d185ac7c413c91a7bc85228
Author: moonira <moonira@google.com>
Date: Fri, 3 Oct 2025 09:00:18 +0000
Bug 1991155 [wpt PR 55106] - Set correct scroll type for scrollbar scrolls, a=testonly
Automatic update from web-platform-tests
Set correct scroll type for scrollbar scrolls
Set absolute scroll type for scrollbar dragging scrolls.
It is currently implemented in `ScrollableArea::DidCompositorScroll`,
ideally it should be done on the compositor, left TODO for that.
[0] https://drafts.csswg.org/css-scroll-snap-1/#scroll-types.
Bug: 414556050
Change-Id: I3db467d8e6e78b911c8f5820a506b773fe616cae
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6958956
Commit-Queue: Munira Tursunova <moonira@google.com>
Reviewed-by: Robert Flack <flackr@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1521356}
--
wpt-commits: 49947b4d9d9789a932d4030c2bf171cc7625f9c6
wpt-pr: 55106
Diffstat:
1 file changed, 43 insertions(+), 3 deletions(-)
diff --git a/testing/web-platform/tests/css/css-conditional/container-queries/scroll-state/scroll-direction-mouse-drag-scroll.html b/testing/web-platform/tests/css/css-conditional/container-queries/scroll-state/scroll-direction-mouse-drag-scroll.html
@@ -13,13 +13,15 @@
width: 200px;
height: 200px;
container-type: scroll-state;
- overflow-y: scroll;
+ overflow: scroll;
}
#filler {
height: 600px;
+ width: 600px;
}
#target {
--none: no;
+ --x: no;
--y: no;
@container scroll-state(direction: none) {
--none: yes;
@@ -27,6 +29,9 @@
@container scroll-state(direction: y) {
--y: yes;
}
+ @container scroll-state(direction: x) {
+ --x: yes;
+ }
}
</style>
<div id="scroller">
@@ -49,7 +54,15 @@
}
promise_test(async t => {
- // Scrollbar position top right of element
+ // Skip test on platforms that do not have a visible scrollbar (e.g.
+ // overlay scrollbar).
+ const scrollbar_width = scroller.offsetWidth - scroller.clientWidth;
+ if (scrollbar_width == 0) {
+ return;
+ }
+ assert_equals(scroller.scrollTop, 0);
+
+ // Vertical scrollbar position top right
const start_pos = {
x: 200,
y: 30,
@@ -58,9 +71,36 @@
await drag_scrollbar(start_pos, end_pos);
await waitForAnimationFrames(2);
+
+ assert_not_equals(scroller.scrollTop, 0);
assert_equals(getComputedStyle(target).getPropertyValue("--none"), "yes");
assert_equals(getComputedStyle(target).getPropertyValue("--y"), "no");
- }, "Mouse drag scroll");
+ }, "Vertical scrollbar drag scroll");
+
+ promise_test(async t => {
+ // Skip test on platforms that do not have a visible scrollbar (e.g.
+ // overlay scrollbar).
+ const scrollbar_height = scroller.offsetHeight - scroller.clientHeight;
+ if (scrollbar_height == 0) {
+ return;
+ }
+ assert_equals(scroller.scrollLeft, 0);
+
+ // Horizontal scrollbar position bottom left
+ const start_pos = {
+ x: 30,
+ y: 200,
+ };
+ const end_pos = { x: 200, y: 200 };
+
+ await drag_scrollbar(start_pos, end_pos);
+ await waitForAnimationFrames(2);
+
+ assert_not_equals(scroller.scrollLeft, 0);
+ assert_equals(getComputedStyle(target).getPropertyValue("--none"), "yes");
+ assert_equals(getComputedStyle(target).getPropertyValue("--x"), "no");
+
+ }, "Horizontal scrollbar drag scroll");
</script>