diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
commit | 36d22d82aa202bb199967e9512281e9a53db42c9 (patch) | |
tree | 105e8c98ddea1c1e4784a60a5a6410fa416be2de /gfx/layers/apz/test/mochitest/helper_bug1682170_pointercancel_on_touchaction_pinchzoom.html | |
parent | Initial commit. (diff) | |
download | firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.tar.xz firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.zip |
Adding upstream version 115.7.0esr.upstream/115.7.0esr
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'gfx/layers/apz/test/mochitest/helper_bug1682170_pointercancel_on_touchaction_pinchzoom.html')
-rw-r--r-- | gfx/layers/apz/test/mochitest/helper_bug1682170_pointercancel_on_touchaction_pinchzoom.html | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/gfx/layers/apz/test/mochitest/helper_bug1682170_pointercancel_on_touchaction_pinchzoom.html b/gfx/layers/apz/test/mochitest/helper_bug1682170_pointercancel_on_touchaction_pinchzoom.html new file mode 100644 index 0000000000..b9c31dfe89 --- /dev/null +++ b/gfx/layers/apz/test/mochitest/helper_bug1682170_pointercancel_on_touchaction_pinchzoom.html @@ -0,0 +1,75 @@ +<!DOCTYPE HTML> +<html> +<head> + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width; initial-scale=1.0"> + <script type="application/javascript" src="apz_test_native_event_utils.js"></script> + <script type="application/javascript" src="apz_test_utils.js"></script> + <script src="/tests/SimpleTest/paint_listener.js"></script> + <script src="/tests/SimpleTest/EventUtils.js"></script> + <script type="application/javascript"> + +async function test() { + var body = document.body; + + // Event listeners just for logging/debugging purposes + body.addEventListener("pointerdown", function(e) { + dump(`Got pointerdown, pointer id ${e.pointerId}\n`); + }); + body.addEventListener("touchstart", function(e) { + dump(`Got touchstart with ${e.touches.length} touches\n`); + }, {passive: true}); + + + // Event listeners relevant to the test. We want to make sure that a + // pointercancel event is dispatched to web content, so we listen for that. + // Also we want to ensure the main thread TouchActionHelper code is run and + // used, so we add a non-passive touchmove listener that ensures the body has + // a d-t-c region. + var gotPointerCancel = false; + body.addEventListener("pointercancel", function(e) { + dump(`Got pointercancel, pointer id ${e.pointerId}\n`); + gotPointerCancel = true; + }); + body.addEventListener("touchmove", function(e) { + dump(`Got touchmove with ${e.touches.length} touches\n`); + }, {passive: false}); + + let touchEndPromise = new Promise(resolve => { + // This listener is just to catch the end of the touch sequence so we can + // end the test at the right time. + body.addEventListener("touchend", function(e) { + dump(`Got touchend with ${e.touches.length} touches\n`); + if (!e.touches.length) { + resolve(); + } + }); + }); + + // We can't await this call, because this pinch action doesn't generate a + // APZ:TransformEnd. Instead we await the touchend. + pinchZoomOutWithTouchAtCenter(); + await touchEndPromise; + + ok(gotPointerCancel, "Checking that we definitely cancelled the pointerevents"); +} + +waitUntilApzStable() +.then(test) +.then(subtestDone, subtestFailed); + + </script> + <style> + body { + height: 5000px; + touch-action: pinch-zoom; + } + </style> +</head> +<body> + A two-finger pinch action here should trigger browser zoom and trigger a pointercancel to content. + Note that the code does a zoom-out and the page is already at min zoom, so + the zoom doesn't produce any visual effect. But the DOM events should be the + same either way. +</body> +</html> |