Closed Bug 1161206 Opened 5 years ago Closed 5 years ago

Allow synthesizing native mouse wheel events on OS X

Categories

(Core :: Widget: Cocoa, defect)

All
Gonk (Firefox OS)
defect
Not set

Tracking

()

RESOLVED FIXED
mozilla40
Tracking Status
firefox40 --- fixed

People

(Reporter: kats, Assigned: kats)

References

Details

Attachments

(2 files, 2 obsolete files)

In order to properly exercise the APZ code we need to be able to synthesize and dispatch native events on desktop platforms. The stubs for these already exist (see nsIDOMWindowUtils::sendNative*) but they are not implemented across all platforms. This bug is specifically about implementing SynthesizeNativeMouseScrollEvent on OS X.
Attached patch PatchSplinter Review
This implements the function
Attachment #8601076 - Flags: review?(mstange)
Attached patch Test that exercises it (obsolete) — Splinter Review
This is a test that exercises the native synthesization function in the other patch. It's a modified version of the test I added in bug 1013432, that uses native event synthesization. This test passes for me locally under the following configurations on OS X:

./mach mochitest-plain gfx/layers/apz/test/test_wheel_scroll.html
./mach mochitest-plain --e10s gfx/layers/apz/test/test_wheel_scroll.html
./mach mochitest-plain --e10s --setpref=layers.async-pan-zoom.enabled=true gfx/layers/apz/test/test_wheel_scroll.html

I want to test it on windows too before flagging for review.
Comment on attachment 8601076 [details] [diff] [review]
Patch

Review of attachment 8601076 [details] [diff] [review]:
-----------------------------------------------------------------

::: widget/cocoa/nsChildView.mm
@@ +1211,5 @@
> +    (aAdditionalFlags & nsIDOMWindowUtils::MOUSESCROLL_SCROLL_LINES)
> +    ? kCGScrollEventUnitLine : kCGScrollEventUnitPixel;
> +  CGEventRef cgEvent = CGEventCreateScrollWheelEvent(NULL, units, 3, aDeltaY, aDeltaX, aDeltaZ);
> +  if (!cgEvent)
> +    return NS_ERROR_FAILURE;

{}
Attachment #8601076 - Flags: review?(mstange) → review+
Attached patch Test v2 (obsolete) — Splinter Review
Updated test to be more robust. It passes locally for me on OS X and windows, using all the configurations I listed in comment 2

Try push at https://treeherder.mozilla.org/#/jobs?repo=try&revision=11fd6584a02e - will wait for that to go green before requesting review. (Also I'll need to disable the test on non-(mac+windows) platforms).
Attachment #8601077 - Attachment is obsolete: true
Attached patch Test v3Splinter Review
Try push has this test passing on mac and windows as expected, and failing on linux as expected. Updated mochitest.ini to only run on cocoa/windows toolkits.
Attachment #8601488 - Attachment is obsolete: true
Attachment #8601543 - Flags: review?(mstange)
Attachment #8601543 - Flags: review?(mstange) → review+
https://hg.mozilla.org/mozilla-central/rev/b0d3859a249b
https://hg.mozilla.org/mozilla-central/rev/510299530155
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla40
You need to log in before you can comment on or make changes to this bug.