Truly independent web browser
Tests: Ask the real compositor in wheel routing tests
Aliaksandr Kalenikf9e4286cb4fe
diff --git a/Tests/LibWeb/Text/expected/all-window-properties.txt b/Tests/LibWeb/Text/expected/all-window-properties.txtindex a8ce5a01cb4..1a76db8e0c3 100644--- a/Tests/LibWeb/Text/expected/all-window-properties.txt+++ b/Tests/LibWeb/Text/expected/all-window-properties.txt@@ -606,6 +606,7 @@ __finishTest__preventMultipleTestFunctionsanimationFrameasyncTest+compositorScrollsWheelStepAthttpTestServerprintElementprintInputTracediff --git a/Tests/LibWeb/Text/expected/async-scrolling/blocking-wheel-listener-invalidation.txt b/Tests/LibWeb/Text/expected/async-scrolling/blocking-wheel-listener-invalidation.txtindex a25b4ac8550..02637012430 100644--- a/Tests/LibWeb/Text/expected/async-scrolling/blocking-wheel-listener-invalidation.txt+++ b/Tests/LibWeb/Text/expected/async-scrolling/blocking-wheel-listener-invalidation.txt@@ -1,6 +1,7 @@before routing admission: accepted+routing admission before the next frame: stale-wheel-event-listenerslistener generation increased: true-after routing admission: blocking wheel event listeners+after routing admission: blocking-wheel-event-listenersdisplay list:AccumulatedVisualContext Tree:spatial:diff --git a/Tests/LibWeb/Text/expected/async-scrolling/nested-navigable-wheel-admission.txt b/Tests/LibWeb/Text/expected/async-scrolling/nested-navigable-wheel-admission.txtindex 7efcac70667..30cc302a2a5 100644--- a/Tests/LibWeb/Text/expected/async-scrolling/nested-navigable-wheel-admission.txt+++ b/Tests/LibWeb/Text/expected/async-scrolling/nested-navigable-wheel-admission.txt@@ -1,6 +1,6 @@main thread regions: 1over iframe: blocked-by-main-thread-region-outside iframe: accepted+outside iframe: latched scroller=viewportdisplay list:AccumulatedVisualContext Tree:spatial:diff --git a/Tests/LibWeb/Text/expected/async-scrolling/orthogonal-overflow-padding-wheel-target.txt b/Tests/LibWeb/Text/expected/async-scrolling/orthogonal-overflow-padding-wheel-target.txtindex 2e4c591c35f..a76ce42ab07 100644--- a/Tests/LibWeb/Text/expected/async-scrolling/orthogonal-overflow-padding-wheel-target.txt+++ b/Tests/LibWeb/Text/expected/async-scrolling/orthogonal-overflow-padding-wheel-target.txt@@ -1,3 +1,3 @@client width: 100scroll width: 100-horizontal wheel target: none+horizontal wheel target: no-scroll-targetdiff --git a/Tests/LibWeb/Text/expected/async-scrolling/overflow-hidden-axis-wheel-target.txt b/Tests/LibWeb/Text/expected/async-scrolling/overflow-hidden-axis-wheel-target.txtindex 84f3c594888..0768438657f 100644--- a/Tests/LibWeb/Text/expected/async-scrolling/overflow-hidden-axis-wheel-target.txt+++ b/Tests/LibWeb/Text/expected/async-scrolling/overflow-hidden-axis-wheel-target.txt@@ -1,2 +1,2 @@-horizontal wheel target: non-viewport-vertical wheel target: none+horizontal wheel target: latched scroller=#scroller+vertical wheel target: no-scroll-targetdiff --git a/Tests/LibWeb/Text/expected/async-scrolling/overflow-hidden-scroller-scroll-node.txt b/Tests/LibWeb/Text/expected/async-scrolling/overflow-hidden-scroller-scroll-node.txtindex 1165753717a..18b406dc6c2 100644--- a/Tests/LibWeb/Text/expected/async-scrolling/overflow-hidden-scroller-scroll-node.txt+++ b/Tests/LibWeb/Text/expected/async-scrolling/overflow-hidden-scroller-scroll-node.txt@@ -1,3 +1,3 @@scroll nodes: 1-wheel target: none+wheel target: no-scroll-targetafter a smooth scroll: 500diff --git a/Tests/LibWeb/Text/expected/async-scrolling/rounded-overlay-wheel-target.txt b/Tests/LibWeb/Text/expected/async-scrolling/rounded-overlay-wheel-target.txtindex 2ff5524afa8..c3ebe40ef14 100644--- a/Tests/LibWeb/Text/expected/async-scrolling/rounded-overlay-wheel-target.txt+++ b/Tests/LibWeb/Text/expected/async-scrolling/rounded-overlay-wheel-target.txt@@ -1,2 +1,2 @@-rounded corner wheel target: non-viewport-rounded center wheel target: viewport+rounded corner wheel target: latched scroller=#scroller+rounded center wheel target: latched scroller=viewportdiff --git a/Tests/LibWeb/Text/expected/async-scrolling/snap-container-wheel-step.txt b/Tests/LibWeb/Text/expected/async-scrolling/snap-container-wheel-step.txtindex 4497521528f..a8f4e565a0e 100644--- a/Tests/LibWeb/Text/expected/async-scrolling/snap-container-wheel-step.txt+++ b/Tests/LibWeb/Text/expected/async-scrolling/snap-container-wheel-step.txt@@ -1,4 +1,4 @@-wheel target of a discrete step: non-viewport+wheel target of a discrete step: latched scroller=#scrollerscroll offset when the step's promise resolved: 0,200scrollend events before the gesture settled: 0scroll offset after the gesture settled: 0,200diff --git a/Tests/LibWeb/Text/expected/async-scrolling/snap-container-wheel-target.txt b/Tests/LibWeb/Text/expected/async-scrolling/snap-container-wheel-target.txtindex b9567666ab2..1e8517e7c6b 100644--- a/Tests/LibWeb/Text/expected/async-scrolling/snap-container-wheel-target.txt+++ b/Tests/LibWeb/Text/expected/async-scrolling/snap-container-wheel-target.txt@@ -1,3 +1,3 @@-wheel along the snapping axis: non-viewport-wheel across the snapping axis: non-viewport-wheel chained to the snap container: non-viewport+wheel along the snapping axis: latched scroller=#scroller+wheel across the snapping axis: latched scroller=#scroller+wheel chained to the snap container: latched scroller=#scrollerdiff --git a/Tests/LibWeb/Text/expected/async-scrolling/viewport-wheel-with-nested-scroller.txt b/Tests/LibWeb/Text/expected/async-scrolling/viewport-wheel-with-nested-scroller.txtindex 674302359bd..acf1b0923f9 100644--- a/Tests/LibWeb/Text/expected/async-scrolling/viewport-wheel-with-nested-scroller.txt+++ b/Tests/LibWeb/Text/expected/async-scrolling/viewport-wheel-with-nested-scroller.txt@@ -1,7 +1,7 @@scroll nodes: 2wheel routing admission: accepted-viewport wheel target: viewport-scroller wheel target: non-viewport+viewport wheel target: latched scroller=viewport+scroller wheel target: latched scroller=#scrollerdisplay list:AccumulatedVisualContext Tree:spatial:diff --git a/Tests/LibWeb/Text/expected/async-scrolling/wheel-scroll-admission.txt b/Tests/LibWeb/Text/expected/async-scrolling/wheel-scroll-admission.txtindex 4bdf6269373..9394af127db 100644--- a/Tests/LibWeb/Text/expected/async-scrolling/wheel-scroll-admission.txt+++ b/Tests/LibWeb/Text/expected/async-scrolling/wheel-scroll-admission.txt@@ -1,14 +1,14 @@initial routing admission: accepted-no listener over scroller: true-no scrollable target: false-passive listener over target: true+no listener over scroller: latched scroller=#scroller+no scrollable target: no-scroll-target+passive listener over target: latched scroller=#scroller+blocking element listener before the next frame: stale-wheel-event-listenersblocking element routing admission: accepted-blocking element listener inside: false-blocking element listener outside: true-stale blocking element regions: false-blocking window routing admission: blocking wheel event listeners-blocking window listener: false-stale blocking window regions: false+blocking element listener inside: blocked-by-wheel-event-region+blocking element listener outside: latched scroller=#scroller+blocking window listener before the next frame: stale-wheel-event-listeners+blocking window routing admission: blocking-wheel-event-listeners+blocking window listener: blocking-wheel-event-listenersdisplay list after blocking element listener:AccumulatedVisualContext Tree:spatial:diff --git a/Tests/LibWeb/Text/input/async-scrolling/blocking-wheel-event-region-hit-testing.html b/Tests/LibWeb/Text/input/async-scrolling/blocking-wheel-event-region-hit-testing.htmlindex 0d5a9466972..2afdf53c3dc 100644--- a/Tests/LibWeb/Text/input/async-scrolling/blocking-wheel-event-region-hit-testing.html+++ b/Tests/LibWeb/Text/input/async-scrolling/blocking-wheel-event-region-hit-testing.html@@ -43,7 +43,7 @@}function dump(output, label, x, y) {- output.push(`${label}: ${internals.asyncScrollingStateBlocksWheelEventAt(x, y)}`);+ output.push(`${label}: ${internals.recordedDisplayListBlocksWheelEventAt(x, y)}`);}test(() => {@@ -51,7 +51,8 @@transformed.addEventListener("wheel", event => {}, { passive: false });document.getElementById("clipped-target").addEventListener("wheel", event => {}, { passive: false });- output.push(`blocking regions: ${internals.asyncScrollingState().blockingWheelEventRegionCount}`);+ internals.recordDisplayListForTesting();+ output.push(`blocking regions: ${internals.recordedAsyncScrollingState().blockingWheelEventRegionCount}`);dump(output, "transformed visual inside", 130, 30);dump(output, "transformed original position", 30, 30);dump(output, "clipped visible inside", 30, 170);diff --git a/Tests/LibWeb/Text/input/async-scrolling/blocking-wheel-event-regions.html b/Tests/LibWeb/Text/input/async-scrolling/blocking-wheel-event-regions.htmlindex cfe94d01b8b..106daaf0a27 100644--- a/Tests/LibWeb/Text/input/async-scrolling/blocking-wheel-event-regions.html+++ b/Tests/LibWeb/Text/input/async-scrolling/blocking-wheel-event-regions.html@@ -34,7 +34,8 @@}function dump(output, label) {- const state = internals.asyncScrollingState();+ internals.recordDisplayListForTesting();+ const state = internals.recordedAsyncScrollingState();output.push(`${label}:`);output.push(` blocking listeners: ${state.hasBlockingWheelEventListeners}`);output.push(` viewport blocked: ${state.hasBlockingWheelEventRegionCoveringViewport}`);diff --git a/Tests/LibWeb/Text/input/async-scrolling/blocking-wheel-listener-invalidation.html b/Tests/LibWeb/Text/input/async-scrolling/blocking-wheel-listener-invalidation.htmlindex 04bb1733bb6..10c3f4c4543 100644--- a/Tests/LibWeb/Text/input/async-scrolling/blocking-wheel-listener-invalidation.html+++ b/Tests/LibWeb/Text/input/async-scrolling/blocking-wheel-listener-invalidation.html@@ -19,16 +19,23 @@println(displayList);}- test(() => {+ promiseTest(async () => {+ await animationFrame();+ await animationFrame();const output = [];- const before = internals.asyncScrollingState();- output.push(`before routing admission: ${internals.asyncScrollingStateWheelRoutingAdmission()}`);+ const before = internals.compositorScrollState();+ output.push(`before routing admission: ${before.wheelRoutingAdmission}`);+ // The compositor hears of the listener at once, and holds every wheel step back until a frame shows where the+ // listener is.document.addEventListener("wheel", event => event.preventDefault(), { passive: false });+ output.push(`routing admission before the next frame: ${internals.compositorScrollState().wheelRoutingAdmission}`);- const after = internals.asyncScrollingState();+ await animationFrame();+ await animationFrame();+ const after = internals.compositorScrollState();output.push(`listener generation increased: ${after.wheelEventListenerStateGeneration > before.wheelEventListenerStateGeneration}`);- output.push(`after routing admission: ${internals.asyncScrollingStateWheelRoutingAdmission()}`);+ output.push(`after routing admission: ${after.wheelRoutingAdmission}`);printOutputAndDisplayList(output);});</script>diff --git a/Tests/LibWeb/Text/input/async-scrolling/nested-navigable-wheel-admission.html b/Tests/LibWeb/Text/input/async-scrolling/nested-navigable-wheel-admission.htmlindex e7607ac6772..cc0a33f4ad0 100644--- a/Tests/LibWeb/Text/input/async-scrolling/nested-navigable-wheel-admission.html+++ b/Tests/LibWeb/Text/input/async-scrolling/nested-navigable-wheel-admission.html@@ -18,7 +18,6 @@height: 2000px;}</style>-<iframe id="frame" srcdoc="<body style='height: 1000px'></body>"></iframe><div id="spacer"></div><script>function printOutputAndDisplayList(output) {@@ -30,20 +29,23 @@}promiseTest(async () => {- await new Promise(resolve => {- if (frame.contentDocument && frame.contentDocument.readyState === "complete") {- resolve();- return;- }- frame.onload = resolve;+ // The iframe is made here, so that the test waits for its srcdoc document rather than the initial blank one.+ const frame = document.createElement("iframe");+ const frameLoaded = new Promise(resolve => frame.addEventListener("load", resolve, { once: true }));+ frame.srcdoc = "<body style='height: 1000px'></body>";+ document.body.prepend(frame);+ await frameLoaded;+ // The compositor routes the wheel with the first frame that shows where the iframe is.+ await waitForCondition(() => {+ const state = internals.compositorScrollState();+ return state.document === document && state.mainThreadWheelEventRegionCount > 0;});- await animationFrame();- const state = internals.asyncScrollingState();+ const state = internals.compositorScrollState();const output = [`main thread regions: ${state.mainThreadWheelEventRegionCount}`,- `over iframe: ${internals.asyncScrollingStateWheelScrollAdmissionAt(60, 60, 0, 100)}`,- `outside iframe: ${internals.asyncScrollingStateWheelScrollAdmissionAt(250, 60, 0, 100)}`,+ `over iframe: ${wheelTargetToString(internals.compositorWheelTargetAt(60, 60, 0, 100))}`,+ `outside iframe: ${wheelTargetToString(internals.compositorWheelTargetAt(250, 60, 0, 100))}`,];printOutputAndDisplayList(output);});diff --git a/Tests/LibWeb/Text/input/async-scrolling/orthogonal-overflow-padding-wheel-target.html b/Tests/LibWeb/Text/input/async-scrolling/orthogonal-overflow-padding-wheel-target.htmlindex 8c623ac6fc3..105971b73ba 100644--- a/Tests/LibWeb/Text/input/async-scrolling/orthogonal-overflow-padding-wheel-target.html+++ b/Tests/LibWeb/Text/input/async-scrolling/orthogonal-overflow-padding-wheel-target.html@@ -20,9 +20,11 @@</style><div id="scroller"><div id="spacer"></div></div><script>- test(() => {+ promiseTest(async () => {+ await animationFrame();+ await animationFrame();println(`client width: ${scroller.clientWidth}`);println(`scroll width: ${scroller.scrollWidth}`);- println(`horizontal wheel target: ${internals.asyncScrollingStateWheelTargetAt(50, 50, 100, 0)}`);+ println(`horizontal wheel target: ${wheelTargetToString(internals.compositorWheelTargetAt(50, 50, 100, 0))}`);});</script>diff --git a/Tests/LibWeb/Text/input/async-scrolling/overflow-hidden-axis-wheel-target.html b/Tests/LibWeb/Text/input/async-scrolling/overflow-hidden-axis-wheel-target.htmlindex 3b833f95285..679467d13b6 100644--- a/Tests/LibWeb/Text/input/async-scrolling/overflow-hidden-axis-wheel-target.html+++ b/Tests/LibWeb/Text/input/async-scrolling/overflow-hidden-axis-wheel-target.html@@ -19,8 +19,10 @@</style><div id="scroller"><div id="spacer"></div></div><script>- test(() => {- println(`horizontal wheel target: ${internals.asyncScrollingStateWheelTargetAt(50, 50, 100, 0)}`);- println(`vertical wheel target: ${internals.asyncScrollingStateWheelTargetAt(50, 50, 0, 100)}`);+ promiseTest(async () => {+ await animationFrame();+ await animationFrame();+ println(`horizontal wheel target: ${wheelTargetToString(internals.compositorWheelTargetAt(50, 50, 100, 0))}`);+ println(`vertical wheel target: ${wheelTargetToString(internals.compositorWheelTargetAt(50, 50, 0, 100))}`);});</script>diff --git a/Tests/LibWeb/Text/input/async-scrolling/overflow-hidden-scroller-scroll-node.html b/Tests/LibWeb/Text/input/async-scrolling/overflow-hidden-scroller-scroll-node.htmlindex 662aadff771..72aa18c3dd3 100644--- a/Tests/LibWeb/Text/input/async-scrolling/overflow-hidden-scroller-scroll-node.html+++ b/Tests/LibWeb/Text/input/async-scrolling/overflow-hidden-scroller-scroll-node.html@@ -3,10 +3,10 @@<div id="scroller" style="width: 100px; height: 100px; overflow: hidden"><div style="height: 2000px"></div></div><script>promiseTest(async () => {- await waitForCondition(() => internals.asyncScrollingStateWheelRoutingAdmission() !== "no async scrolling state");+ await waitForCondition(() => internals.compositorScrollState().document === document);- println(`scroll nodes: ${internals.asyncScrollingState().scrollNodes.length}`);- println(`wheel target: ${internals.asyncScrollingStateWheelTargetAt(50, 50, 0, 100)}`);+ println(`scroll nodes: ${internals.compositorScrollState().scrollNodes.length}`);+ println(`wheel target: ${wheelTargetToString(internals.compositorWheelTargetAt(50, 50, 0, 100))}`);scroller.scrollTo({ top: 500, behavior: "smooth" });await scrollendEvent(scroller);diff --git a/Tests/LibWeb/Text/input/async-scrolling/rounded-overlay-wheel-target.html b/Tests/LibWeb/Text/input/async-scrolling/rounded-overlay-wheel-target.htmlindex d90f548f0fb..f485463b70a 100644--- a/Tests/LibWeb/Text/input/async-scrolling/rounded-overlay-wheel-target.html+++ b/Tests/LibWeb/Text/input/async-scrolling/rounded-overlay-wheel-target.html@@ -38,8 +38,10 @@<div id="overlay"></div><div id="page-spacer"></div><script>- test(() => {- println(`rounded corner wheel target: ${internals.asyncScrollingStateWheelTargetAt(5, 5, 0, 100)}`);- println(`rounded center wheel target: ${internals.asyncScrollingStateWheelTargetAt(50, 50, 0, 100)}`);+ promiseTest(async () => {+ await animationFrame();+ await animationFrame();+ println(`rounded corner wheel target: ${wheelTargetToString(internals.compositorWheelTargetAt(5, 5, 0, 100))}`);+ println(`rounded center wheel target: ${wheelTargetToString(internals.compositorWheelTargetAt(50, 50, 0, 100))}`);});</script>diff --git a/Tests/LibWeb/Text/input/async-scrolling/scroll-tree-parent-nodes.html b/Tests/LibWeb/Text/input/async-scrolling/scroll-tree-parent-nodes.htmlindex 5172be4725c..7cfab817adc 100644--- a/Tests/LibWeb/Text/input/async-scrolling/scroll-tree-parent-nodes.html+++ b/Tests/LibWeb/Text/input/async-scrolling/scroll-tree-parent-nodes.html@@ -34,8 +34,10 @@println(displayList);}- test(() => {- const state = internals.asyncScrollingState();+ promiseTest(async () => {+ await animationFrame();+ await animationFrame();+ const state = internals.compositorScrollState();const scrollNodeIDs = new Set(state.scrollNodes.map(node => `${node.documentID}:${node.scrollNodeIndex}`));const viewportNode = state.scrollNodes.find(node => node.isViewport);const childNodes = state.scrollNodes.filter(node => !node.isViewport);diff --git a/Tests/LibWeb/Text/input/async-scrolling/scroll-tree-shape.html b/Tests/LibWeb/Text/input/async-scrolling/scroll-tree-shape.htmlindex c7719a3233d..71de45d745c 100644--- a/Tests/LibWeb/Text/input/async-scrolling/scroll-tree-shape.html+++ b/Tests/LibWeb/Text/input/async-scrolling/scroll-tree-shape.html@@ -27,8 +27,10 @@println(displayList);}- test(() => {- const state = internals.asyncScrollingState();+ promiseTest(async () => {+ await animationFrame();+ await animationFrame();+ const state = internals.compositorScrollState();const output = [`scroll node count: ${state.scrollNodeCount}`,`scroll nodes: ${state.scrollNodes.length}`,diff --git a/Tests/LibWeb/Text/input/async-scrolling/snap-container-metadata.html b/Tests/LibWeb/Text/input/async-scrolling/snap-container-metadata.htmlindex e82316bef5d..012014520c7 100644--- a/Tests/LibWeb/Text/input/async-scrolling/snap-container-metadata.html+++ b/Tests/LibWeb/Text/input/async-scrolling/snap-container-metadata.html@@ -74,8 +74,10 @@<div class="section"></div><div class="section"></div><script>- test(() => {- const state = internals.asyncScrollingState();+ promiseTest(async () => {+ await animationFrame();+ await animationFrame();+ const state = internals.compositorScrollState();println(`device pixels per CSS pixel: ${state.devicePixelsPerCssPixel}`);const rect = ({ x, y, width, height }) => `${x},${y} ${width}x${height}`;diff --git a/Tests/LibWeb/Text/input/async-scrolling/snap-container-wheel-step.html b/Tests/LibWeb/Text/input/async-scrolling/snap-container-wheel-step.htmlindex 9811824fa9b..36de83c809d 100644--- a/Tests/LibWeb/Text/input/async-scrolling/snap-container-wheel-step.html+++ b/Tests/LibWeb/Text/input/async-scrolling/snap-container-wheel-step.html@@ -28,7 +28,7 @@await animationFrame();await animationFrame();- println(`wheel target of a discrete step: ${internals.asyncScrollingStateWheelTargetAt(50, 50, 0, 10)}`);+ println(`wheel target of a discrete step: ${wheelTargetToString(internals.compositorWheelTargetAt(50, 50, 0, 10))}`);// The step's promise resolves once the snap scroll the compositor started for it has completed, so the// scrolling box already rests at the snap position when it does.diff --git a/Tests/LibWeb/Text/input/async-scrolling/snap-container-wheel-target.html b/Tests/LibWeb/Text/input/async-scrolling/snap-container-wheel-target.htmlindex fe4f65981a1..0b4a6819494 100644--- a/Tests/LibWeb/Text/input/async-scrolling/snap-container-wheel-target.html+++ b/Tests/LibWeb/Text/input/async-scrolling/snap-container-wheel-target.html@@ -30,14 +30,18 @@<div class="item"></div></div><script>- test(() => {+ promiseTest(async () => {+ await animationFrame();+ await animationFrame();// The compositor selects the snap positions of the wheel scrolls it performs itself, so a snap container is// scrolled on it whatever the input's precision or gesture phase.- println(`wheel along the snapping axis: ${internals.asyncScrollingStateWheelTargetAt(175, 150, 0, 50)}`);- println(`wheel across the snapping axis: ${internals.asyncScrollingStateWheelTargetAt(175, 150, 50, 0)}`);+ println(`wheel along the snapping axis: ${wheelTargetToString(internals.compositorWheelTargetAt(175, 150, 0, 50))}`);+ println(`wheel across the snapping axis: ${wheelTargetToString(internals.compositorWheelTargetAt(175, 150, 50, 0))}`);// The inner scroller reaches its scroll extent, so a wheel over it chains to the snap container around it.document.getElementById("inner").scrollTop = 100;- println(`wheel chained to the snap container: ${internals.asyncScrollingStateWheelTargetAt(50, 50, 0, 50)}`);+ await animationFrame();+ await animationFrame();+ println(`wheel chained to the snap container: ${wheelTargetToString(internals.compositorWheelTargetAt(50, 50, 0, 50))}`);});</script>diff --git a/Tests/LibWeb/Text/input/async-scrolling/viewport-wheel-with-nested-scroller.html b/Tests/LibWeb/Text/input/async-scrolling/viewport-wheel-with-nested-scroller.htmlindex 644657b4367..7e471c79f93 100644--- a/Tests/LibWeb/Text/input/async-scrolling/viewport-wheel-with-nested-scroller.html+++ b/Tests/LibWeb/Text/input/async-scrolling/viewport-wheel-with-nested-scroller.html@@ -30,14 +30,16 @@println(displayList);}- test(() => {- const state = internals.asyncScrollingState();+ promiseTest(async () => {+ await animationFrame();+ await animationFrame();+ const state = internals.compositorScrollState();printOutputAndDisplayList([`scroll nodes: ${state.scrollNodeCount}`,- `wheel routing admission: ${internals.asyncScrollingStateWheelRoutingAdmission()}`,- `viewport wheel target: ${internals.asyncScrollingStateWheelTargetAt(150, 150, 0, 100)}`,- `scroller wheel target: ${internals.asyncScrollingStateWheelTargetAt(50, 50, 0, 100)}`,+ `wheel routing admission: ${state.wheelRoutingAdmission}`,+ `viewport wheel target: ${wheelTargetToString(internals.compositorWheelTargetAt(150, 150, 0, 100))}`,+ `scroller wheel target: ${wheelTargetToString(internals.compositorWheelTargetAt(50, 50, 0, 100))}`,]);});</script>diff --git a/Tests/LibWeb/Text/input/async-scrolling/wheel-reversal-in-new-gesture-before-first-frame.html b/Tests/LibWeb/Text/input/async-scrolling/wheel-reversal-in-new-gesture-before-first-frame.htmlindex 79a086a62ce..bd0d405052c 100644--- a/Tests/LibWeb/Text/input/async-scrolling/wheel-reversal-in-new-gesture-before-first-frame.html+++ b/Tests/LibWeb/Text/input/async-scrolling/wheel-reversal-in-new-gesture-before-first-frame.html@@ -18,7 +18,7 @@<script>promiseTest(async () => {window.scrollTo(0, 100);- await waitForCondition(() => internals.asyncScrollingStateCanWheelScrollAt(50, 50, 0, 200));+ await waitForCondition(() => compositorScrollsWheelStepAt(50, 50, 0, 200));// The second step lands 30 CSS pixels from the first, so it starts a gesture of its own.const settled = scrollendEvent(nested);diff --git a/Tests/LibWeb/Text/input/async-scrolling/wheel-scroll-admission.html b/Tests/LibWeb/Text/input/async-scrolling/wheel-scroll-admission.htmlindex 2aaf04d4047..de6b1540102 100644--- a/Tests/LibWeb/Text/input/async-scrolling/wheel-scroll-admission.html+++ b/Tests/LibWeb/Text/input/async-scrolling/wheel-scroll-admission.html@@ -42,34 +42,43 @@println(displayList);}- function canWheel(output, label, x, y, forceStaleWheelEventRegions = false) {- const canScroll = internals.asyncScrollingStateCanWheelScrollAt(x, y, 0, 100, forceStaleWheelEventRegions);- output.push(`${label}: ${canScroll}`);+ function wheelTarget(output, label, x, y) {+ output.push(`${label}: ${wheelTargetToString(internals.compositorWheelTargetAt(x, y, 0, 100))}`);}- test(() => {+ async function frames() {+ await animationFrame();+ await animationFrame();+ }++ promiseTest(async () => {+ await frames();const output = [];- output.push(`initial routing admission: ${internals.asyncScrollingStateWheelRoutingAdmission()}`);- canWheel(output, "no listener over scroller", 150, 150);- canWheel(output, "no scrollable target", 275, 50);+ output.push(`initial routing admission: ${internals.compositorScrollState().wheelRoutingAdmission}`);+ wheelTarget(output, "no listener over scroller", 150, 150);+ wheelTarget(output, "no scrollable target", 275, 50);target.addEventListener("wheel", event => {}, { passive: true });- canWheel(output, "passive listener over target", 50, 50);+ await frames();+ wheelTarget(output, "passive listener over target", 50, 50);+ // A blocking listener holds every step back until a frame shows where the listener is.const blockingElementListener = event => {};target.addEventListener("wheel", blockingElementListener, { passive: false });- output.push(`blocking element routing admission: ${internals.asyncScrollingStateWheelRoutingAdmission()}`);- canWheel(output, "blocking element listener inside", 50, 50);- canWheel(output, "blocking element listener outside", 150, 150);- canWheel(output, "stale blocking element regions", 150, 150, true);+ wheelTarget(output, "blocking element listener before the next frame", 150, 150);+ await frames();+ output.push(`blocking element routing admission: ${internals.compositorScrollState().wheelRoutingAdmission}`);+ wheelTarget(output, "blocking element listener inside", 50, 50);+ wheelTarget(output, "blocking element listener outside", 150, 150);const displayList = internals.dumpDisplayList();target.removeEventListener("wheel", blockingElementListener);const blockingWindowListener = event => {};window.addEventListener("wheel", blockingWindowListener, { passive: false });- output.push(`blocking window routing admission: ${internals.asyncScrollingStateWheelRoutingAdmission()}`);- canWheel(output, "blocking window listener", 150, 150);- canWheel(output, "stale blocking window regions", 150, 150, true);+ wheelTarget(output, "blocking window listener before the next frame", 150, 150);+ await frames();+ output.push(`blocking window routing admission: ${internals.compositorScrollState().wheelRoutingAdmission}`);+ wheelTarget(output, "blocking window listener", 150, 150);printOutputAndDisplayList(output, displayList, "display list after blocking element listener:");});</script>diff --git a/Tests/LibWeb/Text/input/async-scrolling/wheel-steps-scroll-smoothly.html b/Tests/LibWeb/Text/input/async-scrolling/wheel-steps-scroll-smoothly.htmlindex 4ef47a533ef..2e77ef4da6e 100644--- a/Tests/LibWeb/Text/input/async-scrolling/wheel-steps-scroll-smoothly.html+++ b/Tests/LibWeb/Text/input/async-scrolling/wheel-steps-scroll-smoothly.html@@ -8,7 +8,7 @@promiseTest(async () => {const scroller = document.getElementById("scroller");- await waitForCondition(() => internals.asyncScrollingStateCanWheelScrollAt(50, 50, 0, 120) && internals.asyncScrollingStateCanWheelScrollAt(400, 400, 0, 120));+ await waitForCondition(() => compositorScrollsWheelStepAt(50, 50, 0, 120) && compositorScrollsWheelStepAt(400, 400, 0, 120));// A step that jumps fires one scroll event. A step that animates fires one per frame.const scrollEventsUntilScrollend = async (target, x, y, deltas) => {diff --git a/Tests/LibWeb/Text/input/css/scroll-state-scrolled-reversed-user-scroll.html b/Tests/LibWeb/Text/input/css/scroll-state-scrolled-reversed-user-scroll.htmlindex a46f7edea66..21408234102 100644--- a/Tests/LibWeb/Text/input/css/scroll-state-scrolled-reversed-user-scroll.html+++ b/Tests/LibWeb/Text/input/css/scroll-state-scrolled-reversed-user-scroll.html@@ -53,7 +53,7 @@const listenerWheelScroller = document.getElementById("listener-wheel-scroller");listenerWheelScroller.addEventListener("wheel", () => {}, { passive: false });const rect = listenerWheelScroller.getBoundingClientRect();- await waitForCondition(() => internals.asyncScrollingStateBlocksWheelEventAt(rect.left + 50, rect.top + 50));+ await waitForCondition(() => internals.compositorWheelTargetAt(rect.left + 50, rect.top + 50, 0, 10).decision === "blocked-by-wheel-event-region");await wheelAt(listenerWheelScroller, [200, -40]);report("Wheel with a blocking listener", listenerWheelScroller);});diff --git a/Tests/LibWeb/Text/input/include.js b/Tests/LibWeb/Text/input/include.jsindex 2e470f0c8e4..116f331cdc2 100644--- a/Tests/LibWeb/Text/input/include.js+++ b/Tests/LibWeb/Text/input/include.js@@ -120,6 +120,13 @@ function wheelTargetToString(target) {return `${target.decision}${__describeScrollerOfInputHook(target)}`;}+// Whether the compositor, holding a frame of this document, would scroll the first step of a wheel gesture at the+// position itself.+function compositorScrollsWheelStepAt(x, y, deltaX, deltaY) {+ const target = internals.compositorWheelTargetAt(x, y, deltaX, deltaY);+ return target.document === document && target.decision === "latched";+}+// Prints what internals.takeInputTrace() returned, one routing decision per line, optionally only those of the given// stages. Input events are numbered in the order they first appear, as the ids the UI gives them keep growing from test// to test; input that did not come from the UI is marked "-".diff --git a/Tests/LibWeb/Text/input/scroll-snap-wheel-step-of-a-new-gesture-during-snap-scroll.html b/Tests/LibWeb/Text/input/scroll-snap-wheel-step-of-a-new-gesture-during-snap-scroll.htmlindex 0608faa8c53..0106c2de86a 100644--- a/Tests/LibWeb/Text/input/scroll-snap-wheel-step-of-a-new-gesture-during-snap-scroll.html+++ b/Tests/LibWeb/Text/input/scroll-snap-wheel-step-of-a-new-gesture-during-snap-scroll.html@@ -48,7 +48,7 @@// A blocking wheel event listener keeps the scrolling on the main thread. Each step is taken 30px away from the// one before it, so it starts a new gesture while the snap scroll of the previous one is still in flight.window.addEventListener("wheel", () => {}, { passive: false });- await waitForCondition(() => internals.asyncScrollingStateBlocksWheelEventAt(50, 50));+ await waitForCondition(() => internals.compositorWheelTargetAt(50, 50, 0, 10).decision === "blocking-wheel-event-listeners");const wheelStepsWhileMovingThePointer = async (x, y, deltas, scrolledTargets) => {const settled = Promise.all(scrolledTargets.map(target => scrollendEvent(target)));diff --git a/Tests/LibWeb/Text/input/wheel-scroll-continues-after-listener-added.html b/Tests/LibWeb/Text/input/wheel-scroll-continues-after-listener-added.htmlindex cbbbbda82a5..1ccbf82673e 100644--- a/Tests/LibWeb/Text/input/wheel-scroll-continues-after-listener-added.html+++ b/Tests/LibWeb/Text/input/wheel-scroll-continues-after-listener-added.html@@ -5,7 +5,7 @@</div><script>promiseTest(async () => {- await waitForCondition(() => internals.asyncScrollingStateCanWheelScrollAt(50, 50, 0, 120));+ await waitForCondition(() => compositorScrollsWheelStepAt(50, 50, 0, 120));// A blocking listener added between the steps sends the second step through the main thread.const finished = scrollendEvent(scroller);