| <!DOCTYPE html> |
| <html id="main_frame"> |
| <head> |
| <meta charset="utf-8"> |
| <script src="../../resources/js-test-pre.js"></script> |
| <style> |
| #subframe { |
| position: absolute; |
| left: 0; |
| top: 0; |
| width: 200px; |
| height: 200px; |
| background: white; |
| } |
| |
| #overlapping_div_in_main_frame { |
| position: absolute; |
| background: black; |
| top: 0; |
| left: 0; |
| height: 50px; |
| width: 50px; |
| display: none; |
| z-index: 10; |
| } |
| </style> |
| </head> |
| <body> |
| <iframe id="subframe" src="resources/ghostly-mousemoves-in-subframe-the-actual-subframe.html"></iframe> |
| <div id="overlapping_div_in_main_frame"></div> |
| <script> |
| |
| description("Test for http://webkit.org/b/131974 REGRESSION (r151839): Subframe keeps getting mousemove events with the same coordinates after hiding a hovered element."); |
| var jsTestIsAsync = true; |
| |
| function logEvent(e) { |
| debug(e.target.id + " got " + event.type + " at " + event.x + "," + event.y); |
| } |
| |
| window.onload = function() { |
| window.onclick = function(event) { |
| logEvent(event); |
| |
| var clickable_div_in_subframe = document.querySelector("iframe").contentDocument.querySelector("#clickable_div_in_subframe"); |
| clickable_div_in_subframe.style.display = "none"; |
| clickable_div_in_subframe.clientHeight; |
| clickable_div_in_subframe.style.display = "block"; |
| clickable_div_in_subframe.clientHeight; |
| }; |
| |
| if (!window.eventSender) { |
| debug("This test requires eventSender from the WebKit layout test internals."); |
| return; |
| } |
| |
| // Move the mouse over clickable_div_in_subframe so it becomes the subframe document's hovered element. |
| eventSender.mouseMoveTo(15, 15); |
| setTimeout(function() { |
| // Fire the subframe's clickable_div_in_subframe.onclick handler. |
| // This will cause a overlapping_div_in_main_frame to overlap the currently hovered element in the subframe. |
| eventSender.mouseDown(); |
| eventSender.mouseUp(); |
| setTimeout(function() { |
| // Jiggle the mouse inside the newly hovered element a bit. |
| eventSender.mouseMoveTo(16, 16); |
| setTimeout(function() { |
| eventSender.mouseMoveTo(400, 400); |
| setTimeout(function() { |
| // Cause a click in the main frame, so the above window.onclick handler will run, |
| // killing and then recreating clickable_div_in_subframe's renderer. |
| eventSender.mouseDown(); |
| eventSender.mouseUp(); |
| setTimeout(function() { |
| finishJSTest(); |
| }, 500); |
| }, 0); |
| }, 0); |
| }, 0); |
| }, 0); |
| }; |
| |
| window.onmousemove = function(event) { |
| logEvent(event); |
| }; |
| |
| </script> |
| <script src="../../resources/js-test-post.js"></script> |
| </body> |
| </html> |