Open Bug 1364969 Opened 4 years ago Updated 4 years ago

radiusX and radiusY affected by retina display in synthesized touch events

Categories

(Core :: DOM: Events, defect, P3)

52 Branch
x86_64
macOS
defect

Tracking

()

People

(Reporter: mcs, Unassigned)

Details

Attachments

(1 file)

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
Flags: needinfo?(bugmail)
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 [1] 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.

[1] http://searchfox.org/mozilla-central/rev/ae24a3c83d22e0e35aecfd9049c2b463ca7e045b/dom/events/Touch.h#77
Flags: needinfo?(bugmail)
(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.)
Priority: -- → P3
You need to log in before you can comment on or make changes to this bug.