OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <title>Hit-test of clip-path userSpaceOnUse <clipPath> on <div></title> |
| 3 <script src="../../resources/testharness.js"></script> |
| 4 <script src="../../resources/testharnessreport.js"></script> |
| 5 <style> |
| 6 body { |
| 7 margin: 0; |
| 8 } |
| 9 .box { |
| 10 width: 100px; |
| 11 height: 100px; |
| 12 background-color: blue; |
| 13 margin: 100px; |
| 14 -webkit-clip-path: url(#clip); |
| 15 clip-path: url(#clip); |
| 16 } |
| 17 </style> |
| 18 <div class=box></div> |
| 19 <svg height="0"> |
| 20 <clipPath id="clip" clipPathUnits="userSpaceOnUse"> |
| 21 <polygon points="50,0 100,50 50,100 0,50"/> |
| 22 </clipPath> |
| 23 </svg> |
| 24 <script> |
| 25 function assert_element_at(element, pointlist) { |
| 26 for (var point of pointlist) { |
| 27 var result = document.elementFromPoint(point[0], point[1]); |
| 28 assert_equals(result, element, point.join(',')); |
| 29 } |
| 30 } |
| 31 |
| 32 test(function() { |
| 33 var div = document.querySelector('.box'); |
| 34 |
| 35 // Points inside clip-path. |
| 36 assert_element_at(div, [[150, 150], [150, 125], [150, 175], [125, 150], [175,
150]]); |
| 37 |
| 38 // Points outside clip-path. |
| 39 assert_element_at(document.body, [[120, 120], [180, 120], [120, 180], [180, 18
0]]); |
| 40 }); |
| 41 </script> |
OLD | NEW |