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

Side by Side Diff: Source/core/page/EventHandler.cpp

Issue 839253002: Gracefully handle mismatched drag ended notifications. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Ignore mismatched dragSourceEndedAt() invocations. Created 5 years, 11 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
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 3188 matching lines...) Expand 10 before | Expand all | Expand 10 after
3199 } 3199 }
3200 } 3200 }
3201 3201
3202 void EventHandler::dragSourceEndedAt(const PlatformMouseEvent& event, DragOperat ion operation) 3202 void EventHandler::dragSourceEndedAt(const PlatformMouseEvent& event, DragOperat ion operation)
3203 { 3203 {
3204 // Send a hit test request so that RenderLayer gets a chance to update the : hover and :active pseudoclasses. 3204 // Send a hit test request so that RenderLayer gets a chance to update the : hover and :active pseudoclasses.
3205 HitTestRequest request(HitTestRequest::Release); 3205 HitTestRequest request(HitTestRequest::Release);
3206 prepareMouseEvent(request, event); 3206 prepareMouseEvent(request, event);
3207 3207
3208 if (dragState().m_dragSrc) { 3208 if (dragState().m_dragSrc) {
3209 // If an embedder tries to end a drag operation, but the page
3210 // has initiated another from other input events received,
3211 // we're in a tight corner. While Blink doesn't pretend to
3212 // support concurrent drag operations on a page, it should try
3213 // to gracefully handle any such overlapping drag operation
3214 // attempts, whatever their cause/source.
3215 //
3216 // Hence, if the drag state here has a source, but not yet
3217 // any drag data, this represents a drag operation just
3218 // getting under way. The embedder is thus likely signalling
3219 // the end of another, earlier drag operation here, which it
3220 // is preferable to silently ignore.
3221 // (cf. http://crbug.com/445308)
3222 if (!dragState().m_dragDataTransfer)
dcheng 2015/01/12 22:35:48 It's not clear to me that this fix/description is
sof 2015/01/12 22:47:53 The testcase sorts under 2, I think.
3223 return;
3224
3209 dragState().m_dragDataTransfer->setDestinationOperation(operation); 3225 dragState().m_dragDataTransfer->setDestinationOperation(operation);
3210 // for now we don't care if event handler cancels default behavior, sinc e there is none 3226
3227 // For now we don't care if the event handler cancels the default
3228 // behavior, as there is none.
3211 dispatchDragSrcEvent(EventTypeNames::dragend, event); 3229 dispatchDragSrcEvent(EventTypeNames::dragend, event);
3212 } 3230 }
3213 clearDragDataTransfer(); 3231 clearDragDataTransfer();
3214 dragState().m_dragSrc = nullptr; 3232 dragState().m_dragSrc = nullptr;
3215 // In case the drag was ended due to an escape key press we need to ensure 3233 // In case the drag was ended due to an escape key press we need to ensure
3216 // that consecutive mousemove events don't reinitiate the drag and drop. 3234 // that consecutive mousemove events don't reinitiate the drag and drop.
3217 m_mouseDownMayStartDrag = false; 3235 m_mouseDownMayStartDrag = false;
3218 } 3236 }
3219 3237
3220 void EventHandler::updateDragStateAfterEditDragIfNeeded(Element* rootEditableEle ment) 3238 void EventHandler::updateDragStateAfterEditDragIfNeeded(Element* rootEditableEle ment)
(...skipping 668 matching lines...) Expand 10 before | Expand all | Expand 10 after
3889 unsigned EventHandler::accessKeyModifiers() 3907 unsigned EventHandler::accessKeyModifiers()
3890 { 3908 {
3891 #if OS(MACOSX) 3909 #if OS(MACOSX)
3892 return PlatformEvent::CtrlKey | PlatformEvent::AltKey; 3910 return PlatformEvent::CtrlKey | PlatformEvent::AltKey;
3893 #else 3911 #else
3894 return PlatformEvent::AltKey; 3912 return PlatformEvent::AltKey;
3895 #endif 3913 #endif
3896 } 3914 }
3897 3915
3898 } // namespace blink 3916 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698