Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5)

Side by Side Diff: third_party/WebKit/Source/core/input/PointerEventManager.cpp

Issue 1964523002: Fix clientX/Y properties of touch pointer events (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix zoom problem Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698