- Revision
- 176687
- Author
- m...@apple.com
- Date
- 2014-12-02 13:00:07 -0800 (Tue, 02 Dec 2014)
Log Message
REGRESSION: Dragging selected text changes the selection
https://bugs.webkit.org/show_bug.cgi?id=139110
Reviewed by Simon Fraser.
After it sent the UI process the message to start dragging, the Web process handled mouse
move events that had already been in flight, interpreting them as a drag to start a new
selection. This is fixed by ignoring any mouse events received after asking the UI process
to start dragging.
* UIProcess/mac/WebPageProxyMac.mm:
(WebKit::WebPageProxy::setDragImage): Send the new DidStartDrag message back to the Web
process, so that it stops ignoring mouse events.
* WebProcess/WebCoreSupport/mac/WebDragClientMac.mm:
(WebKit::WebDragClient::startDrag): Call the new WebPage::willStartDrag, so that it starts
ignoring mouse events.
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::WebPage): Initialize new member variable.
(WebKit::WebPage::mouseEvent): Don’t handle the event if we have asked the UI process to
start dragging.
* WebProcess/WebPage/WebPage.h:
(WebKit::WebPage::willStartDrag): Added. Sets new member variable m_isStartingDrag to true.
(WebKit::WebPage::didStartDrag): Added. Handles the message from the UI process by setting
m_isStartingDrag back to false.
* WebProcess/WebPage/WebPage.messages.in: Added DidStartDrag.
Modified Paths
Diff
Modified: trunk/Source/WebKit2/ChangeLog (176686 => 176687)
--- trunk/Source/WebKit2/ChangeLog 2014-12-02 20:53:40 UTC (rev 176686)
+++ trunk/Source/WebKit2/ChangeLog 2014-12-02 21:00:07 UTC (rev 176687)
@@ -1,3 +1,35 @@
+2014-12-02 Dan Bernstein <m...@apple.com>
+
+ REGRESSION: Dragging selected text changes the selection
+ https://bugs.webkit.org/show_bug.cgi?id=139110
+
+ Reviewed by Simon Fraser.
+
+ After it sent the UI process the message to start dragging, the Web process handled mouse
+ move events that had already been in flight, interpreting them as a drag to start a new
+ selection. This is fixed by ignoring any mouse events received after asking the UI process
+ to start dragging.
+
+ * UIProcess/mac/WebPageProxyMac.mm:
+ (WebKit::WebPageProxy::setDragImage): Send the new DidStartDrag message back to the Web
+ process, so that it stops ignoring mouse events.
+
+ * WebProcess/WebCoreSupport/mac/WebDragClientMac.mm:
+ (WebKit::WebDragClient::startDrag): Call the new WebPage::willStartDrag, so that it starts
+ ignoring mouse events.
+
+ * WebProcess/WebPage/WebPage.cpp:
+ (WebKit::WebPage::WebPage): Initialize new member variable.
+ (WebKit::WebPage::mouseEvent): Don’t handle the event if we have asked the UI process to
+ start dragging.
+
+ * WebProcess/WebPage/WebPage.h:
+ (WebKit::WebPage::willStartDrag): Added. Sets new member variable m_isStartingDrag to true.
+ (WebKit::WebPage::didStartDrag): Added. Handles the message from the UI process by setting
+ m_isStartingDrag back to false.
+
+ * WebProcess/WebPage/WebPage.messages.in: Added DidStartDrag.
+
2014-12-02 Beth Dakin <bda...@apple.com>
Should use standardQuickLookMenuItem for apps that don't implement customizations
Modified: trunk/Source/WebKit2/UIProcess/mac/WebPageProxyMac.mm (176686 => 176687)
--- trunk/Source/WebKit2/UIProcess/mac/WebPageProxyMac.mm 2014-12-02 20:53:40 UTC (rev 176686)
+++ trunk/Source/WebKit2/UIProcess/mac/WebPageProxyMac.mm 2014-12-02 21:00:07 UTC (rev 176687)
@@ -378,11 +378,10 @@
#if ENABLE(DRAG_SUPPORT)
void WebPageProxy::setDragImage(const WebCore::IntPoint& clientPosition, const ShareableBitmap::Handle& dragImageHandle, bool isLinkDrag)
{
- RefPtr<ShareableBitmap> dragImage = ShareableBitmap::create(dragImageHandle);
- if (!dragImage)
- return;
-
- m_pageClient.setDragImage(clientPosition, dragImage.release(), isLinkDrag);
+ if (RefPtr<ShareableBitmap> dragImage = ShareableBitmap::create(dragImageHandle))
+ m_pageClient.setDragImage(clientPosition, dragImage.release(), isLinkDrag);
+
+ process().send(Messages::WebPage::DidStartDrag(), m_pageID);
}
void WebPageProxy::setPromisedData(const String& pasteboardName, const SharedMemory::Handle& imageHandle, uint64_t imageSize, const String& filename, const String& extension,
Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebDragClientMac.mm (176686 => 176687)
--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebDragClientMac.mm 2014-12-02 20:53:40 UTC (rev 176686)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebDragClientMac.mm 2014-12-02 21:00:07 UTC (rev 176687)
@@ -80,6 +80,8 @@
if (!bitmap || !bitmap->createHandle(handle))
return;
+ m_page->willStartDrag();
+
// FIXME: Seems this message should be named StartDrag, not SetDragImage.
m_page->send(Messages::WebPageProxy::SetDragImage(frame.view()->contentsToWindow(point), handle, linkDrag));
}
Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (176686 => 176687)
--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp 2014-12-02 20:53:40 UTC (rev 176686)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp 2014-12-02 21:00:07 UTC (rev 176687)
@@ -290,6 +290,9 @@
, m_canRunBeforeUnloadConfirmPanel(parameters.canRunBeforeUnloadConfirmPanel)
, m_canRunModal(parameters.canRunModal)
, m_isRunningModal(false)
+#if ENABLE(DRAG_SUPPORT)
+ , m_isStartingDrag(false)
+#endif
, m_cachedMainFrameIsPinnedToLeftSide(true)
, m_cachedMainFrameIsPinnedToRightSide(true)
, m_cachedMainFrameIsPinnedToTopSide(true)
@@ -1909,13 +1912,23 @@
{
m_page->pageThrottler().didReceiveUserInput();
+ bool shouldHandleEvent = true;
+
#if ENABLE(CONTEXT_MENUS)
// Don't try to handle any pending mouse events if a context menu is showing.
- if (m_isShowingContextMenu) {
+ if (m_isShowingContextMenu)
+ shouldHandleEvent = false;
+#endif
+#if ENABLE(DRAG_SUPPORT)
+ if (m_isStartingDrag)
+ shouldHandleEvent = false;
+#endif
+
+ if (!shouldHandleEvent) {
send(Messages::WebPageProxy::DidReceiveEvent(static_cast<uint32_t>(mouseEvent.type()), false));
return;
}
-#endif
+
bool handled = false;
#if !PLATFORM(IOS)
Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h (176686 => 176687)
--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h 2014-12-02 20:53:40 UTC (rev 176686)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h 2014-12-02 21:00:07 UTC (rev 176687)
@@ -695,6 +695,9 @@
void willPerformLoadDragDestinationAction();
void mayPerformUploadDragDestinationAction();
+
+ void willStartDrag() { ASSERT(!m_isStartingDrag); m_isStartingDrag = true; }
+ void didStartDrag() { ASSERT(m_isStartingDrag); m_isStartingDrag = false; }
#endif // ENABLE(DRAG_SUPPORT)
void beginPrinting(uint64_t frameID, const PrintInfo&);
@@ -1233,6 +1236,10 @@
bool m_canRunModal;
bool m_isRunningModal;
+#if ENABLE(DRAG_SUPPORT)
+ bool m_isStartingDrag;
+#endif
+
bool m_cachedMainFrameIsPinnedToLeftSide;
bool m_cachedMainFrameIsPinnedToRightSide;
bool m_cachedMainFrameIsPinnedToTopSide;
Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in (176686 => 176687)
--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in 2014-12-02 20:53:40 UTC (rev 176686)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in 2014-12-02 21:00:07 UTC (rev 176687)
@@ -229,6 +229,7 @@
PerformDragControllerAction(uint64_t action, WebCore::IntPoint clientPosition, WebCore::IntPoint globalPosition, uint64_t draggingSourceOperationMask, String dragStorageName, uint32_t flags, WebKit::SandboxExtension::Handle sandboxExtensionHandle, WebKit::SandboxExtension::HandleArray sandboxExtensionsForUpload)
#endif
#if ENABLE(DRAG_SUPPORT)
+ DidStartDrag()
DragEnded(WebCore::IntPoint clientPosition, WebCore::IntPoint globalPosition, uint64_t operation)
#endif