OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <title>Hit-test of <text> does not hit-test the "background" (w/ small font s
ize)</title> |
| 3 <script src="../../resources/ahem.js"></script> |
| 4 <script src="../../resources/testharness.js"></script> |
| 5 <script src="../../resources/testharnessreport.js"></script> |
| 6 <style> |
| 7 body { |
| 8 margin: 0; |
| 9 padding: 0; |
| 10 } |
| 11 g text:hover { |
| 12 fill: red; |
| 13 cursor: crosshair; |
| 14 } |
| 15 </style> |
| 16 <svg font-family="Ahem" font-size="1.6" fill="blue" width="600" height="300"> |
| 17 <g transform="matrix(50,0,0,50,-400,-800)"> |
| 18 <text x="9.4" y="17.80">SELECT</text> |
| 19 </g> |
| 20 </svg> |
| 21 <script> |
| 22 test(function() { |
| 23 var textElement = document.querySelector('text'); |
| 24 // Should hit <text>. |
| 25 [ |
| 26 { x: 71, y: 28 }, |
| 27 { x: 71, y: 105 }, |
| 28 { x: 540, y: 105 }, |
| 29 { x: 540, y: 28 }, |
| 30 ].forEach(function(point) { |
| 31 assert_equals(document.elementFromPoint(point.x, point.y), textElement, poin
t.x + ',' + point.y); |
| 32 }); |
| 33 |
| 34 var svgRoot = document.querySelector('svg'); |
| 35 // Should not hit <text>. |
| 36 [ |
| 37 { x: 69, y: 26 }, |
| 38 { x: 69, y: 105 }, |
| 39 { x: 69, y: 107 }, |
| 40 { x: 300, y: 26 }, |
| 41 { x: 300, y: 107 }, |
| 42 { x: 550, y: 26 }, |
| 43 { x: 550, y: 105 }, |
| 44 { x: 550, y: 107 }, |
| 45 ].forEach(function(point) { |
| 46 assert_equals(document.elementFromPoint(point.x, point.y), svgRoot, point.x
+ ',' + point.y); |
| 47 }); |
| 48 }); |
| 49 </script> |
OLD | NEW |