New issue
Advanced search Search tips

Issue 608394 link

Starred by 2 users

Issue metadata

Status: Fixed
Owner:
Closed: May 2016
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 1
Type: Bug

Blocking:
issue 471824



Sign in to add a comment

ClientX/Y coordinates for touch pointer events are wrong

Project Member Reported by nzolghadr@chromium.org, May 2 2016

Issue description

After some digging, PlatformTouchPoint::m_pos is in root frame coordinates
(i.e. root's "client coordinates"). It comes from in
WebInputEventConversion's PlatformTouchPointBuilder constructor.

We should be changing the name from m_pos to m_positionInRootFrame.

This means touchInfo.adjustedPagePoint is correct and the point there is in page
coordinates, scaled by CSS zoom (i.e. in CSS pixels). However, the m_clientX/Y
members of pointerEventInit expect to be in client coordinates so I think the current
code is wrong. The error is at EventHandler::dispatchPointerEvents, we pass in the
adjustedPagePoint even though sendTouchPointerEvent expects client coordinates.

We have to convert from page to client coordinates. You do this by using the
current FrameView's contentsToFrame to go from the frame's page coordinates to client.
 
As we have noted in  crbug.com/605676 , TouchEvents are perhaps fine. We were hit by the bug in the demo we tested here: canvas drawings used raw coordinates from the events, not a coordinate system with origin at canvas's (left,top).

Labels: Hotlist-CodeHealth
Marking it as a CodeHealth bug, to make the names clearer as Navid mentioned in #0 above.
Labels: -Pri-3 M-52 Pri-1
Summary: ClientX/Y coordinates for touch pointer events are wrong (was: ClientX/Y coordinates for pointer events are wrong)
Project Member

Comment 5 by bugdroid1@chromium.org, May 10 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/52b840ceccfb1041681e0e85a61e9bcdee071b8a

commit 52b840ceccfb1041681e0e85a61e9bcdee071b8a
Author: nzolghadr <nzolghadr@chromium.org>
Date: Tue May 10 21:18:27 2016

Fix clientX/Y properties of touch pointer events

Before this change clientX/Y of touch pointer events
were incorrectly set from content coordinates.
But after this CL they are correctly translated
by scroll position and will become clientX/Y.

BUG= 608394 

Review-Url: https://codereview.chromium.org/1964523002
Cr-Commit-Position: refs/heads/master@{#392722}

[add] https://crrev.com/52b840ceccfb1041681e0e85a61e9bcdee071b8a/third_party/WebKit/LayoutTests/virtual/pointerevent/fast/events/pointerevents/pointer-event-properties-in-iframe-expected.txt
[add] https://crrev.com/52b840ceccfb1041681e0e85a61e9bcdee071b8a/third_party/WebKit/LayoutTests/virtual/pointerevent/fast/events/pointerevents/pointer-event-properties-in-iframe.html
[modify] https://crrev.com/52b840ceccfb1041681e0e85a61e9bcdee071b8a/third_party/WebKit/Source/core/events/PointerEventFactory.cpp
[modify] https://crrev.com/52b840ceccfb1041681e0e85a61e9bcdee071b8a/third_party/WebKit/Source/core/events/PointerEventFactory.h
[modify] https://crrev.com/52b840ceccfb1041681e0e85a61e9bcdee071b8a/third_party/WebKit/Source/core/input/PointerEventManager.cpp
[modify] https://crrev.com/52b840ceccfb1041681e0e85a61e9bcdee071b8a/third_party/WebKit/Source/core/input/TouchEventManager.cpp
[modify] https://crrev.com/52b840ceccfb1041681e0e85a61e9bcdee071b8a/third_party/WebKit/Source/core/input/TouchEventManager.h

Status: Fixed (was: Assigned)

Sign in to add a comment