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

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

Issue 1960233002: Fix mouse pointer event clientX/Y (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix a typo Created 4 years, 7 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
« no previous file with comments | « third_party/WebKit/Source/core/input/PointerEventManager.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/PointerEventManager.h" 5 #include "core/input/PointerEventManager.h"
6 6
7 #include "core/dom/ElementTraversal.h" 7 #include "core/dom/ElementTraversal.h"
8 #include "core/dom/shadow/FlatTreeTraversal.h" 8 #include "core/dom/shadow/FlatTreeTraversal.h"
9 #include "core/events/MouseEvent.h" 9 #include "core/events/MouseEvent.h"
10 #include "core/frame/FrameView.h" 10 #include "core/frame/FrameView.h"
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 { 162 {
163 if (EventTarget* capturingTarget = getCapturingNode(pointerId)) 163 if (EventTarget* capturingTarget = getCapturingNode(pointerId))
164 return capturingTarget; 164 return capturingTarget;
165 return target; 165 return target;
166 } 166 }
167 167
168 void PointerEventManager::sendMouseAndPossiblyPointerNodeTransitionEvents( 168 void PointerEventManager::sendMouseAndPossiblyPointerNodeTransitionEvents(
169 Node* exitedNode, 169 Node* exitedNode,
170 Node* enteredNode, 170 Node* enteredNode,
171 const PlatformMouseEvent& mouseEvent, 171 const PlatformMouseEvent& mouseEvent,
172 AbstractView* view,
173 bool isFrameBoundaryTransition) 172 bool isFrameBoundaryTransition)
174 { 173 {
175 // Pointer event type does not matter as it will be overridden in the sendNo deTransitionEvents 174 // Pointer event type does not matter as it will be overridden in the sendNo deTransitionEvents
176 PointerEvent* pointerEvent = 175 PointerEvent* pointerEvent =
177 m_pointerEventFactory.create(EventTypeNames::mouseout, mouseEvent, 176 m_pointerEventFactory.create(EventTypeNames::mouseout, mouseEvent,
178 nullptr, view); 177 nullptr, m_frame->document()->domWindow());
179 178
180 // TODO(crbug/545647): This state should reset with pointercancel too. 179 // TODO(crbug/545647): This state should reset with pointercancel too.
181 // This function also gets called for compat mouse events of touch at this 180 // This function also gets called for compat mouse events of touch at this
182 // stage. So if the event is not frame boundary transition it is only a 181 // stage. So if the event is not frame boundary transition it is only a
183 // compatibility mouse event and we do not need to change pointer event 182 // compatibility mouse event and we do not need to change pointer event
184 // behavior regarding preventMouseEvent state in that case. 183 // behavior regarding preventMouseEvent state in that case.
185 if (isFrameBoundaryTransition && pointerEvent->buttons() == 0 184 if (isFrameBoundaryTransition && pointerEvent->buttons() == 0
186 && pointerEvent->isPrimary()) { 185 && pointerEvent->isPrimary()) {
187 m_preventMouseEventForPointerType[toPointerTypeIndex( 186 m_preventMouseEventForPointerType[toPointerTypeIndex(
188 mouseEvent.pointerProperties().pointerType)] = false; 187 mouseEvent.pointerProperties().pointerType)] = false;
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after
469 removePointer(pointerEvent); 468 removePointer(pointerEvent);
470 } 469 }
471 470
472 return result; 471 return result;
473 } 472 }
474 473
475 WebInputEventResult PointerEventManager::sendMousePointerEvent( 474 WebInputEventResult PointerEventManager::sendMousePointerEvent(
476 Node* target, const AtomicString& mouseEventType, 475 Node* target, const AtomicString& mouseEventType,
477 int clickCount, const PlatformMouseEvent& mouseEvent, 476 int clickCount, const PlatformMouseEvent& mouseEvent,
478 Node* relatedTarget, 477 Node* relatedTarget,
479 AbstractView* view,
480 Node* lastNodeUnderMouse) 478 Node* lastNodeUnderMouse)
481 { 479 {
482 PointerEvent* pointerEvent = 480 PointerEvent* pointerEvent =
483 m_pointerEventFactory.create(mouseEventType, mouseEvent, 481 m_pointerEventFactory.create(mouseEventType, mouseEvent,
484 relatedTarget, view); 482 relatedTarget, m_frame->document()->domWindow());
485 483
486 // This is for when the mouse is released outside of the page. 484 // This is for when the mouse is released outside of the page.
487 if (pointerEvent->type() == EventTypeNames::pointermove 485 if (pointerEvent->type() == EventTypeNames::pointermove
488 && !pointerEvent->buttons() 486 && !pointerEvent->buttons()
489 && pointerEvent->isPrimary()) { 487 && pointerEvent->isPrimary()) {
490 m_preventMouseEventForPointerType[toPointerTypeIndex( 488 m_preventMouseEventForPointerType[toPointerTypeIndex(
491 mouseEvent.pointerProperties().pointerType)] = false; 489 mouseEvent.pointerProperties().pointerType)] = false;
492 } 490 }
493 491
494 processCaptureAndPositionOfPointerEvent(pointerEvent, target, 492 processCaptureAndPositionOfPointerEvent(pointerEvent, target,
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
732 { 730 {
733 visitor->trace(m_frame); 731 visitor->trace(m_frame);
734 visitor->trace(m_nodeUnderPointer); 732 visitor->trace(m_nodeUnderPointer);
735 visitor->trace(m_pointerCaptureTarget); 733 visitor->trace(m_pointerCaptureTarget);
736 visitor->trace(m_pendingPointerCaptureTarget); 734 visitor->trace(m_pendingPointerCaptureTarget);
737 visitor->trace(m_touchEventManager); 735 visitor->trace(m_touchEventManager);
738 } 736 }
739 737
740 738
741 } // namespace blink 739 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/input/PointerEventManager.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698