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_checkerboard_no_multiplier.html | |
parent | Initial commit. (diff) | |
download | firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.tar.xz firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.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_checkerboard_no_multiplier.html')
-rw-r--r-- | gfx/layers/apz/test/mochitest/helper_checkerboard_no_multiplier.html | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/gfx/layers/apz/test/mochitest/helper_checkerboard_no_multiplier.html b/gfx/layers/apz/test/mochitest/helper_checkerboard_no_multiplier.html new file mode 100644 index 0000000000..149ef9fbba --- /dev/null +++ b/gfx/layers/apz/test/mochitest/helper_checkerboard_no_multiplier.html @@ -0,0 +1,57 @@ +<!DOCTYPE html> +<html lang="en"><head> +<meta http-equiv="content-type" content="text/html; charset=UTF-8"><meta charset="utf-8"> +<title>Testcase for checkerboarding with displayport multipliers dropped to zero</title> +<script type="application/javascript" src="apz_test_utils.js"></script> +<script src="/tests/SimpleTest/paint_listener.js"></script> +<meta name="viewport" content="width=device-width"/> +<style> +body, html { + margin: 0; +} +</style> +<body> + <div style="height: 5000px; background-color: green"></div> +</body> +<script type="application/javascript"> +async function test() { + var utils = SpecialPowers.getDOMWindowUtils(window); + var scrollerId = utils.getViewId(document.scrollingElement); + + // Zoom in a bunch + const scale = 3.0; + utils.setResolutionAndScaleTo(scale); + + // And now we scroll the visual viewport to cover the range it has inside + // the layout viewport, plus a bit more so that we also cover the boundary + // case where the layout viewport has to move. + // At each scroll position, we make sure there's no checkerboarding. + // We advance the scroll position on each axis by 43 CSS pixels at a time, + // because 43 is a non-power-of-two/prime number and should give us reasonable + // coverage of different displayport tile alignment values. Making the + // increment too small increases runtime and too large might miss some + // alignment values so this seems like a good number. + + async function scrollAndCheck(x, y) { + dump(`Scrolling visual viewport to ${x}, ${y}\n`); + utils.scrollToVisual(x, y, utils.UPDATE_TYPE_MAIN_THREAD, utils.SCROLL_MODE_INSTANT); + await promiseApzFlushedRepaints(); + assertNotCheckerboarded(utils, scrollerId, `At ${x}, ${y}`); + } + + let vv_scrollable_x = window.innerWidth - (window.innerWidth / scale); + for (var x = 0; x < vv_scrollable_x + 100; x += 43) { + await scrollAndCheck(x, 0); + } + ok(window.scrollX == 0, "Layout viewport couldn't move on the x-axis, page not scrollable that way"); + let vv_scrollable_y = window.innerHeight - (window.innerHeight / scale); + for (var y = 0; y < vv_scrollable_y + 100; y += 43) { + await scrollAndCheck(0, y); + } + ok(window.scrollY > 0, `Layout viewport moved down to ${window.scrollY} on the y-axis`); +} + +waitUntilApzStable() +.then(test) +.then(subtestDone, subtestFailed) +</script> |