blob: e70e25d53949bae6df6815b717c9ff977974b53c [file] [log] [blame]
<!DOCTYPE html><!-- webkit-test-runner [ useFlexibleViewport=true ] -->
<html>
<head>
<title>This tests the case when the second timer triggers visible content change</title>
<script src="../../../../../resources/basic-gestures.js"></script>
<style>
#tapthis {
width: 400px;
height: 400px;
border: 1px solid green;
}
#becomesVisible {
visibility: hidden;
width: 100px;
height: 100px;
background-color: green;
}
</style>
<script>
async function test() {
if (!window.testRunner || !testRunner.runUIScript)
return;
if (window.internals)
internals.settings.setContentChangeObserverEnabled(true);
testRunner.waitUntilDone();
testRunner.dumpAsText();
let rect = tapthis.getBoundingClientRect();
let x = rect.left + rect.width / 2;
let y = rect.top + rect.height / 2;
await tapAtPoint(x, y);
}
</script>
</head>
<body onload="test()">
<div id=tapthis>PASS if 'clicked' text is not shown below.</div>
<div id=becomesVisible></div>
<pre id=result></pre>
<script>
tapthis.addEventListener("mouseover", function( event ) {
// 1. Install 2 timers on hover
setTimeout(function() {
// 2. Trigger some non-visibility style change with forcing offsetHeight.
becomesVisible.style.marginLeft = "5px";
document.body.offsetHeight;
}, 0);
// 3. Install a longer timer with visibility change.
setTimeout(function() {
becomesVisible.style.visibility = "visible";
document.body.offsetHeight;
setTimeout("testRunner.notifyDone()", 0);
}, 20);
}, false);
becomesVisible.addEventListener("click", function( event ) {
result.innerHTML = "clicked hidden";
}, false);
tapthis.addEventListener("click", function( event ) {
result.innerHTML = "clicked";
}, false);
</script>
</body>
</html>