| 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 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 416 | 416 |
| 417 if (m_inCanceledStateForPointerTypeTouch) | 417 if (m_inCanceledStateForPointerTypeTouch) |
| 418 return; | 418 return; |
| 419 | 419 |
| 420 // Iterate through the touch points, sending PointerEvents to the targets as
required. | 420 // Iterate through the touch points, sending PointerEvents to the targets as
required. |
| 421 for (auto& touchInfo: touchInfos) { | 421 for (auto& touchInfo: touchInfos) { |
| 422 const PlatformTouchPoint &touchPoint = touchInfo.point; | 422 const PlatformTouchPoint &touchPoint = touchInfo.point; |
| 423 WebInputEventResult result = WebInputEventResult::NotHandled; | 423 WebInputEventResult result = WebInputEventResult::NotHandled; |
| 424 // Do not send pointer events for stationary touches. | 424 // Do not send pointer events for stationary touches. |
| 425 if (touchPoint.state() != PlatformTouchPoint::TouchStationary) { | 425 if (touchPoint.state() != PlatformTouchPoint::TouchStationary) { |
| 426 // TODO(crbug.com/608394): The adjustedPagePoint should be converted | 426 float scaleFactor = 1.0f / touchInfo.targetFrame->pageZoomFactor(); |
| 427 // to client coordinates. | 427 FloatPoint scrollPosition = touchInfo.targetFrame->view()->scrollPos
ition(); |
| 428 FloatPoint framePoint = touchInfo.contentPoint; |
| 429 framePoint.moveBy(scrollPosition.scaledBy(-scaleFactor)); |
| 428 PointerEvent* pointerEvent = m_pointerEventFactory.create( | 430 PointerEvent* pointerEvent = m_pointerEventFactory.create( |
| 429 pointerEventNameForTouchPointState(touchPoint.state()), | 431 pointerEventNameForTouchPointState(touchPoint.state()), |
| 430 touchPoint, event.getModifiers(), | 432 touchPoint, event.getModifiers(), |
| 431 touchInfo.adjustedRadius, | 433 touchInfo.adjustedRadius, |
| 432 touchInfo.adjustedPagePoint); | 434 framePoint); |
| 433 | 435 |
| 434 // Consume the touch point if its pointer event is anything but NotH
andled | 436 // Consume the touch point if its pointer event is anything but NotH
andled |
| 435 // (e.g. preventDefault is called in the listener for the pointer ev
ent). | 437 // (e.g. preventDefault is called in the listener for the pointer ev
ent). |
| 436 result = sendTouchPointerEvent(touchInfo.touchNode, pointerEvent); | 438 result = sendTouchPointerEvent(touchInfo.touchNode, pointerEvent); |
| 437 touchInfo.consumed = result != WebInputEventResult::NotHandled; | 439 touchInfo.consumed = result != WebInputEventResult::NotHandled; |
| 438 } | 440 } |
| 439 } | 441 } |
| 440 } | 442 } |
| 441 | 443 |
| 442 WebInputEventResult PointerEventManager::sendTouchPointerEvent( | 444 WebInputEventResult PointerEventManager::sendTouchPointerEvent( |
| (...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 720 { | 722 { |
| 721 visitor->trace(m_frame); | 723 visitor->trace(m_frame); |
| 722 visitor->trace(m_nodeUnderPointer); | 724 visitor->trace(m_nodeUnderPointer); |
| 723 visitor->trace(m_pointerCaptureTarget); | 725 visitor->trace(m_pointerCaptureTarget); |
| 724 visitor->trace(m_pendingPointerCaptureTarget); | 726 visitor->trace(m_pendingPointerCaptureTarget); |
| 725 visitor->trace(m_touchEventManager); | 727 visitor->trace(m_touchEventManager); |
| 726 } | 728 } |
| 727 | 729 |
| 728 | 730 |
| 729 } // namespace blink | 731 } // namespace blink |
| OLD | NEW |