Add machinery to synthesize PanGestureInput events on macOS
Categories
(Core :: Panning and Zooming, task)
Tracking
()
Tracking | Status | |
---|---|---|
firefox84 | --- | fixed |
People
(Reporter: kats, Assigned: kats)
References
Details
Attachments
(2 files, 1 obsolete file)
APZ tests that currently synthesize "native wheel" events go through this codepath on macOS. That generates a system scroll event which fails the hasPhaseInformation
check and therefore results in creation of a ScrollWheelInput
rather than a PanGestureInput
. The ScrollWheelInput
codepath is somewhat different to the PanGestureInput
codepath (see the bodies of the case statements, as well as the different handling inside APZ code).
In real-world usage on mac laptops, the PanGestureInput
codepath is the one that gets used, and in our testing, the ScrollWheelInput
codepath is the one that gets used. It would be better if we could write tests for either codepath, or if not, default to having them go through the more-common PanGestureInput
codepath.
I tried doing this today but was not successful. The minimal change that's needed is something like in the attached patch, but that fails tests. The problem with the attached patch is that all the PanGestureInput
s generated have their type as PANGESTURE_PAN
. The input queue will transmogrify the first of these into a PANGESTURE_START
and send subsequent ones to the same APZC instance. So when running multiple tests in a row, the subsequent events get directed to APZCs that are already destroyed and so they get lost.
The solution to that problem may be to synthesize events with PANGESTURE_START
(using a "1" instead of a "2" as the aNativeMessage
) but when I tried that it seemed to unexpectedly trigger the page navigation swipe gesture. For some reason the generated events have a large delta in the x-direction even though we're definitely not requesting any such x-delta.
Assignee | ||
Comment 1•4 years ago
|
||
Actually since the x-delta thing happens even with the current ScrollWheelInput
codepath maybe that's a separate problem to be tackled separately. Instead, I can suppress the swipe gesture navigation thing using prefs.
Assignee | ||
Comment 2•4 years ago
|
||
On second thought the x-delta problem seems like something that could cause other failures too, even if I suppress the swipe gesture navigation thing. So I'll try to dig into that more.
Assignee | ||
Comment 3•4 years ago
|
||
So apparently the problem is the delta values passed in here are double
s. And the function is expecting int32_t
. But it's doing some objective-C stupidity and not doing a proper conversion, thereby putting mostly garbage into the generated scroll event. Explicitly casting those arguments makes things sane. Sigh.
Hopefully fixing this won't break existing tests... https://treeherder.mozilla.org/#/jobs?repo=try&group_state=expanded&revision=6c62d18ffb450a20ec71e753df572f1895b61268
Assignee | ||
Comment 4•4 years ago
|
||
Assignee | ||
Updated•4 years ago
|
Assignee | ||
Comment 5•4 years ago
|
||
Apparently objective-C doesn't do a great job when you give a vararg function
that takes int32_t arguments double values. I guess tests that use macOS
synthesized wheel inputs were basically only working by accident.
Assignee | ||
Comment 6•4 years ago
|
||
This causes the generated scroll events to be turned into PanGestureInput events
instead of ScrollWheelInput events. This exercises different codepaths that are
more representative of real-world behaviour on mac laptops. This patch also
allows a pref to flip the behaviour back to the old behaviour of triggering
ScrollWheelInputs, since in some cases we may want to test that behaviour
explicitly.
Depends on D95320
Pushed by kgupta@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/af6e2a613f7a Don't put garbage in the synthesized scrollwheel event. r=tnikkel https://hg.mozilla.org/integration/autoland/rev/5418b2ee8b24 Default to adding phase information to the synthesized scroll events on macOS. r=tnikkel
Comment 8•4 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/af6e2a613f7a
https://hg.mozilla.org/mozilla-central/rev/5418b2ee8b24
Description
•