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

Side by Side Diff: third_party/WebKit/Source/core/input/EventHandler.cpp

Issue 2042333006: Reset drag state variables on mouse up (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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 | « third_party/WebKit/Source/core/input/EventHandler.h ('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 414 matching lines...) Expand 10 before | Expand all | Expand 10 after
425 { 425 {
426 selectionController().updateSelectionForMouseDrag(m_mousePressNode.get(), m_ dragStartPos, m_lastKnownMousePosition); 426 selectionController().updateSelectionForMouseDrag(m_mousePressNode.get(), m_ dragStartPos, m_lastKnownMousePosition);
427 } 427 }
428 428
429 WebInputEventResult EventHandler::handleMouseReleaseEvent(const MouseEventWithHi tTestResults& event) 429 WebInputEventResult EventHandler::handleMouseReleaseEvent(const MouseEventWithHi tTestResults& event)
430 { 430 {
431 AutoscrollController* controller = m_scrollManager.autoscrollController(); 431 AutoscrollController* controller = m_scrollManager.autoscrollController();
432 if (controller && controller->autoscrollInProgress()) 432 if (controller && controller->autoscrollInProgress())
433 m_scrollManager.stopAutoscroll(); 433 m_scrollManager.stopAutoscroll();
434 434
435 // Used to prevent mouseMoveEvent from initiating a drag before 435 clearMouseDragState();
436 // the mouse is pressed again.
437 m_mousePressed = false;
438 m_capturesDragging = false;
439 m_mouseDownMayStartDrag = false;
440 m_mouseDownMayStartAutoscroll = false;
441 436
442 return selectionController().handleMouseReleaseEvent(event, m_dragStartPos) ? WebInputEventResult::HandledSystem : WebInputEventResult::NotHandled; 437 return selectionController().handleMouseReleaseEvent(event, m_dragStartPos) ? WebInputEventResult::HandledSystem : WebInputEventResult::NotHandled;
443 } 438 }
444 439
445 #if OS(WIN) 440 #if OS(WIN)
446 441
447 void EventHandler::startPanScrolling(LayoutObject* layoutObject) 442 void EventHandler::startPanScrolling(LayoutObject* layoutObject)
448 { 443 {
449 if (!layoutObject->isBox()) 444 if (!layoutObject->isBox())
450 return; 445 return;
(...skipping 748 matching lines...) Expand 10 before | Expand all | Expand 10 after
1199 event->stopPropagation(); 1194 event->stopPropagation();
1200 1195
1201 clickEventResult = toWebInputEventResult(clickTargetNode->dispatchEv ent(event)); 1196 clickEventResult = toWebInputEventResult(clickTargetNode->dispatchEv ent(event));
1202 } 1197 }
1203 } 1198 }
1204 1199
1205 m_scrollManager.clearResizeScrollableArea(false); 1200 m_scrollManager.clearResizeScrollableArea(false);
1206 1201
1207 if (eventResult == WebInputEventResult::NotHandled) 1202 if (eventResult == WebInputEventResult::NotHandled)
1208 eventResult = handleMouseReleaseEvent(mev); 1203 eventResult = handleMouseReleaseEvent(mev);
1204 else
1205 clearMouseDragState();
dtapuska 2016/06/09 21:18:58 what about the code path for gesture tap that has
mustaq 2016/06/10 15:44:04 handleMousePressEvent(MouseEventWithHitTestResults
Navid Zolghadr 2016/06/10 19:19:55 I added the call as suggested to the tap flow as w
mustaq 2016/06/10 19:30:16 I am indifferent about AutoReset here, mainly for
1209 1206
1210 invalidateClick(); 1207 invalidateClick();
1211 1208
1212 return mergeEventResult(clickEventResult, eventResult); 1209 return mergeEventResult(clickEventResult, eventResult);
1213 } 1210 }
1214 1211
1215 WebInputEventResult EventHandler::dispatchDragEvent(const AtomicString& eventTyp e, Node* dragTarget, const PlatformMouseEvent& event, DataTransfer* dataTransfer ) 1212 WebInputEventResult EventHandler::dispatchDragEvent(const AtomicString& eventTyp e, Node* dragTarget, const PlatformMouseEvent& event, DataTransfer* dataTransfer )
1216 { 1213 {
1217 FrameView* view = m_frame->view(); 1214 FrameView* view = m_frame->view();
1218 1215
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
1376 if (targetIsFrame(m_dragTarget.get(), targetFrame)) { 1373 if (targetIsFrame(m_dragTarget.get(), targetFrame)) {
1377 if (targetFrame) 1374 if (targetFrame)
1378 result = targetFrame->eventHandler().performDragAndDrop(event, dataT ransfer); 1375 result = targetFrame->eventHandler().performDragAndDrop(event, dataT ransfer);
1379 } else if (m_dragTarget.get()) { 1376 } else if (m_dragTarget.get()) {
1380 result = dispatchDragEvent(EventTypeNames::drop, m_dragTarget.get(), eve nt, dataTransfer); 1377 result = dispatchDragEvent(EventTypeNames::drop, m_dragTarget.get(), eve nt, dataTransfer);
1381 } 1378 }
1382 clearDragState(); 1379 clearDragState();
1383 return result; 1380 return result;
1384 } 1381 }
1385 1382
1383 void EventHandler::clearMouseDragState()
1384 {
1385 // Used to prevent mouseMoveEvent from initiating a drag before
1386 // the mouse is pressed again.
1387 m_mousePressed = false;
1388 m_capturesDragging = false;
1389 m_mouseDownMayStartDrag = false;
1390 m_mouseDownMayStartAutoscroll = false;
1391 }
1392
1386 void EventHandler::clearDragState() 1393 void EventHandler::clearDragState()
1387 { 1394 {
1388 m_scrollManager.stopAutoscroll(); 1395 m_scrollManager.stopAutoscroll();
1389 m_dragTarget = nullptr; 1396 m_dragTarget = nullptr;
1390 m_capturingMouseEventsNode = nullptr; 1397 m_capturingMouseEventsNode = nullptr;
1391 m_shouldOnlyFireDragOverEvent = false; 1398 m_shouldOnlyFireDragOverEvent = false;
1392 } 1399 }
1393 1400
1394 void EventHandler::setCapturingMouseEventsNode(Node* n) 1401 void EventHandler::setCapturingMouseEventsNode(Node* n)
1395 { 1402 {
(...skipping 1427 matching lines...) Expand 10 before | Expand all | Expand 10 after
2823 2830
2824 FrameHost* EventHandler::frameHost() const 2831 FrameHost* EventHandler::frameHost() const
2825 { 2832 {
2826 if (!m_frame->page()) 2833 if (!m_frame->page())
2827 return nullptr; 2834 return nullptr;
2828 2835
2829 return &m_frame->page()->frameHost(); 2836 return &m_frame->page()->frameHost();
2830 } 2837 }
2831 2838
2832 } // namespace blink 2839 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/input/EventHandler.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698