Allow synthesizing native mouse wheel events on OS X

RESOLVED FIXED in Firefox 40

Status

()

Core
Widget: Cocoa
RESOLVED FIXED
3 years ago
3 years ago

People

(Reporter: kats, Assigned: kats)

Tracking

unspecified
mozilla40
All
Gonk (Firefox OS)
Points:
---

Firefox Tracking Flags

(firefox40 fixed)

Details

Attachments

(2 attachments, 2 obsolete attachments)

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.
Created attachment 8601076 [details] [diff] [review]
Patch

This implements the function
Attachment #8601076 - Flags: review?(mstange)
Created attachment 8601077 [details] [diff] [review]
Test that exercises it

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+
Created attachment 8601488 [details] [diff] [review]
Test v2

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
Created attachment 8601543 [details] [diff] [review]
Test v3

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)
Blocks: 1161634
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
Last Resolved: 3 years ago
status-firefox40: --- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla40
You need to log in before you can comment on or make changes to this bug.