Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(570)

Unified Diff: Source/core/page/EventHandler.cpp

Issue 488923003: Gracefully handle drag cancellation during drag start. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Expand comment somewhat Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « LayoutTests/fast/events/mousedown-inside-dragstart-should-not-cause-crash-expected.txt ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/page/EventHandler.cpp
diff --git a/Source/core/page/EventHandler.cpp b/Source/core/page/EventHandler.cpp
index b2e91147ce635d4132727b17ed825571bf86d053..7614b41a0632d7ce4ee8c3eae65da71948e6dbae 100644
--- a/Source/core/page/EventHandler.cpp
+++ b/Source/core/page/EventHandler.cpp
@@ -3262,8 +3262,15 @@ bool EventHandler::tryStartDrag(const MouseEventWithHitTestResults& event)
DragController& dragController = m_frame->page()->dragController();
if (!dragController.populateDragDataTransfer(m_frame, dragState(), m_mouseDownPos))
return false;
+
+ // If dispatching dragstart brings about another mouse down -- one way
+ // this will happen is if a DevTools user breaks within a dragstart
+ // handler and then clicks on the suspended page -- the drag state is
+ // reset. Hence, need to check if this particular drag operation can
+ // continue even if dispatchEvent() indicates no (direct) cancellation.
+ // Do that by checking if m_dragSrc is still set.
m_mouseDownMayStartDrag = dispatchDragSrcEvent(EventTypeNames::dragstart, m_mouseDown)
- && !m_frame->selection().isInPasswordField();
+ && !m_frame->selection().isInPasswordField() && dragState().m_dragSrc;
// Invalidate clipboard here against anymore pasteboard writing for security. The drag
// image can still be changed as we drag, but not the pasteboard data.
« no previous file with comments | « LayoutTests/fast/events/mousedown-inside-dragstart-should-not-cause-crash-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698