Truly independent web browser
Tests/LibWeb: Test a script scroll beside a compositor zoom
Andreas Klinga35d2b9e5164
diff --git a/Tests/LibWeb/Text/expected/async-scrolling/pinch-survives-a-script-scroll-with-the-old-scale.txt b/Tests/LibWeb/Text/expected/async-scrolling/pinch-survives-a-script-scroll-with-the-old-scale.txtnew file mode 100644index 00000000000..c0a45a5fbfc--- /dev/null+++ b/Tests/LibWeb/Text/expected/async-scrolling/pinch-survives-a-script-scroll-with-the-old-scale.txt@@ -0,0 +1,2 @@+beside the task: compositor scale: 3, main thread scale: 1.5+after the task: compositor scale: 1.5, main thread scale: 1.5diff --git a/Tests/LibWeb/Text/input/async-scrolling/pinch-survives-a-script-scroll-with-the-old-scale.html b/Tests/LibWeb/Text/input/async-scrolling/pinch-survives-a-script-scroll-with-the-old-scale.htmlnew file mode 100644index 00000000000..afdc5b4142e--- /dev/null+++ b/Tests/LibWeb/Text/input/async-scrolling/pinch-survives-a-script-scroll-with-the-old-scale.html@@ -0,0 +1,38 @@+<!DOCTYPE html>+<script src="../include.js"></script>+<style>+ body {+ margin: 0;+ height: 5000px;+ }+</style>+<script>+ // The compositor zooms beside this task, and the task scrolls before it has heard of the new scale. The scroll must+ // leave the scale alone, or the zoom would be undone.+ promiseTest(async () => {+ const compositorScale = () => internals.compositorScrollState().visualViewportScale;+ await animationFrame();+ await animationFrame();+ internals.synchronizeCompositor();++ internals.pinchThroughUIProcess(400, 300, 0.5);+ while (visualViewport.scale !== 1.5) await animationFrame();+ await animationFrame();+ internals.synchronizeCompositor();++ internals.pinchThroughUIProcess(400, 300, 1);+ // NB: This only gives up on a zoom that never comes, so the time limit can't fail a slow machine's run of a+ // fixed engine.+ const giveUpAt = performance.now() + 2000;+ while (compositorScale() !== 3 && performance.now() < giveUpAt) {+ // Stay in this task.+ }+ println(`beside the task: compositor scale: ${compositorScale()}, main thread scale: ${visualViewport.scale}`);+ window.scrollTo(0, 10);++ const settleUntil = performance.now() + 500;+ while (performance.now() < settleUntil) await animationFrame();+ internals.synchronizeCompositor();+ println(`after the task: compositor scale: ${compositorScale()}, main thread scale: ${visualViewport.scale}`);+ });+</script>