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 511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
522 return m_isMousePositionUnknown; | 522 return m_isMousePositionUnknown; |
523 } | 523 } |
524 | 524 |
525 IntPoint MouseEventManager::lastKnownMousePosition() { | 525 IntPoint MouseEventManager::lastKnownMousePosition() { |
526 return m_lastKnownMousePosition; | 526 return m_lastKnownMousePosition; |
527 } | 527 } |
528 | 528 |
529 void MouseEventManager::setLastKnownMousePosition(const WebMouseEvent& event) { | 529 void MouseEventManager::setLastKnownMousePosition(const WebMouseEvent& event) { |
530 m_isMousePositionUnknown = false; | 530 m_isMousePositionUnknown = false; |
531 m_lastKnownMousePosition = flooredIntPoint(event.positionInRootFrame()); | 531 m_lastKnownMousePosition = flooredIntPoint(event.positionInRootFrame()); |
532 m_lastKnownMouseGlobalPosition = IntPoint(event.globalX, event.globalY); | 532 m_lastKnownMouseGlobalPosition = |
| 533 IntPoint(event.positionInScreen().x, event.positionInScreen().y); |
533 } | 534 } |
534 | 535 |
535 void MouseEventManager::dispatchFakeMouseMoveEventSoon() { | 536 void MouseEventManager::dispatchFakeMouseMoveEventSoon() { |
536 if (m_mousePressed) | 537 if (m_mousePressed) |
537 return; | 538 return; |
538 | 539 |
539 if (m_isMousePositionUnknown) | 540 if (m_isMousePositionUnknown) |
540 return; | 541 return; |
541 | 542 |
542 // Reschedule the timer, to prevent dispatching mouse move events | 543 // Reschedule the timer, to prevent dispatching mouse move events |
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
899 if (!view) | 900 if (!view) |
900 return WebInputEventResult::NotHandled; | 901 return WebInputEventResult::NotHandled; |
901 | 902 |
902 const bool cancelable = eventType != EventTypeNames::dragleave && | 903 const bool cancelable = eventType != EventTypeNames::dragleave && |
903 eventType != EventTypeNames::dragend; | 904 eventType != EventTypeNames::dragend; |
904 | 905 |
905 IntPoint position = flooredIntPoint(event.positionInRootFrame()); | 906 IntPoint position = flooredIntPoint(event.positionInRootFrame()); |
906 IntPoint movement = flooredIntPoint(event.movementInRootFrame()); | 907 IntPoint movement = flooredIntPoint(event.movementInRootFrame()); |
907 DragEvent* me = DragEvent::create( | 908 DragEvent* me = DragEvent::create( |
908 eventType, true, cancelable, m_frame->document()->domWindow(), 0, | 909 eventType, true, cancelable, m_frame->document()->domWindow(), 0, |
909 event.globalX, event.globalY, position.x(), position.y(), movement.x(), | 910 event.positionInScreen().x, event.positionInScreen().y, position.x(), |
910 movement.y(), static_cast<WebInputEvent::Modifiers>(event.modifiers()), 0, | 911 position.y(), movement.x(), movement.y(), |
| 912 static_cast<WebInputEvent::Modifiers>(event.modifiers()), 0, |
911 MouseEvent::webInputEventModifiersToButtons(event.modifiers()), nullptr, | 913 MouseEvent::webInputEventModifiersToButtons(event.modifiers()), nullptr, |
912 TimeTicks::FromSeconds(event.timeStampSeconds()), dataTransfer, | 914 TimeTicks::FromSeconds(event.timeStampSeconds()), dataTransfer, |
913 event.fromTouch() ? MouseEvent::FromTouch | 915 event.fromTouch() ? MouseEvent::FromTouch |
914 : MouseEvent::RealOrIndistinguishable); | 916 : MouseEvent::RealOrIndistinguishable); |
915 | 917 |
916 return EventHandlingUtil::toWebInputEventResult( | 918 return EventHandlingUtil::toWebInputEventResult( |
917 dragTarget->dispatchEvent(me)); | 919 dragTarget->dispatchEvent(me)); |
918 } | 920 } |
919 | 921 |
920 void MouseEventManager::clearDragDataTransfer() { | 922 void MouseEventManager::clearDragDataTransfer() { |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1021 | 1023 |
1022 void MouseEventManager::setClickCount(int clickCount) { | 1024 void MouseEventManager::setClickCount(int clickCount) { |
1023 m_clickCount = clickCount; | 1025 m_clickCount = clickCount; |
1024 } | 1026 } |
1025 | 1027 |
1026 bool MouseEventManager::mouseDownMayStartDrag() { | 1028 bool MouseEventManager::mouseDownMayStartDrag() { |
1027 return m_mouseDownMayStartDrag; | 1029 return m_mouseDownMayStartDrag; |
1028 } | 1030 } |
1029 | 1031 |
1030 } // namespace blink | 1032 } // namespace blink |
OLD | NEW |