Open Bug 1364969 Opened 4 years ago Updated 4 years ago
X and radius Y affected by retina display in synthesized touch events
While working on https://trac.torproject.org/projects/tor/ticket/10286 and running the tests created for that Tor bug on macOS, we discovered that that radiusX and radiusY values are doubled on a MacBook Pro that has a Retina display. Here is the output from the failed tests (the result of running the attached test file): 6 INFO TEST-UNEXPECTED-FAIL | dom/events/test/test_touchevent.html | touch.radiusX - got 4, expected 2 SimpleTest.is@SimpleTest/SimpleTest.js:271:5 runTest@dom/events/test/test_touchevent.html:56:10 7 INFO TEST-UNEXPECTED-FAIL | dom/events/test/test_touchevent.html | touch.radiusY - got 6, expected 3 SimpleTest.is@SimpleTest/SimpleTest.js:271:5 runTest@dom/events/test/test_touchevent.html:57:10 This was observed with an ESR52-based branch.
:kats might be able to answer what's up here.
Component: Event Handling → DOM: Events
This does appear to be a bug. The `synthesizeTouch` function used to generate the touch event seems to take the radius input as CSS pixels, so the radiusX/radiusY value exposed should be the same. However, looking at the code at  the RadiusX() function returns mRadius.x, where mRadius is in LayoutDevice pixels, which will include the retina scaling factor. The entire Touch class could probably do with some better use of strongly-typed units.  http://searchfox.org/mozilla-central/rev/ae24a3c83d22e0e35aecfd9049c2b463ca7e045b/dom/events/Touch.h#77
(To be clear, the bug here is that the RadiusX()/RadiusY() functions in Touch.cpp are directly returning a value in LayoutDevice space when they should probably be exposing CSS space values. Other callers of those functions might need to be modified as well.)
You need to log in before you can comment on or make changes to this bug.