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 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
364 touchInfo.targetFrame = touchInfo.touchNode->document().frame(); | 364 touchInfo.targetFrame = touchInfo.touchNode->document().frame(); |
365 } | 365 } |
366 | 366 |
367 // Do not send pointer events for stationary touches or null targetFrame | 367 // Do not send pointer events for stationary touches or null targetFrame |
368 if (touchInfo.touchNode && touchInfo.targetFrame && | 368 if (touchInfo.touchNode && touchInfo.targetFrame && |
369 touchPoint.state() != PlatformTouchPoint::TouchStationary && | 369 touchPoint.state() != PlatformTouchPoint::TouchStationary && |
370 !m_inCanceledStateForPointerTypeTouch) { | 370 !m_inCanceledStateForPointerTypeTouch) { |
371 FloatPoint pagePoint = touchInfo.targetFrame->view()->rootFrameToContents( | 371 FloatPoint pagePoint = touchInfo.targetFrame->view()->rootFrameToContents( |
372 touchInfo.point.pos()); | 372 touchInfo.point.pos()); |
373 float scaleFactor = 1.0f / touchInfo.targetFrame->pageZoomFactor(); | 373 float scaleFactor = 1.0f / touchInfo.targetFrame->pageZoomFactor(); |
374 FloatPoint scrollPosition = | 374 FloatPoint scrollPosition(touchInfo.targetFrame->view()->scrollOffset()); |
375 touchInfo.targetFrame->view()->scrollPosition(); | |
376 FloatPoint framePoint = pagePoint.scaledBy(scaleFactor); | 375 FloatPoint framePoint = pagePoint.scaledBy(scaleFactor); |
377 framePoint.moveBy(scrollPosition.scaledBy(-scaleFactor)); | 376 framePoint.moveBy(scrollPosition.scaledBy(-scaleFactor)); |
378 PointerEvent* pointerEvent = m_pointerEventFactory.create( | 377 PointerEvent* pointerEvent = m_pointerEventFactory.create( |
379 pointerEventNameForTouchPointState(touchPoint.state()), touchPoint, | 378 pointerEventNameForTouchPointState(touchPoint.state()), touchPoint, |
380 event.getModifiers(), touchPoint.radius().scaledBy(scaleFactor), | 379 event.getModifiers(), touchPoint.radius().scaledBy(scaleFactor), |
381 framePoint, | 380 framePoint, |
382 touchInfo.touchNode ? touchInfo.touchNode->document().domWindow() | 381 touchInfo.touchNode ? touchInfo.touchNode->document().domWindow() |
383 : nullptr); | 382 : nullptr); |
384 | 383 |
385 WebInputEventResult result = | 384 WebInputEventResult result = |
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
674 return true; | 673 return true; |
675 } | 674 } |
676 return false; | 675 return false; |
677 } | 676 } |
678 | 677 |
679 EventTarget* PointerEventManager::getMouseCapturingNode() { | 678 EventTarget* PointerEventManager::getMouseCapturingNode() { |
680 return getCapturingNode(PointerEventFactory::s_mouseId); | 679 return getCapturingNode(PointerEventFactory::s_mouseId); |
681 } | 680 } |
682 | 681 |
683 } // namespace blink | 682 } // namespace blink |
OLD | NEW |