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

Side by Side 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: 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserv ed. 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserv ed.
3 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org) 3 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org)
4 * Copyright (C) 2012 Digia Plc. and/or its subsidiary(-ies) 4 * Copyright (C) 2012 Digia Plc. and/or its subsidiary(-ies)
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 3245 matching lines...) Expand 10 before | Expand all | Expand 10 after
3256 // The renderer has disappeared, this can happen if the onStartDrag handler has hidden 3256 // The renderer has disappeared, this can happen if the onStartDrag handler has hidden
3257 // the element in some way. In this case we just kill the drag. 3257 // the element in some way. In this case we just kill the drag.
3258 return false; 3258 return false;
3259 } 3259 }
3260 } 3260 }
3261 3261
3262 DragController& dragController = m_frame->page()->dragController(); 3262 DragController& dragController = m_frame->page()->dragController();
3263 if (!dragController.populateDragDataTransfer(m_frame, dragState(), m_mouseDo wnPos)) 3263 if (!dragController.populateDragDataTransfer(m_frame, dragState(), m_mouseDo wnPos))
3264 return false; 3264 return false;
3265 m_mouseDownMayStartDrag = dispatchDragSrcEvent(EventTypeNames::dragstart, m_ mouseDown) 3265 m_mouseDownMayStartDrag = dispatchDragSrcEvent(EventTypeNames::dragstart, m_ mouseDown)
3266 && !m_frame->selection().isInPasswordField(); 3266 && !m_frame->selection().isInPasswordField() && dragState().m_dragSrc;
dcheng 2014/08/20 10:56:24 I wonder if it's worth adding a comment about why
sof 2014/08/20 11:06:42 Good idea, added one - does it clarify ?
3267 3267
3268 // Invalidate clipboard here against anymore pasteboard writing for security . The drag 3268 // Invalidate clipboard here against anymore pasteboard writing for security . The drag
3269 // image can still be changed as we drag, but not the pasteboard data. 3269 // image can still be changed as we drag, but not the pasteboard data.
3270 dragState().m_dragDataTransfer->setAccessPolicy(DataTransferImageWritable); 3270 dragState().m_dragDataTransfer->setAccessPolicy(DataTransferImageWritable);
3271 3271
3272 if (m_mouseDownMayStartDrag) { 3272 if (m_mouseDownMayStartDrag) {
3273 // Dispatching the event could cause Page to go away. Make sure it's sti ll valid before trying to use DragController. 3273 // Dispatching the event could cause Page to go away. Make sure it's sti ll valid before trying to use DragController.
3274 m_didStartDrag = m_frame->page() && dragController.startDrag(m_frame, dr agState(), event.event(), m_mouseDownPos); 3274 m_didStartDrag = m_frame->page() && dragController.startDrag(m_frame, dr agState(), event.event(), m_mouseDownPos);
3275 // FIXME: This seems pretty useless now. The gesture code uses this as a signal for 3275 // FIXME: This seems pretty useless now. The gesture code uses this as a signal for
3276 // whether or not the drag started, but perhaps it can simply use the re turn value from 3276 // whether or not the drag started, but perhaps it can simply use the re turn value from
(...skipping 573 matching lines...) Expand 10 before | Expand all | Expand 10 after
3850 unsigned EventHandler::accessKeyModifiers() 3850 unsigned EventHandler::accessKeyModifiers()
3851 { 3851 {
3852 #if OS(MACOSX) 3852 #if OS(MACOSX)
3853 return PlatformEvent::CtrlKey | PlatformEvent::AltKey; 3853 return PlatformEvent::CtrlKey | PlatformEvent::AltKey;
3854 #else 3854 #else
3855 return PlatformEvent::AltKey; 3855 return PlatformEvent::AltKey;
3856 #endif 3856 #endif
3857 } 3857 }
3858 3858
3859 } // namespace blink 3859 } // namespace blink
OLDNEW
« 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