| 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 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 Node* exitedNode, | 177 Node* exitedNode, |
| 178 Node* enteredNode, | 178 Node* enteredNode, |
| 179 const PlatformMouseEvent& mouseEvent, | 179 const PlatformMouseEvent& mouseEvent, |
| 180 bool isFrameBoundaryTransition) | 180 bool isFrameBoundaryTransition) |
| 181 { | 181 { |
| 182 // Mouse event type does not matter as this pointerevent will only be used | 182 // Mouse event type does not matter as this pointerevent will only be used |
| 183 // to create boundary pointer events and its type will be overridden in | 183 // to create boundary pointer events and its type will be overridden in |
| 184 // |sendBoundaryEvents| function. | 184 // |sendBoundaryEvents| function. |
| 185 PointerEvent* dummyPointerEvent = | 185 PointerEvent* dummyPointerEvent = |
| 186 m_pointerEventFactory.create(EventTypeNames::mousedown, mouseEvent, | 186 m_pointerEventFactory.create(EventTypeNames::mousedown, mouseEvent, |
| 187 nullptr, m_frame->document()->domWindow()); | 187 m_frame->document()->domWindow()); |
| 188 | 188 |
| 189 // TODO(crbug/545647): This state should reset with pointercancel too. | 189 // TODO(crbug/545647): This state should reset with pointercancel too. |
| 190 // This function also gets called for compat mouse events of touch at this | 190 // This function also gets called for compat mouse events of touch at this |
| 191 // stage. So if the event is not frame boundary transition it is only a | 191 // stage. So if the event is not frame boundary transition it is only a |
| 192 // compatibility mouse event and we do not need to change pointer event | 192 // compatibility mouse event and we do not need to change pointer event |
| 193 // behavior regarding preventMouseEvent state in that case. | 193 // behavior regarding preventMouseEvent state in that case. |
| 194 if (isFrameBoundaryTransition && dummyPointerEvent->buttons() == 0 | 194 if (isFrameBoundaryTransition && dummyPointerEvent->buttons() == 0 |
| 195 && dummyPointerEvent->isPrimary()) { | 195 && dummyPointerEvent->isPrimary()) { |
| 196 m_preventMouseEventForPointerType[toPointerTypeIndex( | 196 m_preventMouseEventForPointerType[toPointerTypeIndex( |
| 197 mouseEvent.pointerProperties().pointerType)] = false; | 197 mouseEvent.pointerProperties().pointerType)] = false; |
| (...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 511 | 511 |
| 512 removePointer(pointerEvent); | 512 removePointer(pointerEvent); |
| 513 } | 513 } |
| 514 | 514 |
| 515 return result; | 515 return result; |
| 516 } | 516 } |
| 517 | 517 |
| 518 WebInputEventResult PointerEventManager::sendMousePointerEvent( | 518 WebInputEventResult PointerEventManager::sendMousePointerEvent( |
| 519 Node* target, const AtomicString& mouseEventType, | 519 Node* target, const AtomicString& mouseEventType, |
| 520 int clickCount, const PlatformMouseEvent& mouseEvent, | 520 int clickCount, const PlatformMouseEvent& mouseEvent, |
| 521 Node* relatedTarget, | |
| 522 Node* lastNodeUnderMouse, | 521 Node* lastNodeUnderMouse, |
| 523 Node** newNodeUnderMouse) | 522 Node** newNodeUnderMouse) |
| 524 { | 523 { |
| 525 PointerEvent* pointerEvent = | 524 PointerEvent* pointerEvent = |
| 526 m_pointerEventFactory.create(mouseEventType, mouseEvent, | 525 m_pointerEventFactory.create(mouseEventType, mouseEvent, |
| 527 relatedTarget, m_frame->document()->domWindow()); | 526 m_frame->document()->domWindow()); |
| 528 | 527 |
| 529 // This is for when the mouse is released outside of the page. | 528 // This is for when the mouse is released outside of the page. |
| 530 if (pointerEvent->type() == EventTypeNames::pointermove | 529 if (pointerEvent->type() == EventTypeNames::pointermove |
| 531 && !pointerEvent->buttons()) { | 530 && !pointerEvent->buttons()) { |
| 532 | 531 |
| 533 releasePointerCapture(pointerEvent->pointerId()); | 532 releasePointerCapture(pointerEvent->pointerId()); |
| 534 // Send got/lostpointercapture rightaway if necessary. | 533 // Send got/lostpointercapture rightaway if necessary. |
| 535 processPendingPointerCapture(pointerEvent); | 534 processPendingPointerCapture(pointerEvent); |
| 536 | 535 |
| 537 if (pointerEvent->isPrimary()) { | 536 if (pointerEvent->isPrimary()) { |
| (...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 805 { | 804 { |
| 806 visitor->trace(m_frame); | 805 visitor->trace(m_frame); |
| 807 visitor->trace(m_nodeUnderPointer); | 806 visitor->trace(m_nodeUnderPointer); |
| 808 visitor->trace(m_pointerCaptureTarget); | 807 visitor->trace(m_pointerCaptureTarget); |
| 809 visitor->trace(m_pendingPointerCaptureTarget); | 808 visitor->trace(m_pendingPointerCaptureTarget); |
| 810 visitor->trace(m_touchEventManager); | 809 visitor->trace(m_touchEventManager); |
| 811 } | 810 } |
| 812 | 811 |
| 813 | 812 |
| 814 } // namespace blink | 813 } // namespace blink |
| OLD | NEW |