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