Skip to content

Truly independent web browser

Tests/LibWeb: Stop awaiting each step of a latched wheel gesture

Tim Ledbetter3784eac91279
diff --git a/Tests/LibWeb/Text/input/async-scrolling/ui-touchpad-gesture-over-iframe-stays-in-the-iframe.html b/Tests/LibWeb/Text/input/async-scrolling/ui-touchpad-gesture-over-iframe-stays-in-the-iframe.html
index 251ea135b73..eb5ddd02050 100644
--- a/Tests/LibWeb/Text/input/async-scrolling/ui-touchpad-gesture-over-iframe-stays-in-the-iframe.html
+++ b/Tests/LibWeb/Text/input/async-scrolling/ui-touchpad-gesture-over-iframe-stays-in-the-iframe.html
@@ -29,10 +29,12 @@
internals.beginInputTrace();
await scrollSettled(frame.contentDocument, async () => {
await internals.wheelThroughUIProcess(100, 75, 0, 0, true, "ongoing");
- await internals.wheelThroughUIProcess(100, 75, 0, 100, true, "ongoing");
- await internals.wheelThroughUIProcess(100, 75, 0, 100, true, "ongoing");
- await internals.wheelThroughUIProcess(100, 75, 0, 100, true, "momentum");
- await internals.wheelThroughUIProcess(100, 75, 0, 0, true, "ended");
+ await Promise.all([
+ internals.wheelThroughUIProcess(100, 75, 0, 100, true, "ongoing"),
+ internals.wheelThroughUIProcess(100, 75, 0, 100, true, "ongoing"),
+ internals.wheelThroughUIProcess(100, 75, 0, 100, true, "momentum"),
+ internals.wheelThroughUIProcess(100, 75, 0, 0, true, "ended"),
+ ]);
});
printInputTrace(internals.takeInputTrace(), { stages: ["compositor"] });
println(`frame scrollY: ${frame.contentWindow.scrollY}`);
diff --git a/Tests/LibWeb/Text/input/async-scrolling/wheel-latch-measures-cursor-movement-from-gesture-start.html b/Tests/LibWeb/Text/input/async-scrolling/wheel-latch-measures-cursor-movement-from-gesture-start.html
index 4019900054a..faf30f8ab41 100644
--- a/Tests/LibWeb/Text/input/async-scrolling/wheel-latch-measures-cursor-movement-from-gesture-start.html
+++ b/Tests/LibWeb/Text/input/async-scrolling/wheel-latch-measures-cursor-movement-from-gesture-start.html
@@ -21,11 +21,10 @@
await animationFrame();
// Mouse wheel ticks in quick succession take the nested scroller to its extent as one gesture.
- await internals.wheel(50, 50, 0, 150);
- await internals.wheel(50, 50, 0, 150);
+ const ticksToExtent = [internals.wheel(50, 50, 0, 150), internals.wheel(50, 50, 0, 150)];
// A tick 7 CSS pixels from where the gesture started still belongs to it, so the nested scroller absorbs it.
- await internals.wheel(57, 50, 0, 100);
+ await Promise.all([...ticksToExtent, internals.wheel(57, 50, 0, 100)]);
println(`window.scrollY after a tick 7 pixels away: ${window.scrollY}`);
// The next tick is only 7 pixels from the last one, but 14 from where the gesture started, so it starts a new
diff --git a/Tests/LibWeb/Text/input/scroll-snap-flick-stays-with-latched-scroller-at-its-extent.html b/Tests/LibWeb/Text/input/scroll-snap-flick-stays-with-latched-scroller-at-its-extent.html
index db5cd946b1c..50cdc3d88a9 100644
--- a/Tests/LibWeb/Text/input/scroll-snap-flick-stays-with-latched-scroller-at-its-extent.html
+++ b/Tests/LibWeb/Text/input/scroll-snap-flick-stays-with-latched-scroller-at-its-extent.html
@@ -38,12 +38,14 @@
// The finger scrolls the inner scroller to its extent, and the momentum of the flick stays with it: a gesture
// keeps the scroller its first step hit, so it does not chain on to the snap container around it.
await scrollSettled(inner, async () => {
- await internals.wheel(50, 50, 0, 50, true, "ongoing");
- await internals.wheel(50, 50, 0, 50, true, "ongoing");
- await internals.wheel(50, 50, 0, 100, true, "momentum");
- await internals.wheel(50, 50, 0, 60, true, "momentum");
- await internals.wheel(50, 50, 0, 30, true, "momentum");
- await internals.wheel(50, 50, 0, 0, true, "ended");
+ await Promise.all([
+ internals.wheel(50, 50, 0, 50, true, "ongoing"),
+ internals.wheel(50, 50, 0, 50, true, "ongoing"),
+ internals.wheel(50, 50, 0, 100, true, "momentum"),
+ internals.wheel(50, 50, 0, 60, true, "momentum"),
+ internals.wheel(50, 50, 0, 30, true, "momentum"),
+ internals.wheel(50, 50, 0, 0, true, "ended"),
+ ]);
});
println(`inner scroll offset: ${inner.scrollLeft},${inner.scrollTop}`);
println(`snap container scroll offset: ${scroller.scrollLeft},${scroller.scrollTop}`);
diff --git a/Tests/LibWeb/Text/input/scroll-snap-wheel-step-on-latched-snap-container-at-its-extent.html b/Tests/LibWeb/Text/input/scroll-snap-wheel-step-on-latched-snap-container-at-its-extent.html
index c74fabb2b18..1d019dba22c 100644
--- a/Tests/LibWeb/Text/input/scroll-snap-wheel-step-on-latched-snap-container-at-its-extent.html
+++ b/Tests/LibWeb/Text/input/scroll-snap-wheel-step-on-latched-snap-container-at-its-extent.html
@@ -29,12 +29,15 @@
await animationFrame();
// The first step takes the snap container to its last snap position, which is also its scroll extent.
- await internals.wheel(50, 50, 0, 500);
- println(`snap container scroll offset after the first step: ${snapper.scrollTop}`);
+ const firstStep = internals.wheel(50, 50, 0, 500);
// The next step of the same gesture stays with the snap container at its extent, which consumes it without
// scrolling anything, and the step's promise still resolves.
- await internals.wheel(50, 50, 0, 100);
+ const secondStep = internals.wheel(50, 50, 0, 100);
+ await firstStep;
+ println(`snap container scroll offset after the first step: ${snapper.scrollTop}`);
+
+ await secondStep;
await animationFrame();
await animationFrame();
println(`snap container scroll offset after the second step: ${snapper.scrollTop}`);
diff --git a/Tests/LibWeb/Text/input/wheel-latch-phase-less-gesture-expires-after-idle.html b/Tests/LibWeb/Text/input/wheel-latch-phase-less-gesture-expires-after-idle.html
index e684e2bf070..fa80fe93d8b 100644
--- a/Tests/LibWeb/Text/input/wheel-latch-phase-less-gesture-expires-after-idle.html
+++ b/Tests/LibWeb/Text/input/wheel-latch-phase-less-gesture-expires-after-idle.html
@@ -22,9 +22,11 @@
await animationFrame();
await animationFrame();
- await internals.wheel(50, 50, 0, 150);
- await internals.wheel(50, 50, 0, 150);
- await internals.wheel(50, 50, 0, 100);
+ await Promise.all([
+ internals.wheel(50, 50, 0, 150),
+ internals.wheel(50, 50, 0, 150),
+ internals.wheel(50, 50, 0, 100),
+ ]);
println(`nested.scrollTop after three ticks: ${nested.scrollTop}`);
println(`window.scrollY after three ticks: ${window.scrollY}`);
diff --git a/Tests/LibWeb/Text/input/wheel-latch-phase-less-ticks-stay-latched-until-cursor-moves.html b/Tests/LibWeb/Text/input/wheel-latch-phase-less-ticks-stay-latched-until-cursor-moves.html
index aa2b782dc61..33f9add893e 100644
--- a/Tests/LibWeb/Text/input/wheel-latch-phase-less-ticks-stay-latched-until-cursor-moves.html
+++ b/Tests/LibWeb/Text/input/wheel-latch-phase-less-ticks-stay-latched-until-cursor-moves.html
@@ -24,9 +24,11 @@
// Mouse wheel ticks carry no gesture phase; ticks in quick succession at one spot are one gesture, which the
// nested scroller absorbs once it reaches its extent.
- await internals.wheel(50, 50, 0, 150);
- await internals.wheel(50, 50, 0, 150);
- await internals.wheel(50, 50, 0, 100);
+ await Promise.all([
+ internals.wheel(50, 50, 0, 150),
+ internals.wheel(50, 50, 0, 150),
+ internals.wheel(50, 50, 0, 100),
+ ]);
println(`nested.scrollTop after three ticks: ${nested.scrollTop}`);
println(`window.scrollY after three ticks: ${window.scrollY}`);