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
WheelEvent should not target text nodes.
https://bugs.webkit.org/show_bug.cgi?id=109939 Reviewed by Darin Adler. Source/WebCore: WheelEvent, like other mouse events, should not target text nodes. EventHandler correctly handles other mouse events by retargeting events to text nodes' parents; this patch adds that logic to the WheelEvent handler. This should allow jQuery to stop working around WebKit's behavior[1]. [1]: jquery/jquery@c611504 Test: fast/events/wheelevent-in-text-node.html * page/EventHandler.cpp: (WebCore::EventHandler::handleWheelEvent): If a WheelEvent's hit test lands on a text node, retarget the event to the text node's parent. Do this before latching the node. LayoutTests: * fast/events/wheelevent-in-text-node-expected.txt: Added. * fast/events/wheelevent-in-text-node.html: Added. Canonical link: https://commits.webkit.org/128349@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@143148 268f45cc-cd09-0410-ab3c-d52691b4dbfc
- Loading branch information
Showing
5 changed files
with
90 additions
and
7 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
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
@@ -0,0 +1,6 @@ | ||
'Real' MouseWheel events should not be dispatched on the text node, but instead on its parent. | ||
PASS theEvent.target.nodeName is "DIV" | ||
PASS successfullyParsed is true | ||
|
||
TEST COMPLETE | ||
This is a div containing text. Wheel events originating on the text node should target the div. |
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
@@ -0,0 +1,39 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<script src="../js/resources/js-test-pre.js"></script> | ||
<script> | ||
window.jsTestIsAsync = true; | ||
|
||
function test() { | ||
var div = document.querySelector('div'); | ||
if (window.eventSender) { | ||
eventSender.mouseMoveTo(div.offsetLeft + 5, div.offsetTop + 5); | ||
eventSender.mouseScrollBy(0,120); | ||
} else { | ||
debug("FAIL: This test requires window.eventSender."); | ||
finishJSTest(); | ||
} | ||
} | ||
|
||
function wheelHandler(e) { | ||
window.theEvent = e; | ||
|
||
debug("'Real' MouseWheel events should not be dispatched on the text node, but instead on its parent."); | ||
shouldBeEqualToString('theEvent.target.nodeName', 'DIV'); | ||
finishJSTest(); | ||
} | ||
|
||
window.onload = function () { | ||
var div = document.querySelector('div'); | ||
div.addEventListener('mousewheel', wheelHandler); | ||
test(); | ||
}; | ||
</script> | ||
<script src="../js/resources/js-test-post.js"></script> | ||
</head> | ||
<body> | ||
<div>This is a div containing text. Wheel events originating on the text | ||
node should target the div.</div> | ||
</body> | ||
</html> |
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