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

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

Issue 2782893002: WebMouseEvent coordinates are now fractional & private (Closed)
Patch Set: Rebased, fixed a comment in web_input_event_builders_mac.mm Created 3 years, 8 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
OLDNEW
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
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
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
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
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/input/EventHandlerTest.cpp ('k') | third_party/WebKit/Source/platform/WebMouseEvent.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698