summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/compositing/gestures/gesture-tapHighlight-1-overflow-div-scrolled-late-noncomposite.html
blob: a410d4bd90353864853cb8033fd403b0291683cf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<!DOCTYPE html>
<html>
<head>
<script src="../../resources/js-test.js"></script>
<script src="../../resources/run-after-layout-and-paint.js"></script>
<script src="resources/link-highlight-helper.js"></script>
<link rel="stylesheet" type="text/css" href="resources/link-highlight-style.css">
</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="divToControlCompositedLayer" style="transform: translateZ(0);">
<a href="">Link 1</a><br>
<a href="">Link 2</a><br>
<a href="">Link 3</a><br>
<a class="opaqueHighlight needsFix" 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>
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 composited overflow-div, then forces that div to become non-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('divToControlCompositedLayer').style.webkitTransform = "";
            runAfterLayoutAndPaint(function() {
                targetDiv.scrollTop += 20;
                testRunner.notifyDone();
            });
        });
    } else {
        debug("This test requires DumpRenderTree.");
    }
}
</script>
</script>
</body>
</html>