blob: a2cc27546cd0238227ff13d46ec02d7d4a712ce0 [file] [log] [blame]
<!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 style="transform: translateZ(0); position: relative; left: 10px; top: 10px"></div>
<div id="targetDiv" style="position: relative; left: 10px; top: 40px; width: 200px; height: 100px; overflow-y: scroll; overflow-x: scroll;">
<div id="divToForceCompositedLayer">
<a href="">Link 1</a><br>
<a href="">Link 2</a><br>
<a href="">Link 3</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>
<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 src="../../resources/run-after-layout-and-paint.js"></script>
<script>
function runTest() {
useMockHighlight();
var targetDiv = document.getElementById('targetDiv');
var clientRect = document.getElementById('targetLink').getBoundingClientRect();
x = (clientRect.left + clientRect.right) / 2;
y = (clientRect.top + clientRect.bottom) / 2;
if (window.testRunner) {
testRunner.dumpAsTextWithPixelResults();
testRunner.waitUntilDone();
}
// This test highlights a link in a non-composited overflow-div, then forces that div to become composited,
// then scrolls that div, then exits. If everything is working correctly, the link highlight will still
// be displayed correctly after all these operations.
if (window.eventSender && window.testRunner) {
eventSender.gestureShowPress(x, y);
runAfterLayoutAndPaint(function() {
document.getElementById('divToForceCompositedLayer').style.webkitTransform = 'translateZ(0)';
document.body.offsetTop;
runAfterLayoutAndPaint(function() {
targetDiv.scrollTop += 20;
testRunner.notifyDone();
});
});
} else {
debug("This test requires DumpRenderTree.");
}
}
</script>
</body>
</html>