| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "core/input/MouseEventManager.h" | 5 #include "core/input/MouseEventManager.h" |
| 6 | 6 |
| 7 #include "core/clipboard/DataObject.h" | 7 #include "core/clipboard/DataObject.h" |
| 8 #include "core/clipboard/DataTransfer.h" | 8 #include "core/clipboard/DataTransfer.h" |
| 9 #include "core/dom/Element.h" | 9 #include "core/dom/Element.h" |
| 10 #include "core/dom/ElementTraversal.h" | 10 #include "core/dom/ElementTraversal.h" |
| (...skipping 855 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 866 } | 866 } |
| 867 | 867 |
| 868 // Once we're past the drag threshold, we don't want to treat this gesture as | 868 // Once we're past the drag threshold, we don't want to treat this gesture as |
| 869 // a click. | 869 // a click. |
| 870 InvalidateClick(); | 870 InvalidateClick(); |
| 871 | 871 |
| 872 if (!TryStartDrag(event)) { | 872 if (!TryStartDrag(event)) { |
| 873 // Something failed to start the drag, clean up. | 873 // Something failed to start the drag, clean up. |
| 874 ClearDragDataTransfer(); | 874 ClearDragDataTransfer(); |
| 875 ResetDragState(); | 875 ResetDragState(); |
| 876 } else { |
| 877 // Since drag operation started we need to send a pointercancel for the |
| 878 // corresponding pointer. |
| 879 if (initiator == DragInitiator::kMouse) { |
| 880 frame_->GetEventHandler().HandlePointerEvent( |
| 881 WebPointerEvent(WebInputEvent::Type::kPointerCancel, event.Event()), |
| 882 event.InnerNode()); |
| 883 } |
| 884 // TODO(crbug.com/708278): If the drag starts with touch the touch cancel |
| 885 // should trigger the release of pointer capture. |
| 876 } | 886 } |
| 877 | 887 |
| 878 mouse_down_may_start_drag_ = false; | 888 mouse_down_may_start_drag_ = false; |
| 879 // Whether or not the drag actually started, no more default handling (like | 889 // Whether or not the drag actually started, no more default handling (like |
| 880 // selection). | 890 // selection). |
| 881 return true; | 891 return true; |
| 882 } | 892 } |
| 883 | 893 |
| 884 DataTransfer* MouseEventManager::CreateDraggingDataTransfer() const { | 894 DataTransfer* MouseEventManager::CreateDraggingDataTransfer() const { |
| 885 return DataTransfer::Create(DataTransfer::kDragAndDrop, kDataTransferWritable, | 895 return DataTransfer::Create(DataTransfer::kDragAndDrop, kDataTransferWritable, |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1091 | 1101 |
| 1092 void MouseEventManager::SetClickCount(int click_count) { | 1102 void MouseEventManager::SetClickCount(int click_count) { |
| 1093 click_count_ = click_count; | 1103 click_count_ = click_count; |
| 1094 } | 1104 } |
| 1095 | 1105 |
| 1096 bool MouseEventManager::MouseDownMayStartDrag() { | 1106 bool MouseEventManager::MouseDownMayStartDrag() { |
| 1097 return mouse_down_may_start_drag_; | 1107 return mouse_down_may_start_drag_; |
| 1098 } | 1108 } |
| 1099 | 1109 |
| 1100 } // namespace blink | 1110 } // namespace blink |
| OLD | NEW |