diff options
Diffstat (limited to 'gfx/layers/apz/test/mochitest/helper_fission_inactivescroller_under_oopif.html')
-rw-r--r-- | gfx/layers/apz/test/mochitest/helper_fission_inactivescroller_under_oopif.html | 88 |
1 files changed, 88 insertions, 0 deletions
diff --git a/gfx/layers/apz/test/mochitest/helper_fission_inactivescroller_under_oopif.html b/gfx/layers/apz/test/mochitest/helper_fission_inactivescroller_under_oopif.html new file mode 100644 index 0000000000..c3099f52ef --- /dev/null +++ b/gfx/layers/apz/test/mochitest/helper_fission_inactivescroller_under_oopif.html @@ -0,0 +1,88 @@ +<!DOCTYPE HTML> +<html> +<head> + <meta charset="utf-8"> + <title>Ensure inactive scollframes under OOPIFs hit-test properly</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); + +let make_oopif_scrollable = function() { + // ensure the oopif is scrollable, and wait for the paint so that the + // compositor also knows it's scrollable. + document.body.style.height = "200vh"; + promiseApzFlushedRepaints().then(() => { + let utils = SpecialPowers.getDOMWindowUtils(window); + let result = { + layersId: utils.getLayersId(), + viewId: utils.getViewId(document.scrollingElement) + }; + dump(`OOPIF computed IDs ${JSON.stringify(result)}\n`); + FissionTestHelper.fireEventInEmbedder("OOPIF:Scrollable", result); + }); + return true; +}; + +async function test() { + let iframe = document.getElementById("testframe"); + + let letScrollerIdPromise = promiseOneEvent(window, "OOPIF:Scrollable", null); + ok(await FissionTestHelper.sendToOopif(iframe, `(${make_oopif_scrollable})()`), + "Ran code to make OOPIF scrollable"); + let oopifScrollerIds = (await letScrollerIdPromise).data; + + // The #scroller div is (a) inactive, and (b) under the OOPIF. Hit-testing + // against it should hit the OOPIF. + + checkHitResult(await fissionHitTest(centerOf("scroller"), iframe), + APZHitResultFlags.VISIBLE, + oopifScrollerIds.viewId, + oopifScrollerIds.layersId, + "Part of OOPIF sitting on top of the inactive scrollframe should hit OOPIF"); +} + + </script> +</head> +<body> +<style> +html, body { + margin: 0; +} +body { + /* Ensure root document is scrollable so that #scroller is inactive by + default */ + height: 200vh; +} +iframe { + position: fixed; + top: 0; + left: 0; + width: 300px; + height: 200px; +} + +#scroller { + width: 200px; + height: 200px; + background-color: transparent; + overflow-y: scroll; +} +</style> +<div id="scroller"> + <div style="height:500px">inside scroller</div> +</div> +<iframe id="testframe"></iframe> +</body> +</html> |