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_fission_large_subframe.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_fission_large_subframe.html')
-rw-r--r-- | gfx/layers/apz/test/mochitest/helper_fission_large_subframe.html | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/gfx/layers/apz/test/mochitest/helper_fission_large_subframe.html b/gfx/layers/apz/test/mochitest/helper_fission_large_subframe.html new file mode 100644 index 0000000000..3d5595f48e --- /dev/null +++ b/gfx/layers/apz/test/mochitest/helper_fission_large_subframe.html @@ -0,0 +1,67 @@ +<!DOCTYPE HTML> +<html id="rcd_docelement"> +<head> + <meta charset="utf-8"> + <title>Test that large OOPIF does not get a too-large displayport</title> + <script src="/tests/SimpleTest/SimpleTest.js"></script> + <script src="/tests/SimpleTest/paint_listener.js"></script> + <script src="helper_fission_utils.js"></script> + <script src="apz_test_utils.js"></script> + <script src="apz_test_native_event_utils.js"></script> + <script> + +fission_subtest_init(); + +FissionTestHelper.startTestPromise + .then(waitUntilApzStable) + .then(loadOOPIFrame("testframe", "helper_fission_empty.html")) + .then(waitUntilApzStable) + .then(test) + .then(FissionTestHelper.subtestDone, FissionTestHelper.subtestFailed); + +// Code that will run inside the iframe. +let get_iframe_displayport = function() { + // Give the page a scroll range. This will make the unclamped displayport + // even taller. + document.body.style.height = "200vh"; + // Do a round-trip to APZ to make sure the scroll range is reflected + // in the displayport it sets. + promiseApzFlushedRepaints().then(() => { + // Query the composed displayport and report it to the embedder. + let result = getLastContentDisplayportFor("fission_empty_docelement"); + FissionTestHelper.fireEventInEmbedder("OOPIF:Displayport", result); + }); + return true; +}; + +async function test() { + let iframeElement = document.getElementById("testframe"); + + // Give the page a scroll range and make sure APZ sets non-empty displayport margins. + document.body.style.height = "500vh"; + await promiseApzFlushedRepaints(); + + // Query the iframe's displayport. + let displayportPromise = promiseOneEvent(window, "OOPIF:Displayport", null); + ok(await FissionTestHelper.sendToOopif(iframeElement, `(${get_iframe_displayport})()`), "Gotten iframe displayport"); + let iframeDp = (await displayportPromise).data; + dump("iframe displayport is " + JSON.stringify(iframeDp) + "\n"); + + // Query the page's displayport. + let dp = getLastContentDisplayportFor("rcd_docelement"); + dump("page displayport is " + JSON.stringify(dp) + "\n"); + + // Check that the iframe's displayport is no more than twice as tall as + // the page's displayport. The reason it can be up to twice as tall is + // described in bug 1690697; we may be able to assert a tighter bound + // after making improvements in that bug. + ok(iframeDp.height <= (dp.height * 2), "iframe displayport should be no more than twice as tall as page displayport"); +} + + </script> +</head> +<body> +<!-- Make the iframe's viewport very tall --> +<iframe style="margin-top: 200px" id="testframe" height="10000px"></iframe> +</body> +</html> |