OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <html> |
3 <script src="resources/link-highlight-helper.js"></script> | 3 <script src="resources/link-highlight-helper.js"></script> |
4 <body onload="runTest();"> | 4 <body onload="runTest();"> |
5 | 5 |
6 <template id="shadow-tree"> | 6 <template id="shadow-tree"> |
7 <a href="" id="targetLink" style="-webkit-tap-highlight-color: rgb(0, 255, 0)"><
content></content></a> | 7 <a href="" id="targetLink" style="-webkit-tap-highlight-color: rgb(0, 255, 0)"><
content></content></a> |
8 </template> | 8 </template> |
9 | 9 |
10 <div id="host" style="-webkit-transform: translateZ(0); padding: 20px;"> | 10 <div id="host" style="transform: translateZ(0); padding: 20px;"> |
11 <img width="320" height="240" src="resources/dice.png"> | 11 <img width="320" height="240" src="resources/dice.png"> |
12 </div> | 12 </div> |
13 | 13 |
14 <script> | 14 <script> |
15 useMockHighlight(); | 15 useMockHighlight(); |
16 var shadowRoot = document.querySelector('#host').createShadowRoot(); | 16 var shadowRoot = document.querySelector('#host').createShadowRoot(); |
17 shadowRoot.appendChild(document.importNode(document.querySelector('#shadow-tree'
).content, true)); | 17 shadowRoot.appendChild(document.importNode(document.querySelector('#shadow-tree'
).content, true)); |
18 var targetLink = shadowRoot.querySelector('#targetLink'); | 18 var targetLink = shadowRoot.querySelector('#targetLink'); |
19 | 19 |
20 function runTest() { | 20 function runTest() { |
21 var clientRect = targetLink.getBoundingClientRect(); | 21 var clientRect = targetLink.getBoundingClientRect(); |
22 x = (clientRect.left + clientRect.right) / 2; | 22 x = (clientRect.left + clientRect.right) / 2; |
23 y = (clientRect.top + clientRect.bottom) / 2; | 23 y = (clientRect.top + clientRect.bottom) / 2; |
24 if (window.testRunner) { | 24 if (window.testRunner) { |
25 testRunner.dumpAsTextWithPixelResults(); | 25 testRunner.dumpAsTextWithPixelResults(); |
26 testRunner.waitUntilDone(); | 26 testRunner.waitUntilDone(); |
27 } | 27 } |
28 | 28 |
29 if (window.eventSender) { | 29 if (window.eventSender) { |
30 eventSender.gestureShowPress(x, y); | 30 eventSender.gestureShowPress(x, y); |
31 window.setTimeout(function() { window.testRunner.notifyDone(); }, 0); | 31 window.setTimeout(function() { window.testRunner.notifyDone(); }, 0); |
32 } else { | 32 } else { |
33 debug("This test requires DumpRenderTree."); | 33 debug("This test requires DumpRenderTree."); |
34 debug("This test is successful if the image below is covered in a green
box with square ranges."); | 34 debug("This test is successful if the image below is covered in a green
box with square ranges."); |
35 } | 35 } |
36 } | 36 } |
37 </script> | 37 </script> |
38 </body> | 38 </body> |
39 </html> | 39 </html> |
OLD | NEW |