overflow-clip-margin-hit-testing.html (1490B)
1 <!doctype html> 2 <title>Overflow: clip hit testing includes overflow in overflow-clip-margin</title> 3 <link rel="help" href="https://www.w3.org/TR/css-overflow-3/#valdef-overflow-clip"> 4 <link rel="author" title="Scott Violet" href="mailto:wangxianzhu@chromium.org"> 5 <script src="/resources/testharness.js"></script> 6 <script src="/resources/testharnessreport.js"></script> 7 <div id="container" style="width: 100px; height: 100px; 8 overflow: clip; overflow-clip-margin: 50px"> 9 <div id="child" style="width: 300px; height: 50px"></div> 10 </div> 11 12 <script> 13 test(() => { 14 var bounds = container.getBoundingClientRect(); 15 assert_equals(child, document.elementFromPoint(bounds.x + 50, bounds.y + 20), 16 'in child and container'); 17 assert_equals(child, document.elementFromPoint(bounds.x + 125, bounds.y + 25), 18 'in child and container overflow clip margin'); 19 assert_equals(document.body, document.elementFromPoint(bounds.x + 175, bounds.y + 25), 20 'outside of container overflow, would in child without clip'); 21 assert_equals(container, document.elementFromPoint(bounds.x + 50, bounds.y + 75), 22 'outside of child, in container'); 23 assert_equals(document.documentElement, 24 document.elementFromPoint(bounds.x + 50, bounds.y + 125), 25 'in container overflow clip margin, but nothing there'); 26 }, "Ensure elements in overflow-clip-margin are returned from elementFromPoint"); 27 </script>