OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <script src="../../resources/js-test.js"></script> | 4 <script src="resources/link-highlight-helper.js"></script> |
| 5 <link rel="stylesheet" type="text/css" href="resources/link-highlight-style.css"
> |
5 </head> | 6 </head> |
6 <body onload="runTest();" style="overflow: hidden"> | 7 <body onload="runTest();" style="overflow: hidden"> |
7 <div style="-webkit-transform: translatez(0) translatey(100px) translatex(300p
x)"> | 8 <div id="targetLink" style="margin: 0px; padding: 0px; position: relative; t
op: 100px; left: 300px; width: 320px;"> |
8 <div id="targetLink" style="width: 320px; height: 240px; cursor: pointer; -w
ebkit-tap-highlight-color: rgb(0, 255, 0)"> | 9 <!--Note we set the height to 1 less than the actual highlight. Determinin
g the size here programatically |
| 10 is challenging as the highlight code uses a (I believe) buggy line box cal
culation and it's not exposed |
| 11 via javascript. To see this, highlight the <a> element in dev tools and no
t that it's at the bottom of |
| 12 the image yet it's .top() method is 28px --> |
| 13 <a href="#"><img width="320" height="239" src="resources/dice.png"></a> |
9 </div> | 14 </div> |
10 </div> | |
11 <script> | 15 <script> |
12 function runTest() { | 16 function runTest() { |
13 var clientRect = document.getElementById('targetLink').getBoundingClientRect
(); | 17 var targetLink = document.getElementById('targetLink'); |
14 x = (clientRect.left + clientRect.right) / 2; | 18 createSquareCompositedHighlight(targetLink); |
15 y = (clientRect.top + clientRect.bottom) / 2; | 19 if (window.testRunner) |
16 | |
17 if (window.testRunner) { | |
18 testRunner.dumpAsTextWithPixelResults(); | 20 testRunner.dumpAsTextWithPixelResults(); |
19 testRunner.waitUntilDone(); | |
20 } | |
21 | |
22 if (window.eventSender) { | |
23 eventSender.gestureShowPress(x, y); | |
24 window.setTimeout(function() { window.testRunner.notifyDone(); }, 0); | |
25 } else { | |
26 debug("This test requires DumpRenderTree."); | |
27 debug("This test is successful if the image below is covered in a green
rectangle."); | |
28 } | |
29 } | 21 } |
30 </script> | 22 </script> |
31 </script> | 23 </script> |
32 </body> | 24 </body> |
33 </html> | 25 </html> |
OLD | NEW |