summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/compositing/gestures/gesture-tapHighlight-shadow-tree.html
blob: 6846df1c4c30aa0ce26f15e2925a5acf6559b012 (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
<!DOCTYPE html>
<html>
<script src="resources/link-highlight-helper.js"></script>
<body onload="runTest();">

<template id="shadow-tree">
<a href="" id="targetLink" style="-webkit-tap-highlight-color: rgb(0, 255, 0)"><content></content></a>
</template>

<div id="host" style="transform: translateZ(0); padding: 20px;">
<img width="320" height="240" src="resources/dice.png">
</div>

<script>
useMockHighlight();
var shadowRoot = document.querySelector('#host').createShadowRoot();
shadowRoot.appendChild(document.importNode(document.querySelector('#shadow-tree').content, true));
var targetLink = shadowRoot.querySelector('#targetLink');

function runTest() {
    var clientRect = targetLink.getBoundingClientRect();
    x = (clientRect.left + clientRect.right) / 2;
    y = (clientRect.top + clientRect.bottom) / 2;
    if (window.testRunner) {
        testRunner.dumpAsTextWithPixelResults();
        testRunner.waitUntilDone();
    }

    if (window.eventSender) {
        eventSender.gestureShowPress(x, y);
        window.setTimeout(function() { window.testRunner.notifyDone(); }, 0);
    } else {
        debug("This test requires DumpRenderTree.");
        debug("This test is successful if the image below is covered in a green box with square ranges.");
    }
}
</script>
</body>
</html>