diff options
author | Allan Sandfeld Jensen <allan.jensen@digia.com> | 2014-11-04 16:09:47 +0100 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@theqtcompany.com> | 2014-11-06 14:57:06 +0100 |
commit | 701f6590a70695743f03423814530c5feb0173bf (patch) | |
tree | 32b58afabf603d4c4ca2f965ee6afffa18b94ec5 | |
parent | f301054d60a6d7828af33a8f8ec66a78cbf4b9b3 (diff) | |
download | qtwebkit-701f6590a70695743f03423814530c5feb0173bf.tar.gz |
Fix selections after leave event
We were sending a bad fake mouse event on leave events that caused
WebCore to stop tracking mousepresses correctly. Since we continue
to receive mouse-events after leave if a mouse button is down, we
don't need the fake mouse event to unset hover states and can skip, and
can skip sending it.
Task-number: QTBUG-41419
Change-Id: I8d50c440f7556f7e34bb0c05248577583c2550b4
Reviewed-by: Jocelyn Turcotte <jocelyn.turcotte@digia.com>
-rw-r--r-- | Source/WebKit/qt/WebCoreSupport/QWebPageAdapter.cpp | 8 | ||||
-rw-r--r-- | Source/WebKit/qt/WebCoreSupport/QWebPageAdapter.h | 1 | ||||
-rw-r--r-- | Source/WebKit/qt/WidgetApi/qwebpage.cpp | 4 |
3 files changed, 12 insertions, 1 deletions
diff --git a/Source/WebKit/qt/WebCoreSupport/QWebPageAdapter.cpp b/Source/WebKit/qt/WebCoreSupport/QWebPageAdapter.cpp index 57bbd289e..d1cf7b57d 100644 --- a/Source/WebKit/qt/WebCoreSupport/QWebPageAdapter.cpp +++ b/Source/WebKit/qt/WebCoreSupport/QWebPageAdapter.cpp @@ -211,6 +211,7 @@ QWebPageAdapter::QWebPageAdapter() , forwardUnsupportedContent(false) , insideOpenCall(false) , clickCausedFocus(false) + , mousePressed(false) , m_useNativeVirtualKeyAsDOMKey(false) , m_totalBytes(0) , m_bytesReceived() @@ -486,6 +487,8 @@ void QWebPageAdapter::mouseMoveEvent(QMouseEvent* ev) WebCore::Frame* frame = mainFrameAdapter()->frame; if (!frame->view()) return; + if (ev->buttons() == Qt::NoButton) + mousePressed = false; bool accepted = frame->eventHandler()->mouseMoved(convertMouseEvent(ev, 0)); ev->setAccepted(accepted); @@ -512,7 +515,7 @@ void QWebPageAdapter::mousePressEvent(QMouseEvent* ev) PlatformMouseEvent mev = convertMouseEvent(ev, 1); // ignore the event if we can't map Qt's mouse buttons to WebCore::MouseButton if (mev.button() != NoButton) - accepted = frame->eventHandler()->handleMousePressEvent(mev); + mousePressed = accepted = frame->eventHandler()->handleMousePressEvent(mev); ev->setAccepted(accepted); RefPtr<WebCore::Node> newNode; @@ -568,6 +571,9 @@ void QWebPageAdapter::mouseReleaseEvent(QMouseEvent *ev) accepted = frame->eventHandler()->handleMouseReleaseEvent(mev); ev->setAccepted(accepted); + if (ev->buttons() == Qt::NoButton) + mousePressed = false; + handleSoftwareInputPanel(ev->button(), QPointF(ev->pos()).toPoint()); } diff --git a/Source/WebKit/qt/WebCoreSupport/QWebPageAdapter.h b/Source/WebKit/qt/WebCoreSupport/QWebPageAdapter.h index 5e6efa697..ab07b84b2 100644 --- a/Source/WebKit/qt/WebCoreSupport/QWebPageAdapter.h +++ b/Source/WebKit/qt/WebCoreSupport/QWebPageAdapter.h @@ -369,6 +369,7 @@ public: QBasicTimer tripleClickTimer; bool clickCausedFocus; + bool mousePressed; bool m_useNativeVirtualKeyAsDOMKey; quint64 m_totalBytes; quint64 m_bytesReceived; diff --git a/Source/WebKit/qt/WidgetApi/qwebpage.cpp b/Source/WebKit/qt/WidgetApi/qwebpage.cpp index 442cc4874..25777d8c0 100644 --- a/Source/WebKit/qt/WidgetApi/qwebpage.cpp +++ b/Source/WebKit/qt/WidgetApi/qwebpage.cpp @@ -912,6 +912,10 @@ void QWebPagePrivate::dropEvent(T *ev) void QWebPagePrivate::leaveEvent(QEvent*) { + // If a mouse button is pressed we will continue to receive mouse events after leaving the window. + if (mousePressed) + return; + // Fake a mouse move event just outside of the widget, since all // the interesting mouse-out behavior like invalidating scrollbars // is handled by the WebKit event handler's mouseMoved function. |