Bug 1692708 - Specify MOUSESCROLL_SCROLL_LINES in synthesizeNativeWheel if apz.test.mac.synth_wheel_input is true. r?tnikkel draft
authorHiroyuki Ikezoe <hikezoe.birchill@mozilla.com>
Wed, 27 Oct 2021 12:22:10 +0900
changeset 4067840 7f14ba844126dcc8fe9be6521836ade084d61085
parent 4067839 18f75851d87c53257add8989171297829d1a6394
child 4067841 0d7ccc6892d78ecd23a60681ce5ca1037556362a
push id749117
push userhikezoe.birchill@mozilla.com
push dateTue, 09 Nov 2021 03:49:09 +0000
treeherdertry@c977c47e553c [default view] [failures only]
reviewerstnikkel
bugs1692708
milestone96.0a1
Bug 1692708 - Specify MOUSESCROLL_SCROLL_LINES in synthesizeNativeWheel if apz.test.mac.synth_wheel_input is true. r?tnikkel Without specifying the value, even if synthesizeNativeWheel causes wheel inputs, it will be converted to an instant scroll rather than smooth. In fact on Mac mouse wheeling causes this type of events that is that the events' hasPreciseScrollingDeltas flag is false. Differential Revision: https://phabricator.services.mozilla.com/D129591
gfx/layers/apz/test/mochitest/apz_test_native_event_utils.js
--- a/gfx/layers/apz/test/mochitest/apz_test_native_event_utils.js
+++ b/gfx/layers/apz/test/mochitest/apz_test_native_event_utils.js
@@ -390,17 +390,21 @@ async function synthesizeNativeWheel(
   utils.sendNativeMouseScrollEvent(
     pt.x,
     pt.y,
     msg,
     aDeltaX,
     aDeltaY,
     0,
     0,
-    0,
+    // Specify MOUSESCROLL_SCROLL_LINES if the test wants to run through wheel
+    // input code path on Mac since it's normal mouse wheel inputs.
+    SpecialPowers.getBoolPref("apz.test.mac.synth_wheel_input", false)
+      ? SpecialPowers.DOMWindowUtils.MOUSESCROLL_SCROLL_LINES
+      : 0,
     element,
     aObserver
   );
   return true;
 }
 
 // Synthesizes a native pan gesture event and returns immediately.
 // NOTE: This works only on Mac.