| 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 627 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 638 | 638 |
| 639 void MouseEventManager::updateSelectionForMouseDrag() { | 639 void MouseEventManager::updateSelectionForMouseDrag() { |
| 640 m_frame->eventHandler().selectionController().updateSelectionForMouseDrag( | 640 m_frame->eventHandler().selectionController().updateSelectionForMouseDrag( |
| 641 m_mousePressNode, m_dragStartPos, m_lastKnownMousePosition); | 641 m_mousePressNode, m_dragStartPos, m_lastKnownMousePosition); |
| 642 } | 642 } |
| 643 | 643 |
| 644 bool MouseEventManager::handleDragDropIfPossible( | 644 bool MouseEventManager::handleDragDropIfPossible( |
| 645 const GestureEventWithHitTestResults& targetedEvent) { | 645 const GestureEventWithHitTestResults& targetedEvent) { |
| 646 if (m_frame->settings() && m_frame->settings()->touchDragDropEnabled() && | 646 if (m_frame->settings() && m_frame->settings()->touchDragDropEnabled() && |
| 647 m_frame->view()) { | 647 m_frame->view()) { |
| 648 const PlatformGestureEvent& gestureEvent = targetedEvent.event(); | 648 const WebGestureEvent& gestureEvent = targetedEvent.event(); |
| 649 IntPoint adjustedPoint = gestureEvent.position(); | 649 unsigned modifiers = gestureEvent.modifiers; |
| 650 unsigned modifiers = gestureEvent.getModifiers(); | |
| 651 | 650 |
| 652 // TODO(mustaq): Suppressing long-tap MouseEvents could break | 651 // TODO(mustaq): Suppressing long-tap MouseEvents could break |
| 653 // drag-drop. Will do separately because of the risk. crbug.com/606938. | 652 // drag-drop. Will do separately because of the risk. crbug.com/606938. |
| 654 PlatformMouseEvent mouseDownEvent( | 653 PlatformMouseEvent mouseDownEvent( |
| 655 adjustedPoint, gestureEvent.globalPosition(), | 654 gestureEvent, WebPointerProperties::Button::Left, |
| 656 WebPointerProperties::Button::Left, PlatformEvent::MousePressed, 1, | 655 PlatformEvent::MousePressed, 1, |
| 657 static_cast<PlatformEvent::Modifiers>(modifiers | | 656 static_cast<PlatformEvent::Modifiers>(modifiers | |
| 658 PlatformEvent::LeftButtonDown), | 657 PlatformEvent::LeftButtonDown), |
| 659 PlatformMouseEvent::FromTouch, WTF::monotonicallyIncreasingTime(), | 658 PlatformMouseEvent::FromTouch, WTF::monotonicallyIncreasingTime(), |
| 660 WebPointerProperties::PointerType::Mouse); | 659 WebPointerProperties::PointerType::Mouse); |
| 661 m_mouseDown = mouseDownEvent; | 660 m_mouseDown = mouseDownEvent; |
| 662 | 661 |
| 663 PlatformMouseEvent mouseDragEvent( | 662 PlatformMouseEvent mouseDragEvent( |
| 664 adjustedPoint, gestureEvent.globalPosition(), | 663 gestureEvent, WebPointerProperties::Button::Left, |
| 665 WebPointerProperties::Button::Left, PlatformEvent::MouseMoved, 1, | 664 PlatformEvent::MouseMoved, 1, |
| 666 static_cast<PlatformEvent::Modifiers>(modifiers | | 665 static_cast<PlatformEvent::Modifiers>(modifiers | |
| 667 PlatformEvent::LeftButtonDown), | 666 PlatformEvent::LeftButtonDown), |
| 668 PlatformMouseEvent::FromTouch, WTF::monotonicallyIncreasingTime(), | 667 PlatformMouseEvent::FromTouch, WTF::monotonicallyIncreasingTime(), |
| 669 WebPointerProperties::PointerType::Mouse); | 668 WebPointerProperties::PointerType::Mouse); |
| 670 HitTestRequest request(HitTestRequest::ReadOnly); | 669 HitTestRequest request(HitTestRequest::ReadOnly); |
| 671 MouseEventWithHitTestResults mev = | 670 MouseEventWithHitTestResults mev = |
| 672 EventHandlingUtil::performMouseEventHitTest(m_frame, request, | 671 EventHandlingUtil::performMouseEventHitTest(m_frame, request, |
| 673 mouseDragEvent); | 672 mouseDragEvent); |
| 674 m_mouseDownMayStartDrag = true; | 673 m_mouseDownMayStartDrag = true; |
| 675 dragState().m_dragSrc = nullptr; | 674 dragState().m_dragSrc = nullptr; |
| (...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 991 | 990 |
| 992 void MouseEventManager::setClickCount(int clickCount) { | 991 void MouseEventManager::setClickCount(int clickCount) { |
| 993 m_clickCount = clickCount; | 992 m_clickCount = clickCount; |
| 994 } | 993 } |
| 995 | 994 |
| 996 bool MouseEventManager::mouseDownMayStartDrag() { | 995 bool MouseEventManager::mouseDownMayStartDrag() { |
| 997 return m_mouseDownMayStartDrag; | 996 return m_mouseDownMayStartDrag; |
| 998 } | 997 } |
| 999 | 998 |
| 1000 } // namespace blink | 999 } // namespace blink |
| OLD | NEW |