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 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
338 touchInfo.targetFrame = touchInfo.touchNode->document().frame(); | 338 touchInfo.targetFrame = touchInfo.touchNode->document().frame(); |
339 } | 339 } |
340 | 340 |
341 // Do not send pointer events for stationary touches or null targetFrame | 341 // Do not send pointer events for stationary touches or null targetFrame |
342 if (touchInfo.touchNode && touchInfo.targetFrame && | 342 if (touchInfo.touchNode && touchInfo.targetFrame && |
343 touchPoint.state() != PlatformTouchPoint::TouchStationary && | 343 touchPoint.state() != PlatformTouchPoint::TouchStationary && |
344 !m_inCanceledStateForPointerTypeTouch) { | 344 !m_inCanceledStateForPointerTypeTouch) { |
345 FloatPoint pagePoint = touchInfo.targetFrame->view()->rootFrameToContents( | 345 FloatPoint pagePoint = touchInfo.targetFrame->view()->rootFrameToContents( |
346 touchInfo.point.pos()); | 346 touchInfo.point.pos()); |
347 float scaleFactor = 1.0f / touchInfo.targetFrame->pageZoomFactor(); | 347 float scaleFactor = 1.0f / touchInfo.targetFrame->pageZoomFactor(); |
348 FloatPoint scrollPosition = | 348 FloatPoint scrollPosition(touchInfo.targetFrame->view()->scrollOffset()); |
349 touchInfo.targetFrame->view()->scrollPosition(); | |
350 FloatPoint framePoint = pagePoint.scaledBy(scaleFactor); | 349 FloatPoint framePoint = pagePoint.scaledBy(scaleFactor); |
351 framePoint.moveBy(scrollPosition.scaledBy(-scaleFactor)); | 350 framePoint.moveBy(scrollPosition.scaledBy(-scaleFactor)); |
352 PointerEvent* pointerEvent = m_pointerEventFactory.create( | 351 PointerEvent* pointerEvent = m_pointerEventFactory.create( |
353 pointerEventNameForTouchPointState(touchPoint.state()), touchPoint, | 352 pointerEventNameForTouchPointState(touchPoint.state()), touchPoint, |
354 event.getModifiers(), touchPoint.radius().scaledBy(scaleFactor), | 353 event.getModifiers(), touchPoint.radius().scaledBy(scaleFactor), |
355 framePoint, | 354 framePoint, |
356 touchInfo.touchNode ? touchInfo.touchNode->document().domWindow() | 355 touchInfo.touchNode ? touchInfo.touchNode->document().domWindow() |
357 : nullptr); | 356 : nullptr); |
358 | 357 |
359 WebInputEventResult result = | 358 WebInputEventResult result = |
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
693 DEFINE_TRACE(PointerEventManager) { | 692 DEFINE_TRACE(PointerEventManager) { |
694 visitor->trace(m_frame); | 693 visitor->trace(m_frame); |
695 visitor->trace(m_nodeUnderPointer); | 694 visitor->trace(m_nodeUnderPointer); |
696 visitor->trace(m_pointerCaptureTarget); | 695 visitor->trace(m_pointerCaptureTarget); |
697 visitor->trace(m_pendingPointerCaptureTarget); | 696 visitor->trace(m_pendingPointerCaptureTarget); |
698 visitor->trace(m_touchEventManager); | 697 visitor->trace(m_touchEventManager); |
699 visitor->trace(m_mouseEventManager); | 698 visitor->trace(m_mouseEventManager); |
700 } | 699 } |
701 | 700 |
702 } // namespace blink | 701 } // namespace blink |
OLD | NEW |