OLD | NEW |
(Empty) | |
| 1 <svg onload="runTest()" xmlns="http://www.w3.org/2000/svg" width="300" height="1
50" viewBox="0 0 300 150"> |
| 2 <script src="../../resources/ahem.js"></script> |
| 3 <rect id="background" width="100%" height="100%" fill="blue" /> |
| 4 <text id="text"> |
| 5 <tspan id="tspan1" x="10" dy="1em">Foo</tspan> |
| 6 <tspan id="tspan2" x="10" dy="1.2em">Foo bar baz</tspan> |
| 7 </text> |
| 8 <defs> |
| 9 <style type="text/css"> |
| 10 <![CDATA[ |
| 11 text { |
| 12 font-family: Ahem; |
| 13 font-size: 40px; |
| 14 } |
| 15 ]]> |
| 16 </style> |
| 17 <script type="text/javascript"> |
| 18 <![CDATA[ |
| 19 function runTest() { |
| 20 if (window.testRunner) |
| 21 testRunner.dumpAsText(); |
| 22 |
| 23 // (170,30) is within a glyph cell of #tspan1, (170,30) is not. |
| 24 // (50,60) and (250,60) are bothin within a glyph cell of #tspan
2. |
| 25 var text = document.getElementById("text"); |
| 26 var tspan1 = document.getElementById("tspan1"); |
| 27 var tspan2 = document.getElementById("tspan2"); |
| 28 var background = document.getElementById("background"); |
| 29 if (document.elementFromPoint(50, 30) === tspan1 |
| 30 && document.elementFromPoint(170, 30) === background |
| 31 && document.elementFromPoint(50, 60) === tspan2 |
| 32 && document.elementFromPoint(250, 60) === tspan2) |
| 33 text.textContent = "PASS"; |
| 34 else |
| 35 text.textContent = "FAIL"; |
| 36 } |
| 37 ]]> |
| 38 </script> |
| 39 </defs> |
| 40 </svg> |
OLD | NEW |