<!DOCTYPE html>
<html>
<head>
<script src="resources/link-highlight-helper.js"></script>
<script src="../../resources/run-after-layout-and-paint.js"></script>
<link rel="stylesheet" href="resources/link-highlight-style.css">
</style>
</head>
<body onload="runTest();" onclick="doNothing();">
<div style="will-change: transform; position: relative; left: 10px; top: 40px">
<a href="" id="targetLink" style="-webkit-tap-highlight-color: rgba(0, 255, 0, 0.5)">Target Link.</a>
</div>
<div style="position: relative; left: 10px; top: 70px">
This test is successful if no link highlight appears (in particular, the entire viewport should remain unchanged, and the background
should be white and not grey).
</div>
<script>
// This test makes sure a previous highlight does not survive beyond the next GestureShowPress, even
// if the new event fails to produce a valid target for highlighting.
function runTest() {
var clientRect = document.getElementById('targetLink').getBoundingClientRect();
x = (clientRect.left + clientRect.right) / 2;
y = (clientRect.top + clientRect.bottom) / 2;
if (window.testRunner)
testRunner.waitUntilDone();
if (window.eventSender) {
// Generate valid link highlight.
eventSender.gestureShowPress(x, y);
runAfterLayoutAndPaint(function() {
// Generate tap in region with no valid target ... this should cancel the first tap.
eventSender.gestureShowPress(150, 150);
testRunner.notifyDone();
});
} else {
debug("This test requires DumpRenderTree.");
}
}
</script>
</script>
</body>
</html>