Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Fix a bug that mousedown without mouseup in a frame disturbs click ev…
…ent in another frame Fix a bug that mousedown without mouseup in a frame disturbs click event in another frame https://bugs.webkit.org/show_bug.cgi?id=119305 Reviewed by Ryosuke Niwa. Merge - https://src.chromium.org/viewvc/blink?revision=154698&view=revision If a mouse button is clicked but mouseup event for it is not dispatched (it happens frequently because of context menus) and mousedown in another frame is default-prevented, 'click' event for the latter mouse click is not dispatched. EventHandler::handleMousePressEvent wrongly continues to hold a node for the first click, and it prevents hit-testing for the second click. We should always clear m_capturingMouseEventsElement in mousedown handling code. * Source/WebCore/page/EventHandler.cpp: (EventHandler::handleMousePressEvent): Add condition to return "nullptr" * LayoutTests/fast/events/click-after-mousedown-cancel.html: Add Test Case * LayoutTests/fast/events/click-after-mousedown-cancel-expected.txt: Add Test Case Expectation * LayoutTests/platform/ios/TestExpectations: Updated to skip added test on iOS due to lack of mouse event support Canonical link: https://commits.webkit.org/258055@main
- Loading branch information
1 parent
3837614
commit c2dd7ba9890874670b16f914a46afb7c420da9ce
Showing
4 changed files
with
46 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
Mousedown without mouseup in a sub frame should not confuse a click in another frame. | ||
|
||
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". | ||
|
||
|
||
PASS Click event was dispatched. | ||
PASS successfullyParsed is true | ||
|
||
TEST COMPLETE | ||
Button |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<!DOCTYPE html> | ||
<script src="../../resources/js-test.js"></script> | ||
<iframe src="data:text/html,"></iframe> | ||
<button type="button">Button</button> | ||
<script> | ||
description('Mousedown without mouseup in a sub frame should not confuse a click in another frame.'); | ||
jsTestIsAsync = true; | ||
window.onload = function() { | ||
var button = document.querySelector('button'); | ||
button.addEventListener('mousedown', function(event) { | ||
event.preventDefault(); | ||
}, false); | ||
button.addEventListener('click', function(event) { | ||
testPassed('Click event was dispatched.'); | ||
finishJSTest(); | ||
}, false); | ||
|
||
var iframe = document.querySelector('iframe'); | ||
// Mousedown on the iframe, but no mouseup. | ||
eventSender.mouseMoveTo(iframe.offsetLeft + iframe.offsetWidth / 2, iframe.offsetTop + iframe.offsetHeight / 2); | ||
eventSender.mouseDown(1); | ||
// Click on the button in the main document. | ||
eventSender.mouseMoveTo(button.offsetLeft + button.offsetWidth / 2, button.offsetTop + button.offsetHeight / 2); | ||
eventSender.mouseDown(0); | ||
setTimeout(function() { | ||
testFailed('Click event was not dispatched.'); | ||
finishJSTest(); | ||
}, 100); | ||
eventSender.mouseUp(0); | ||
} | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters