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 27 matching lines...) Expand all Loading... |
38 const PlatformMouseEvent& mouseEvent) { | 38 const PlatformMouseEvent& mouseEvent) { |
39 if (!node->isElementNode()) | 39 if (!node->isElementNode()) |
40 return mouseEvent; | 40 return mouseEvent; |
41 | 41 |
42 Element* element = toElement(node); | 42 Element* element = toElement(node); |
43 if (!element->isInCanvasSubtree()) | 43 if (!element->isInCanvasSubtree()) |
44 return mouseEvent; | 44 return mouseEvent; |
45 | 45 |
46 HTMLCanvasElement* canvas = | 46 HTMLCanvasElement* canvas = |
47 Traversal<HTMLCanvasElement>::firstAncestorOrSelf(*element); | 47 Traversal<HTMLCanvasElement>::firstAncestorOrSelf(*element); |
48 // In this case, the event target is canvas and mouse rerouting doesn't happen
. | 48 // In this case, the event target is canvas and mouse rerouting doesn't |
| 49 // happen. |
49 if (canvas == element) | 50 if (canvas == element) |
50 return mouseEvent; | 51 return mouseEvent; |
51 String region = canvas->getIdFromControl(element); | 52 String region = canvas->getIdFromControl(element); |
52 PlatformMouseEvent newMouseEvent = mouseEvent; | 53 PlatformMouseEvent newMouseEvent = mouseEvent; |
53 newMouseEvent.setRegion(region); | 54 newMouseEvent.setRegion(region); |
54 return newMouseEvent; | 55 return newMouseEvent; |
55 } | 56 } |
56 | 57 |
57 // The amount of time to wait before sending a fake mouse event triggered | 58 // The amount of time to wait before sending a fake mouse event triggered |
58 // during a scroll. | 59 // during a scroll. |
59 const double kFakeMouseMoveInterval = 0.1; | 60 const double kFakeMouseMoveInterval = 0.1; |
60 | 61 |
61 #if OS(MACOSX) | 62 #if OS(MACOSX) |
62 const double kTextDragDelay = 0.15; | 63 const double kTextDragDelay = 0.15; |
63 #else | 64 #else |
64 const double kTextDragDelay = 0.0; | 65 const double kTextDragDelay = 0.0; |
65 #endif | 66 #endif |
66 | 67 |
67 // The link drag hysteresis is much larger than the others because there | 68 // The link drag hysteresis is much larger than the others because there |
68 // needs to be enough space to cancel the link press without starting a link dra
g, | 69 // needs to be enough space to cancel the link press without starting a link |
69 // and because dragging links is rare. | 70 // drag, and because dragging links is rare. |
70 const int kLinkDragHysteresis = 40; | 71 const int kLinkDragHysteresis = 40; |
71 const int kImageDragHysteresis = 5; | 72 const int kImageDragHysteresis = 5; |
72 const int kTextDragHysteresis = 3; | 73 const int kTextDragHysteresis = 3; |
73 const int kGeneralDragHysteresis = 3; | 74 const int kGeneralDragHysteresis = 3; |
74 | 75 |
75 } // namespace | 76 } // namespace |
76 | 77 |
77 enum class DragInitiator { Mouse, Touch }; | 78 enum class DragInitiator { Mouse, Touch }; |
78 | 79 |
79 MouseEventManager::MouseEventManager(LocalFrame* frame, | 80 MouseEventManager::MouseEventManager(LocalFrame* frame, |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 } | 228 } |
228 | 229 |
229 WebInputEventResult MouseEventManager::dispatchMouseClickIfNeeded( | 230 WebInputEventResult MouseEventManager::dispatchMouseClickIfNeeded( |
230 const MouseEventWithHitTestResults& mev) { | 231 const MouseEventWithHitTestResults& mev) { |
231 // We only prevent click event when the click may cause contextmenu to popup. | 232 // We only prevent click event when the click may cause contextmenu to popup. |
232 // However, we always send auxclick. | 233 // However, we always send auxclick. |
233 bool contextMenuEvent = !RuntimeEnabledFeatures::auxclickEnabled() && | 234 bool contextMenuEvent = !RuntimeEnabledFeatures::auxclickEnabled() && |
234 mev.event().pointerProperties().button == | 235 mev.event().pointerProperties().button == |
235 WebPointerProperties::Button::Right; | 236 WebPointerProperties::Button::Right; |
236 #if OS(MACOSX) | 237 #if OS(MACOSX) |
237 // FIXME: The Mac port achieves the same behavior by checking whether the cont
ext menu is currently open in WebPage::mouseEvent(). Consider merging the implem
entations. | 238 // FIXME: The Mac port achieves the same behavior by checking whether the |
| 239 // context menu is currently open in WebPage::mouseEvent(). Consider merging |
| 240 // the implementations. |
238 if (mev.event().pointerProperties().button == | 241 if (mev.event().pointerProperties().button == |
239 WebPointerProperties::Button::Left && | 242 WebPointerProperties::Button::Left && |
240 mev.event().getModifiers() & PlatformEvent::CtrlKey) | 243 mev.event().getModifiers() & PlatformEvent::CtrlKey) |
241 contextMenuEvent = true; | 244 contextMenuEvent = true; |
242 #endif | 245 #endif |
243 | 246 |
244 WebInputEventResult clickEventResult = WebInputEventResult::NotHandled; | 247 WebInputEventResult clickEventResult = WebInputEventResult::NotHandled; |
245 const bool shouldDispatchClickEvent = | 248 const bool shouldDispatchClickEvent = |
246 m_clickCount > 0 && !contextMenuEvent && mev.innerNode() && m_clickNode && | 249 m_clickCount > 0 && !contextMenuEvent && mev.innerNode() && m_clickNode && |
247 mev.innerNode()->canParticipateInFlatTree() && | 250 mev.innerNode()->canParticipateInFlatTree() && |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
284 if (settings && !settings->deviceSupportsMouse()) | 287 if (settings && !settings->deviceSupportsMouse()) |
285 return; | 288 return; |
286 | 289 |
287 FrameView* view = m_frame->view(); | 290 FrameView* view = m_frame->view(); |
288 if (!view) | 291 if (!view) |
289 return; | 292 return; |
290 | 293 |
291 if (!m_frame->page() || !m_frame->page()->focusController().isActive()) | 294 if (!m_frame->page() || !m_frame->page()->focusController().isActive()) |
292 return; | 295 return; |
293 | 296 |
294 // Don't dispatch a synthetic mouse move event if the mouse cursor is not visi
ble to the user. | 297 // Don't dispatch a synthetic mouse move event if the mouse cursor is not |
| 298 // visible to the user. |
295 if (!m_frame->page()->isCursorVisible()) | 299 if (!m_frame->page()->isCursorVisible()) |
296 return; | 300 return; |
297 | 301 |
298 PlatformMouseEvent fakeMouseMoveEvent( | 302 PlatformMouseEvent fakeMouseMoveEvent( |
299 m_lastKnownMousePosition, m_lastKnownMouseGlobalPosition, | 303 m_lastKnownMousePosition, m_lastKnownMouseGlobalPosition, |
300 WebPointerProperties::Button::NoButton, PlatformEvent::MouseMoved, 0, | 304 WebPointerProperties::Button::NoButton, PlatformEvent::MouseMoved, 0, |
301 static_cast<PlatformEvent::Modifiers>( | 305 static_cast<PlatformEvent::Modifiers>( |
302 KeyboardEventManager::getCurrentModifierState()), | 306 KeyboardEventManager::getCurrentModifierState()), |
303 PlatformMouseEvent::RealOrIndistinguishable, | 307 PlatformMouseEvent::RealOrIndistinguishable, |
304 monotonicallyIncreasingTime(), WebPointerProperties::PointerType::Mouse); | 308 monotonicallyIncreasingTime(), WebPointerProperties::PointerType::Mouse); |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
453 bool MouseEventManager::slideFocusOnShadowHostIfNecessary( | 457 bool MouseEventManager::slideFocusOnShadowHostIfNecessary( |
454 const Element& element) { | 458 const Element& element) { |
455 if (element.authorShadowRoot() && | 459 if (element.authorShadowRoot() && |
456 element.authorShadowRoot()->delegatesFocus()) { | 460 element.authorShadowRoot()->delegatesFocus()) { |
457 Document* doc = m_frame->document(); | 461 Document* doc = m_frame->document(); |
458 if (element.isShadowIncludingInclusiveAncestorOf(doc->focusedElement())) { | 462 if (element.isShadowIncludingInclusiveAncestorOf(doc->focusedElement())) { |
459 // If the inner element is already focused, do nothing. | 463 // If the inner element is already focused, do nothing. |
460 return true; | 464 return true; |
461 } | 465 } |
462 | 466 |
463 // If the host has a focusable inner element, focus it. Otherwise, the host
takes focus. | 467 // If the host has a focusable inner element, focus it. Otherwise, the host |
| 468 // takes focus. |
464 Page* page = m_frame->page(); | 469 Page* page = m_frame->page(); |
465 DCHECK(page); | 470 DCHECK(page); |
466 Element* found = | 471 Element* found = |
467 page->focusController().findFocusableElementInShadowHost(element); | 472 page->focusController().findFocusableElementInShadowHost(element); |
468 if (found && element.isShadowIncludingInclusiveAncestorOf(found)) { | 473 if (found && element.isShadowIncludingInclusiveAncestorOf(found)) { |
469 // Use WebFocusTypeForward instead of WebFocusTypeMouse here to mean the f
ocus has slided. | 474 // Use WebFocusTypeForward instead of WebFocusTypeMouse here to mean the |
| 475 // focus has slided. |
470 found->focus(FocusParams(SelectionBehaviorOnFocus::Reset, | 476 found->focus(FocusParams(SelectionBehaviorOnFocus::Reset, |
471 WebFocusTypeForward, nullptr)); | 477 WebFocusTypeForward, nullptr)); |
472 return true; | 478 return true; |
473 } | 479 } |
474 } | 480 } |
475 return false; | 481 return false; |
476 } | 482 } |
477 | 483 |
478 void MouseEventManager::handleMousePressEventUpdateStates( | 484 void MouseEventManager::handleMousePressEventUpdateStates( |
479 const PlatformMouseEvent& mouseEvent) { | 485 const PlatformMouseEvent& mouseEvent) { |
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
729 | 735 |
730 m_frame->eventHandler().selectionController().handleMouseDraggedEvent( | 736 m_frame->eventHandler().selectionController().handleMouseDraggedEvent( |
731 event, m_mouseDownPos, m_dragStartPos, m_mousePressNode.get(), | 737 event, m_mouseDownPos, m_dragStartPos, m_mousePressNode.get(), |
732 m_lastKnownMousePosition); | 738 m_lastKnownMousePosition); |
733 return WebInputEventResult::HandledSystem; | 739 return WebInputEventResult::HandledSystem; |
734 } | 740 } |
735 | 741 |
736 bool MouseEventManager::handleDrag(const MouseEventWithHitTestResults& event, | 742 bool MouseEventManager::handleDrag(const MouseEventWithHitTestResults& event, |
737 DragInitiator initiator) { | 743 DragInitiator initiator) { |
738 DCHECK(event.event().type() == PlatformEvent::MouseMoved); | 744 DCHECK(event.event().type() == PlatformEvent::MouseMoved); |
739 // Callers must protect the reference to FrameView, since this function may di
spatch DOM | 745 // Callers must protect the reference to FrameView, since this function may |
740 // events, causing page/FrameView to go away. | 746 // dispatch DOM events, causing page/FrameView to go away. |
741 DCHECK(m_frame); | 747 DCHECK(m_frame); |
742 DCHECK(m_frame->view()); | 748 DCHECK(m_frame->view()); |
743 if (!m_frame->page()) | 749 if (!m_frame->page()) |
744 return false; | 750 return false; |
745 | 751 |
746 if (m_mouseDownMayStartDrag) { | 752 if (m_mouseDownMayStartDrag) { |
747 HitTestRequest request(HitTestRequest::ReadOnly); | 753 HitTestRequest request(HitTestRequest::ReadOnly); |
748 HitTestResult result(request, m_mouseDownPos); | 754 HitTestResult result(request, m_mouseDownPos); |
749 m_frame->contentLayoutItem().hitTest(result); | 755 m_frame->contentLayoutItem().hitTest(result); |
750 Node* node = result.innerNode(); | 756 Node* node = result.innerNode(); |
(...skipping 15 matching lines...) Expand all Loading... |
766 | 772 |
767 if (!m_mouseDownMayStartDrag) { | 773 if (!m_mouseDownMayStartDrag) { |
768 return initiator == DragInitiator::Mouse && | 774 return initiator == DragInitiator::Mouse && |
769 !m_frame->eventHandler() | 775 !m_frame->eventHandler() |
770 .selectionController() | 776 .selectionController() |
771 .mouseDownMayStartSelect() && | 777 .mouseDownMayStartSelect() && |
772 !m_mouseDownMayStartAutoscroll; | 778 !m_mouseDownMayStartAutoscroll; |
773 } | 779 } |
774 | 780 |
775 // We are starting a text/image/url drag, so the cursor should be an arrow | 781 // We are starting a text/image/url drag, so the cursor should be an arrow |
776 // FIXME <rdar://7577595>: Custom cursors aren't supported during drag and dro
p (default to pointer). | 782 // FIXME <rdar://7577595>: Custom cursors aren't supported during drag and |
| 783 // drop (default to pointer). |
777 m_frame->view()->setCursor(pointerCursor()); | 784 m_frame->view()->setCursor(pointerCursor()); |
778 | 785 |
779 if (initiator == DragInitiator::Mouse && | 786 if (initiator == DragInitiator::Mouse && |
780 !dragHysteresisExceeded(event.event().position())) | 787 !dragHysteresisExceeded(event.event().position())) |
781 return true; | 788 return true; |
782 | 789 |
783 // Once we're past the hysteresis point, we don't want to treat this gesture a
s a click | 790 // Once we're past the hysteresis point, we don't want to treat this gesture |
| 791 // as a click |
784 invalidateClick(); | 792 invalidateClick(); |
785 | 793 |
786 if (!tryStartDrag(event)) { | 794 if (!tryStartDrag(event)) { |
787 // Something failed to start the drag, clean up. | 795 // Something failed to start the drag, clean up. |
788 clearDragDataTransfer(); | 796 clearDragDataTransfer(); |
789 dragState().m_dragSrc = nullptr; | 797 dragState().m_dragSrc = nullptr; |
790 } | 798 } |
791 | 799 |
792 m_mouseDownMayStartDrag = false; | 800 m_mouseDownMayStartDrag = false; |
793 // Whether or not the drag actually started, no more default handling (like se
lection). | 801 // Whether or not the drag actually started, no more default handling (like |
| 802 // selection). |
794 return true; | 803 return true; |
795 } | 804 } |
796 | 805 |
797 DataTransfer* MouseEventManager::createDraggingDataTransfer() const { | 806 DataTransfer* MouseEventManager::createDraggingDataTransfer() const { |
798 return DataTransfer::create(DataTransfer::DragAndDrop, DataTransferWritable, | 807 return DataTransfer::create(DataTransfer::DragAndDrop, DataTransferWritable, |
799 DataObject::create()); | 808 DataObject::create()); |
800 } | 809 } |
801 | 810 |
802 bool MouseEventManager::tryStartDrag( | 811 bool MouseEventManager::tryStartDrag( |
803 const MouseEventWithHitTestResults& event) { | 812 const MouseEventWithHitTestResults& event) { |
804 // The DataTransfer would only be non-empty if we missed a dragEnd. | 813 // The DataTransfer would only be non-empty if we missed a dragEnd. |
805 // Clear it anyway, just to make sure it gets numbified. | 814 // Clear it anyway, just to make sure it gets numbified. |
806 clearDragDataTransfer(); | 815 clearDragDataTransfer(); |
807 | 816 |
808 dragState().m_dragDataTransfer = createDraggingDataTransfer(); | 817 dragState().m_dragDataTransfer = createDraggingDataTransfer(); |
809 | 818 |
810 // Check to see if this a DOM based drag, if it is get the DOM specified drag | 819 // Check to see if this a DOM based drag, if it is get the DOM specified drag |
811 // image and offset | 820 // image and offset |
812 if (dragState().m_dragType == DragSourceActionDHTML) { | 821 if (dragState().m_dragType == DragSourceActionDHTML) { |
813 if (LayoutObject* layoutObject = dragState().m_dragSrc->layoutObject()) { | 822 if (LayoutObject* layoutObject = dragState().m_dragSrc->layoutObject()) { |
814 IntRect boundingIncludingDescendants = | 823 IntRect boundingIncludingDescendants = |
815 layoutObject->absoluteBoundingBoxRectIncludingDescendants(); | 824 layoutObject->absoluteBoundingBoxRectIncludingDescendants(); |
816 IntSize delta = m_mouseDownPos - boundingIncludingDescendants.location(); | 825 IntSize delta = m_mouseDownPos - boundingIncludingDescendants.location(); |
817 dragState().m_dragDataTransfer->setDragImageElement( | 826 dragState().m_dragDataTransfer->setDragImageElement( |
818 dragState().m_dragSrc.get(), IntPoint(delta)); | 827 dragState().m_dragSrc.get(), IntPoint(delta)); |
819 } else { | 828 } else { |
820 // The layoutObject has disappeared, this can happen if the onStartDrag ha
ndler has hidden | 829 // The layoutObject has disappeared, this can happen if the onStartDrag |
821 // the element in some way. In this case we just kill the drag. | 830 // handler has hidden the element in some way. In this case we just kill |
| 831 // the drag. |
822 return false; | 832 return false; |
823 } | 833 } |
824 } | 834 } |
825 | 835 |
826 DragController& dragController = m_frame->page()->dragController(); | 836 DragController& dragController = m_frame->page()->dragController(); |
827 if (!dragController.populateDragDataTransfer(m_frame, dragState(), | 837 if (!dragController.populateDragDataTransfer(m_frame, dragState(), |
828 m_mouseDownPos)) | 838 m_mouseDownPos)) |
829 return false; | 839 return false; |
830 | 840 |
831 // If dispatching dragstart brings about another mouse down -- one way | 841 // If dispatching dragstart brings about another mouse down -- one way |
832 // this will happen is if a DevTools user breaks within a dragstart | 842 // this will happen is if a DevTools user breaks within a dragstart |
833 // handler and then clicks on the suspended page -- the drag state is | 843 // handler and then clicks on the suspended page -- the drag state is |
834 // reset. Hence, need to check if this particular drag operation can | 844 // reset. Hence, need to check if this particular drag operation can |
835 // continue even if dispatchEvent() indicates no (direct) cancellation. | 845 // continue even if dispatchEvent() indicates no (direct) cancellation. |
836 // Do that by checking if m_dragSrc is still set. | 846 // Do that by checking if m_dragSrc is still set. |
837 m_mouseDownMayStartDrag = | 847 m_mouseDownMayStartDrag = |
838 dispatchDragSrcEvent(EventTypeNames::dragstart, m_mouseDown) == | 848 dispatchDragSrcEvent(EventTypeNames::dragstart, m_mouseDown) == |
839 WebInputEventResult::NotHandled && | 849 WebInputEventResult::NotHandled && |
840 !m_frame->selection().isInPasswordField() && dragState().m_dragSrc; | 850 !m_frame->selection().isInPasswordField() && dragState().m_dragSrc; |
841 | 851 |
842 // Invalidate clipboard here against anymore pasteboard writing for security.
The drag | 852 // Invalidate clipboard here against anymore pasteboard writing for security. |
843 // image can still be changed as we drag, but not the pasteboard data. | 853 // The drag image can still be changed as we drag, but not the pasteboard |
| 854 // data. |
844 dragState().m_dragDataTransfer->setAccessPolicy(DataTransferImageWritable); | 855 dragState().m_dragDataTransfer->setAccessPolicy(DataTransferImageWritable); |
845 | 856 |
846 if (m_mouseDownMayStartDrag) { | 857 if (m_mouseDownMayStartDrag) { |
847 // Dispatching the event could cause Page to go away. Make sure it's still v
alid before trying to use DragController. | 858 // Dispatching the event could cause Page to go away. Make sure it's still |
| 859 // valid before trying to use DragController. |
848 if (m_frame->page() && | 860 if (m_frame->page() && |
849 dragController.startDrag(m_frame, dragState(), event.event(), | 861 dragController.startDrag(m_frame, dragState(), event.event(), |
850 m_mouseDownPos)) | 862 m_mouseDownPos)) |
851 return true; | 863 return true; |
852 // Drag was canned at the last minute - we owe m_dragSrc a DRAGEND event | 864 // Drag was canned at the last minute - we owe m_dragSrc a DRAGEND event |
853 dispatchDragSrcEvent(EventTypeNames::dragend, event.event()); | 865 dispatchDragSrcEvent(EventTypeNames::dragend, event.event()); |
854 } | 866 } |
855 | 867 |
856 return false; | 868 return false; |
857 } | 869 } |
858 | 870 |
859 // returns if we should continue "default processing", i.e., whether eventhandle
r canceled | 871 // Returns if we should continue "default processing", i.e., whether |
| 872 // eventhandler canceled. |
860 WebInputEventResult MouseEventManager::dispatchDragSrcEvent( | 873 WebInputEventResult MouseEventManager::dispatchDragSrcEvent( |
861 const AtomicString& eventType, | 874 const AtomicString& eventType, |
862 const PlatformMouseEvent& event) { | 875 const PlatformMouseEvent& event) { |
863 return dispatchDragEvent(eventType, dragState().m_dragSrc.get(), event, | 876 return dispatchDragEvent(eventType, dragState().m_dragSrc.get(), event, |
864 dragState().m_dragDataTransfer.get()); | 877 dragState().m_dragDataTransfer.get()); |
865 } | 878 } |
866 | 879 |
867 WebInputEventResult MouseEventManager::dispatchDragEvent( | 880 WebInputEventResult MouseEventManager::dispatchDragEvent( |
868 const AtomicString& eventType, | 881 const AtomicString& eventType, |
869 Node* dragTarget, | 882 Node* dragTarget, |
(...skipping 19 matching lines...) Expand all Loading... |
889 | 902 |
890 void MouseEventManager::clearDragDataTransfer() { | 903 void MouseEventManager::clearDragDataTransfer() { |
891 if (dragState().m_dragDataTransfer) { | 904 if (dragState().m_dragDataTransfer) { |
892 dragState().m_dragDataTransfer->clearDragImage(); | 905 dragState().m_dragDataTransfer->clearDragImage(); |
893 dragState().m_dragDataTransfer->setAccessPolicy(DataTransferNumb); | 906 dragState().m_dragDataTransfer->setAccessPolicy(DataTransferNumb); |
894 } | 907 } |
895 } | 908 } |
896 | 909 |
897 void MouseEventManager::dragSourceEndedAt(const PlatformMouseEvent& event, | 910 void MouseEventManager::dragSourceEndedAt(const PlatformMouseEvent& event, |
898 DragOperation operation) { | 911 DragOperation operation) { |
899 // Send a hit test request so that Layer gets a chance to update the :hover an
d :active pseudoclasses. | 912 // Send a hit test request so that Layer gets a chance to update the :hover |
| 913 // and :active pseudoclasses.. |
900 HitTestRequest request(HitTestRequest::Release); | 914 HitTestRequest request(HitTestRequest::Release); |
901 EventHandlingUtil::performMouseEventHitTest(m_frame, request, event); | 915 EventHandlingUtil::performMouseEventHitTest(m_frame, request, event); |
902 | 916 |
903 if (dragState().m_dragSrc) { | 917 if (dragState().m_dragSrc) { |
904 dragState().m_dragDataTransfer->setDestinationOperation(operation); | 918 dragState().m_dragDataTransfer->setDestinationOperation(operation); |
905 // for now we don't care if event handler cancels default behavior, since th
ere is none | 919 // For now we don't care if event handler cancels default behavior, since |
| 920 // there is none. |
906 dispatchDragSrcEvent(EventTypeNames::dragend, event); | 921 dispatchDragSrcEvent(EventTypeNames::dragend, event); |
907 } | 922 } |
908 clearDragDataTransfer(); | 923 clearDragDataTransfer(); |
909 dragState().m_dragSrc = nullptr; | 924 dragState().m_dragSrc = nullptr; |
910 // In case the drag was ended due to an escape key press we need to ensure | 925 // In case the drag was ended due to an escape key press we need to ensure |
911 // that consecutive mousemove events don't reinitiate the drag and drop. | 926 // that consecutive mousemove events don't reinitiate the drag and drop. |
912 m_mouseDownMayStartDrag = false; | 927 m_mouseDownMayStartDrag = false; |
913 } | 928 } |
914 | 929 |
915 DragState& MouseEventManager::dragState() { | 930 DragState& MouseEventManager::dragState() { |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
998 | 1013 |
999 void MouseEventManager::setClickCount(int clickCount) { | 1014 void MouseEventManager::setClickCount(int clickCount) { |
1000 m_clickCount = clickCount; | 1015 m_clickCount = clickCount; |
1001 } | 1016 } |
1002 | 1017 |
1003 bool MouseEventManager::mouseDownMayStartDrag() { | 1018 bool MouseEventManager::mouseDownMayStartDrag() { |
1004 return m_mouseDownMayStartDrag; | 1019 return m_mouseDownMayStartDrag; |
1005 } | 1020 } |
1006 | 1021 |
1007 } // namespace blink | 1022 } // namespace blink |
OLD | NEW |