blob: 46662a6c2ffd2e818f3fdd8069ab6a168cc2c3ab [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<title>Hit testing of iframe</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<script src="../../../resources/basic-gestures.js"></script>
<script type="text/javascript">
if (window.testRunner)
testRunner.waitUntilDone();
if (window.internals)
internals.settings.setAsyncFrameScrollingEnabled(true);
async function runTest() {
if (!window.testRunner || !testRunner.runUIScript)
return;
// This verifies that a click event is consumed by the element on top the frame.
var p = document.getElementById("clickElementAboveFrame").getBoundingClientRect();
await tapAtPoint(p.left + 50, p.top + 50);
testRunner.notifyDone();
}
</script>
<style>
iframe {
position: absolute;
height: 90px;
width: 90px;
overflow: none;
margin: 0;
border: 0;
padding: 5px;
}
</style>
</head>
<body>
<p>This test passes if you see a green rectangle.</p>
<div style="position: absolute; top: 3em; width: 100px; height: 100px; background: green;">
<iframe id="clickElementAboveFrame" style="left: 0px; top: 0px; -webkit-tap-highlight-color: transparent;" scrolling="yes" onclick="this.style.background='red';" srcdoc="
<body style='margin: 0; width: 200px; height: 200px; background: green;'>
<div style='position: absolute; width: 100px; height: 100px; background: green; -webkit-tap-highlight-color: transparent;'
onclick='this.style.background=&quot;red&quot;'></div>
</body>" onload="runTest()">
</iframe>
<div style="position: absolute; width: 50px; height: 50px; left: 25px; top: 25px; background: red; -webkit-tap-highlight-color: transparent" onclick="this.style.background='green';"></div>
</div>
</body>
</html>