chrishtr | 4b1c8f02 | 2017-01-07 03:00:26 | [diff] [blame] | 1 | <!DOCTYPE html> |
| 2 | <style> |
| 3 | #containingBlock { |
| 4 | height: 200px; |
| 5 | font-size: 140px; |
| 6 | position: relative; |
| 7 | border: 1px solid black; |
| 8 | } |
| 9 | </style> |
| 10 | <div id="containingBlock"> |
| 11 | <img id="image" src="../paint/invalidation/resources/bluesquare.png"> |
| 12 | </div> |
| 13 | <a id="target" href="#">this is a link</a> |
| 14 | <div id="result"></div> |
| 15 | <script> |
Xiaocheng Hu | 1d50523 | 2018-06-14 21:00:34 | [diff] [blame] | 16 | if (window.testRunner) { |
| 17 | testRunner.dumpAsText(); |
| 18 | testRunner.waitUntilDone(); |
| 19 | } |
| 20 | |
| 21 | // Tests |
chrishtr | 4b1c8f02 | 2017-01-07 03:00:26 | [diff] [blame] | 22 | function test() { |
chrishtr | 4b1c8f02 | 2017-01-07 03:00:26 | [diff] [blame] | 23 | target.onclick = function() { |
| 24 | var result = document.getElementById("result"); |
| 25 | result.innerHTML += "clicked<br>"; |
chrishtr | 4b1c8f02 | 2017-01-07 03:00:26 | [diff] [blame] | 26 | }; |
chrishtr | 4b1c8f02 | 2017-01-07 03:00:26 | [diff] [blame] | 27 | let x = image.offsetLeft + 10; |
| 28 | let y = image.offsetTop + image.offsetHeight; |
| 29 | |
| 30 | if (window.eventSender) { |
| 31 | // No click - still inside containingBlock. |
| 32 | eventSender.mouseMoveTo(x, y - 10); |
| 33 | eventSender.mouseDown(); |
| 34 | eventSender.mouseUp(); |
| 35 | |
| 36 | // Click - over the link. Still inside the height of the inline |
| 37 | // image, but outside of containingBlock. |
| 38 | eventSender.mouseMoveTo(x, y + 15); |
| 39 | finished = true; |
| 40 | eventSender.mouseDown(); |
| 41 | eventSender.mouseUp(); |
Xiaocheng Hu | 1d50523 | 2018-06-14 21:00:34 | [diff] [blame] | 42 | |
| 43 | testRunner.notifyDone(); |
chrishtr | 4b1c8f02 | 2017-01-07 03:00:26 | [diff] [blame] | 44 | } |
| 45 | } |
| 46 | window.onload = test; |
| 47 | </script> |