chromium/third_party/blink/web_tests/compositing/gestures/gesture-tapHighlight-1-overflow-div-layout-change.html

<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="resources/link-highlight-style.css">
<script src="resources/link-highlight-helper.js"></script>
</head>
<body onload="runTest();">
<div id="targetDiv" style="will-change: transform; position: relative; left: 10px; top: 10px"></div>
<div style="position: relative; left: 10px; top: 40px; width: 200px; height: 100px; overflow-y: scroll; overflow-x: scroll;">
<a href="">Link 1</a><br>
<a href="">Link 2</a><br>
<a class="opaqueHighlight" href="" id="targetLink">Target Link.</a><br>
<a href="">Link 4</a><br>
<a href="">Link 5</a><br>
</div>
<div style="position: relative; left: 10px; top: 80px">
This test is successful if "Target Link" above is covered in a green rectangle with square corners.
</div>
<script>
function runTest() {
    useMockHighlight();
    var targetLink = document.getElementById('targetLink');
    var clientRect = document.getElementById('targetLink').getBoundingClientRect();
    x = (clientRect.left + clientRect.right) / 2;
    y = (clientRect.top + clientRect.bottom) / 2;
    if (window.testRunner)
        testRunner.waitUntilDone();

    // In this test a link highlight is commenced, then a new node is inserted before the highlight
    // target, forcing a layout change that moves the target node mid-animation.
    if (window.eventSender) {
        eventSender.gestureShowPress(x, y);
        var newLink = document.createElement('a');
        newLink.setAttribute('href', '');
        newLink.innerHTML = 'Link 3';
        targetLink.parentNode.insertBefore(newLink, targetLink);
        targetLink.parentNode.insertBefore(document.createElement('br'), targetLink)
        window.setTimeout(function() { testRunner.notifyDone(); }, 0);
    } else {
        debug("This test requires DumpRenderTree.");
    }
}
</script>
</script>
</body>
</html>