| 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/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 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 { | 163 { |
| 164 if (EventTarget* capturingTarget = getCapturingNode(pointerId)) | 164 if (EventTarget* capturingTarget = getCapturingNode(pointerId)) |
| 165 return capturingTarget; | 165 return capturingTarget; |
| 166 return target; | 166 return target; |
| 167 } | 167 } |
| 168 | 168 |
| 169 void PointerEventManager::sendMouseAndPossiblyPointerNodeTransitionEvents( | 169 void PointerEventManager::sendMouseAndPossiblyPointerNodeTransitionEvents( |
| 170 Node* exitedNode, | 170 Node* exitedNode, |
| 171 Node* enteredNode, | 171 Node* enteredNode, |
| 172 const PlatformMouseEvent& mouseEvent, | 172 const PlatformMouseEvent& mouseEvent, |
| 173 AbstractView* view, | |
| 174 bool isFrameBoundaryTransition) | 173 bool isFrameBoundaryTransition) |
| 175 { | 174 { |
| 176 // Pointer event type does not matter as it will be overridden in the sendNo
deTransitionEvents | 175 // Pointer event type does not matter as it will be overridden in the sendNo
deTransitionEvents |
| 177 PointerEvent* pointerEvent = | 176 PointerEvent* pointerEvent = |
| 178 m_pointerEventFactory.create(EventTypeNames::mouseout, mouseEvent, | 177 m_pointerEventFactory.create(EventTypeNames::mouseout, mouseEvent, |
| 179 nullptr, view); | 178 nullptr, m_frame->document()->domWindow()); |
| 180 | 179 |
| 181 // TODO(crbug/545647): This state should reset with pointercancel too. | 180 // TODO(crbug/545647): This state should reset with pointercancel too. |
| 182 // This function also gets called for compat mouse events of touch at this | 181 // This function also gets called for compat mouse events of touch at this |
| 183 // stage. So if the event is not frame boundary transition it is only a | 182 // stage. So if the event is not frame boundary transition it is only a |
| 184 // compatibility mouse event and we do not need to change pointer event | 183 // compatibility mouse event and we do not need to change pointer event |
| 185 // behavior regarding preventMouseEvent state in that case. | 184 // behavior regarding preventMouseEvent state in that case. |
| 186 if (isFrameBoundaryTransition && pointerEvent->buttons() == 0 | 185 if (isFrameBoundaryTransition && pointerEvent->buttons() == 0 |
| 187 && pointerEvent->isPrimary()) { | 186 && pointerEvent->isPrimary()) { |
| 188 m_preventMouseEventForPointerType[toPointerTypeIndex( | 187 m_preventMouseEventForPointerType[toPointerTypeIndex( |
| 189 mouseEvent.pointerProperties().pointerType)] = false; | 188 mouseEvent.pointerProperties().pointerType)] = false; |
| (...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 466 removePointer(pointerEvent); | 465 removePointer(pointerEvent); |
| 467 } | 466 } |
| 468 | 467 |
| 469 return result; | 468 return result; |
| 470 } | 469 } |
| 471 | 470 |
| 472 WebInputEventResult PointerEventManager::sendMousePointerEvent( | 471 WebInputEventResult PointerEventManager::sendMousePointerEvent( |
| 473 Node* target, const AtomicString& mouseEventType, | 472 Node* target, const AtomicString& mouseEventType, |
| 474 int clickCount, const PlatformMouseEvent& mouseEvent, | 473 int clickCount, const PlatformMouseEvent& mouseEvent, |
| 475 Node* relatedTarget, | 474 Node* relatedTarget, |
| 476 AbstractView* view, | |
| 477 Node* lastNodeUnderMouse) | 475 Node* lastNodeUnderMouse) |
| 478 { | 476 { |
| 479 PointerEvent* pointerEvent = | 477 PointerEvent* pointerEvent = |
| 480 m_pointerEventFactory.create(mouseEventType, mouseEvent, | 478 m_pointerEventFactory.create(mouseEventType, mouseEvent, |
| 481 relatedTarget, view); | 479 relatedTarget, m_frame->document()->domWindow()); |
| 482 | 480 |
| 483 // This is for when the mouse is released outside of the page. | 481 // This is for when the mouse is released outside of the page. |
| 484 if (pointerEvent->type() == EventTypeNames::pointermove | 482 if (pointerEvent->type() == EventTypeNames::pointermove |
| 485 && !pointerEvent->buttons() | 483 && !pointerEvent->buttons() |
| 486 && pointerEvent->isPrimary()) { | 484 && pointerEvent->isPrimary()) { |
| 487 m_preventMouseEventForPointerType[toPointerTypeIndex( | 485 m_preventMouseEventForPointerType[toPointerTypeIndex( |
| 488 mouseEvent.pointerProperties().pointerType)] = false; | 486 mouseEvent.pointerProperties().pointerType)] = false; |
| 489 } | 487 } |
| 490 | 488 |
| 491 processCaptureAndPositionOfPointerEvent(pointerEvent, target, | 489 processCaptureAndPositionOfPointerEvent(pointerEvent, target, |
| (...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 718 { | 716 { |
| 719 visitor->trace(m_frame); | 717 visitor->trace(m_frame); |
| 720 visitor->trace(m_nodeUnderPointer); | 718 visitor->trace(m_nodeUnderPointer); |
| 721 visitor->trace(m_pointerCaptureTarget); | 719 visitor->trace(m_pointerCaptureTarget); |
| 722 visitor->trace(m_pendingPointerCaptureTarget); | 720 visitor->trace(m_pendingPointerCaptureTarget); |
| 723 visitor->trace(m_touchEventManager); | 721 visitor->trace(m_touchEventManager); |
| 724 } | 722 } |
| 725 | 723 |
| 726 | 724 |
| 727 } // namespace blink | 725 } // namespace blink |
| OLD | NEW |