Source code

Revision control

Copy as Markdown

Other Tools

<meta name="viewport" content="width=device-width; initial-scale=1.0">
<title>Test that events are delivered to the correct document near an iframe inide a perspective transform</title>
<script src="apz_test_native_event_utils.js"></script>
<script src="apz_test_utils.js"></script>
<script src="/tests/SimpleTest/paint_listener.js"></script>
div {
position: absolute;
.outer {
left: 300px;
top: 300px;
transform: translate3d(0px, 0px, -500px) perspective(500px);
.inner {
left: -100px;
top: -100px;
iframe {
border: 0;
<div class="outer">
<div class="inner">
<iframe id="iframe" width="300px" height="200px" src=""></iframe>
<script type="application/javascript">
async function test() {
// Wait for iframe to receive content transforms.
await SpecialPowers.spawn(iframe, [], async () => {
await SpecialPowers.contentTransformsReceived(content.window);
let eventPromise = new Promise(resolve => {
window.addEventListener("message", event => {
let data = JSON.parse(;
if ("type" in data && data.type == "got-mouse-down") {
ok(false, "Child document should not have received mouse-down");
window.addEventListener("mousedown", event => {
ok(true, "Parent document should have received mouse-down");
// Click a bit above the iframe, and check the event is delivered
// to the parent document, not the iframe.
await synthesizeNativeMouseEventWithAPZ({
type: "click",
target: document.documentElement,
offsetX: 350,
offsetY: 175
await eventPromise;
.then(subtestDone, subtestFailed);