Commit 1cbc5fe4 authored by Stephen A Pohl's avatar Stephen A Pohl
Browse files

Bug 1684739: Only check if swipe tracking is enabled on macOS if the event is...

Bug 1684739: Only check if swipe tracking is enabled on macOS if the event is a scrollwheel event. r=mstange

Differential Revision: https://phabricator.services.mozilla.com/D142328
parent 9fe39b5f
Loading
Loading
Loading
Loading
+6 −10
Original line number Diff line number Diff line
@@ -2741,21 +2741,17 @@ NSEvent* gLastDragMouseDownEvent = nil; // [strong]
}

- (bool)shouldConsiderStartingSwipeFromEvent:(NSEvent*)anEvent {
  // This method checks whether the AppleEnableSwipeNavigateWithScrolls global
  // preference is set.  If it isn't, fluid swipe tracking is disabled, and a
  // horizontal two-finger gesture is always a scroll (even in Safari).  This
  // preference can't (currently) be set from the Preferences UI -- only using
  // 'defaults write'.
  if (![NSEvent isSwipeTrackingFromScrollEventsEnabled]) {
    return false;
  }

  // Only initiate horizontal tracking for gestures that have just begun --
  // otherwise a scroll to one side of the page can have a swipe tacked on
  // to it.
  // [NSEvent isSwipeTrackingFromScrollEventsEnabled] checks whether the
  // AppleEnableSwipeNavigateWithScrolls global preference is set.  If it isn't,
  // fluid swipe tracking is disabled, and a horizontal two-finger gesture is
  // always a scroll (even in Safari).  This preference can't (currently) be set
  // from the Preferences UI -- only using 'defaults write'.
  NSEventPhase eventPhase = [anEvent phase];
  return [anEvent type] == NSEventTypeScrollWheel && eventPhase == NSEventPhaseBegan &&
         [anEvent hasPreciseScrollingDeltas];
         [anEvent hasPreciseScrollingDeltas] && [NSEvent isSwipeTrackingFromScrollEventsEnabled];
}

- (void)setUsingOMTCompositor:(BOOL)aUseOMTC {