Bug 157269 - TouchEvent objects shouldn't contain co-ordinates
Summary: TouchEvent objects shouldn't contain co-ordinates
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: UI Events (show other bugs)
Version: Safari 9
Hardware: iPhone / iPad Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-05-02 10:12 PDT by Tim Dresser
Modified: 2016-09-28 12:31 PDT (History)
7 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tim Dresser 2016-05-02 10:12:07 PDT
TouchEvent objects shouldn't contain co-ordinates, co-ordinates should only reside on the associated Touch objects.

See:
https://www.w3.org/TR/uievents/#interface-UIEvent
https://w3c.github.io/touch-events/#idl-def-TouchEvent

To reproduce, visit jsbin.com/jalomi/quiet, and touch the screen.
Nothing should be written to the screen, but the x co-ordinate of the first pointer is written to the screen.

This behavior isn't spec compliant, and may cause compatibility issues. It also encourages sharing code for touch and mouse events, which seems to be something that isn't desired by Apple engineers.

"The premise of the specification is that using mouse event and touch events
interchangeably is needed. In reality, nobody was really asking for that
because it is a terrible idea."
https://lists.webkit.org/pipermail/webkit-dev/2012-November/022957.html
Comment 1 Rick Byers 2016-05-02 10:29:48 PDT
I assume this is because pageX, pageY, layerX, layerY are on UIEvent.idl in WebKit (https://github.com/WebKit/webkit/blob/66e68cd8d7bf4ea1cf52f31ed9cb242f83ea5b57/Source/WebCore/dom/UIEvent.idl).

Chromium has never (AFAIK) reported non-zero values for TouchEvent.pageX/pageY/layerX/layerY, and we removed those properties from TouchEvent completely about a year ago (https://bugs.chromium.org/p/chromium/issues/detail?id=50327).

We're not aware of a single website which is depending on seeing these properties on TouchEvents, so it's likely highly web compatible to move them from UIEvent to MouseEvent as we did in blink.
Comment 2 Rick Byers 2016-09-28 11:28:28 PDT
See https://bugs.webkit.org/show_bug.cgi?id=147740#c11 for discussion of the interaction between these non-standard properties and the standard constructor syntax.