qtwebkit/0019-Mouseup-event-does-not...

112 lines
4.7 KiB
Diff

From c8040172a48006475b7f34c5ebe04ee286c0a32e Mon Sep 17 00:00:00 2001
From: Mike West <mkwst@chromium.org>
Date: Wed, 22 Jan 2014 14:12:39 +0100
Subject: [PATCH 19/20] Mouseup event does not fire on Scroll Bar
https://bugs.webkit.org/show_bug.cgi?id=25811
Reviewed by Tony Chang.
Source/WebCore:
Currently, clicking on a scrollbar fires a mousedown event, but not a
mouseup event. This causes problems for code like jQuery UI's
draggable[1], as the drag starts, but is never cancelled. Other use
cases are noted in the slightly old Chromium bug[2].
If a mouseup event is received after a mousedown event on a scrollbar,
this patch dispatches a mouseup event on the same node the mousedown
event dispatched on. This matches Gecko's behavior.
[1]: http://bugs.jqueryui.com/ticket/6925
[2]: http://crbug.com/14204
Tests: fast/scrolling/scrollbar-mousedown-mouseup.html
fast/scrolling/scrollbar-mousedown-move-mouseup.html
* page/EventHandler.cpp:
(WebCore::EventHandler::handleMouseReleaseEvent):
If a mouseup event follow a mousedown event on a scrollbar,
dispatch an event on the same node from which the mousedown event
was triggered.
LayoutTests:
* fast/scrolling/scrollbar-mousedown-mouseup-expected.txt: Added.
* fast/scrolling/scrollbar-mousedown-mouseup.html: Added.
* fast/scrolling/scrollbar-mousedown-move-mouseup-expected.txt: Added.
* fast/scrolling/scrollbar-mousedown-move-mouseup.html: Added.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@143560 268f45cc-cd09-0410-ab3c-d52691b4dbfc
---
LayoutTests/ChangeLog | 12 ++++
.../scrollbar-mousedown-mouseup-expected.txt | 19 ++++++
.../scrolling/scrollbar-mousedown-mouseup.html | 67 ++++++++++++++++++++
.../scrollbar-mousedown-move-mouseup-expected.txt | 16 +++++
.../scrollbar-mousedown-move-mouseup.html | 72 ++++++++++++++++++++++
Source/WebCore/ChangeLog | 28 +++++++++
Source/WebCore/page/EventHandler.cpp | 5 +-
7 files changed, 218 insertions(+), 1 deletion(-)
create mode 100644 LayoutTests/fast/scrolling/scrollbar-mousedown-mouseup-expected.txt
create mode 100644 LayoutTests/fast/scrolling/scrollbar-mousedown-mouseup.html
create mode 100644 LayoutTests/fast/scrolling/scrollbar-mousedown-move-mouseup-expected.txt
create mode 100644 LayoutTests/fast/scrolling/scrollbar-mousedown-move-mouseup.html
diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog
index 3fb41fe..8f1c3cc 100644
--- a/Source/WebCore/ChangeLog
+++ b/Source/WebCore/ChangeLog
@@ -627,6 +627,34 @@
* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::containingColumnsBlock):
+2013-02-20 Mike West <mkwst@chromium.org>
+
+ Mouseup event does not fire on Scroll Bar
+ https://bugs.webkit.org/show_bug.cgi?id=25811
+
+ Reviewed by Tony Chang.
+
+ Currently, clicking on a scrollbar fires a mousedown event, but not a
+ mouseup event. This causes problems for code like jQuery UI's
+ draggable[1], as the drag starts, but is never cancelled. Other use
+ cases are noted in the slightly old Chromium bug[2].
+
+ If a mouseup event is received after a mousedown event on a scrollbar,
+ this patch dispatches a mouseup event on the same node the mousedown
+ event dispatched on. This matches Gecko's behavior.
+
+ [1]: http://bugs.jqueryui.com/ticket/6925
+ [2]: http://crbug.com/14204
+
+ Tests: fast/scrolling/scrollbar-mousedown-mouseup.html
+ fast/scrolling/scrollbar-mousedown-move-mouseup.html
+
+ * page/EventHandler.cpp:
+ (WebCore::EventHandler::handleMouseReleaseEvent):
+ If a mouseup event follow a mousedown event on a scrollbar,
+ dispatch an event on the same node from which the mousedown event
+ was triggered.
+
2013-02-19 Andras Becsi <andras.becsi@digia.com>
[Qt] Fix compilation if Qt was configured with -no-rtti
diff --git a/Source/WebCore/page/EventHandler.cpp b/Source/WebCore/page/EventHandler.cpp
index 22d616e..68f2359 100644
--- a/Source/WebCore/page/EventHandler.cpp
+++ b/Source/WebCore/page/EventHandler.cpp
@@ -1955,7 +1955,10 @@ bool EventHandler::handleMouseReleaseEvent(const PlatformMouseEvent& mouseEvent)
if (m_lastScrollbarUnderMouse) {
invalidateClick();
- return m_lastScrollbarUnderMouse->mouseUp(mouseEvent);
+ m_lastScrollbarUnderMouse->mouseUp(mouseEvent);
+ bool cancelable = true;
+ bool setUnder = false;
+ return !dispatchMouseEvent(eventNames().mouseupEvent, m_lastNodeUnderMouse.get(), cancelable, m_clickCount, mouseEvent, setUnder);
}
HitTestRequest request(HitTestRequest::Release);
--
1.8.5.3