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_smoothscroll_spam.html | |
parent | Initial commit. (diff) | |
download | firefox-esr-upstream.tar.xz firefox-esr-upstream.zip |
Adding upstream version 115.7.0esr.upstream/115.7.0esrupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'gfx/layers/apz/test/mochitest/helper_smoothscroll_spam.html')
-rw-r--r-- | gfx/layers/apz/test/mochitest/helper_smoothscroll_spam.html | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/gfx/layers/apz/test/mochitest/helper_smoothscroll_spam.html b/gfx/layers/apz/test/mochitest/helper_smoothscroll_spam.html new file mode 100644 index 0000000000..154ed3cafe --- /dev/null +++ b/gfx/layers/apz/test/mochitest/helper_smoothscroll_spam.html @@ -0,0 +1,51 @@ +<!DOCTYPE HTML> +<html> +<head> + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width; initial-scale=1.0"> + <title>Test for scenario in bug 1228407</title> + <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 type="application/javascript"> + +async function test() { + let utils = SpecialPowers.getDOMWindowUtils(window); + utils.advanceTimeAndRefresh(0); + + // Part of the problem in bug 1228407 was that the main-thread scroll + // generation counter was continually increasing (due to scrollBy calls in + // quick succession), and so repaint requests from APZ would get ignored (due + // to stale scroll generation), and so the main thread scroll position would + // never actually get updated. This loop exercises that case. The expected + // behaviour (pre-APZ) was that the scrollBy call would actually start the + // scroll animation and advance the scroll position a little bit, so the next + // scrollBy call would move the animation destination a little bit, and so + // the loop would continue advancing the scroll position. The bug resulted + // in the scroll position not advancing at all. + for (let i = 0; i < 100; i++) { + document.scrollingElement.scrollBy({top:60, behavior: "smooth"}); + await promiseOnlyApzControllerFlushed(); + utils.advanceTimeAndRefresh(16); + } + + utils.restoreNormalRefresh(); + await promiseOnlyApzControllerFlushed(); + + let scrollPos = document.scrollingElement.scrollTop; + ok(scrollPos > 60, `Scrolled ${scrollPos}px, should be more than 60`); +} + +waitUntilApzStable().then(test).then(subtestDone, subtestFailed); + + </script> + <style> + body { + height: 5000px; + background: linear-gradient(red, black); + } + </style> +</head> +<body> +</body> +</html> |