5 <title>Ensure irregular areas on top of OOPIFs hit-test properly
</title>
6 <script src=
"/tests/SimpleTest/SimpleTest.js"></script>
7 <script src=
"/tests/SimpleTest/paint_listener.js"></script>
8 <script src=
"helper_fission_utils.js"></script>
9 <script src=
"apz_test_utils.js"></script>
10 <script src=
"apz_test_native_event_utils.js"></script>
13 fission_subtest_init();
15 FissionTestHelper
.startTestPromise
16 .then(waitUntilApzStable
)
17 .then(loadOOPIFrame("testframe", "helper_fission_empty.html"))
18 .then(waitUntilApzStable
)
20 .then(FissionTestHelper
.subtestDone
, FissionTestHelper
.subtestFailed
);
22 let make_oopif_scrollable = function() {
23 // ensure the oopif is scrollable, and wait for the paint so that the
24 // compositor also knows it's scrollable.
25 document
.body
.style
.height
= "200vh";
26 promiseApzFlushedRepaints().then(() => {
27 let utils
= SpecialPowers
.getDOMWindowUtils(window
);
29 layersId
: utils
.getLayersId(),
30 viewId
: utils
.getViewId(document
.scrollingElement
)
32 dump(`OOPIF computed IDs ${JSON.stringify(result)}\n`);
33 FissionTestHelper
.fireEventInEmbedder("OOPIF:Scrollable", result
);
38 async
function test() {
39 let iframe
= document
.getElementById("testframe");
41 let oopifScrollerIds
= promiseOneEvent(window
, "OOPIF:Scrollable", null);
42 ok(await FissionTestHelper
.sendToOopif(iframe
, `(${make_oopif_scrollable})()`),
43 "Ran code to make OOPIF scrollable");
44 oopifScrollerIds
= (await oopifScrollerIds
).data
;
46 let utils
= SpecialPowers
.getDOMWindowUtils(window
);
48 // The triangle_overlay div overlays a part of the iframe. We do 3 hit-tests:
49 // - one that hits the opaque part of the overlay
50 // - one that hits the clipped-away part of the overlay div but is still
51 // inside the bounding box
52 // - one that is not on the overlay at all, but on the part of the iframe not
53 // covered by the overlay.
54 // For the latter two, we expect the hit-test to hit the OOPIF.
56 checkHitResult(await
fissionHitTest({x
: 20, y
: 100}, iframe
),
57 APZHitResultFlags
.VISIBLE
,
58 utils
.getViewId(document
.scrollingElement
),
60 "opaque part of overlay should hit parent doc hosting the OOPIF");
62 checkHitResult(await
fissionHitTest({x
: 180, y
: 100}, iframe
),
63 APZHitResultFlags
.VISIBLE
,
64 oopifScrollerIds
.viewId
,
65 oopifScrollerIds
.layersId
,
66 "clipped-away part of overlay should hit OOPIF");
68 checkHitResult(await
fissionHitTest({x
: 250, y
: 100}, iframe
),
69 APZHitResultFlags
.VISIBLE
,
70 oopifScrollerIds
.viewId
,
71 oopifScrollerIds
.layersId
,
72 "part of OOPIF outside the overlay bounding rect should hit the OOPIF");
94 background-color: green;
95 clip-path: polygon(
0%
0%,
100%
100%,
0%
100%);
98 <iframe id=
"testframe"></iframe>
99 <div id=
"triangle_overlay"></div>