Bug 926274: Allow swipe gestures to navigate history even when scrollbars are visible on OSX. r=masayuki
authorStephen Pohl <spohl.mozilla.bugs@gmail.com>
Wed, 16 Oct 2013 09:07:42 -0400
changeset 164755 77a75238baa7f36a7138406e97852055b679734f
parent 164754 b936f0735ad8834880842b65661d047b5dcd6e83
child 164756 98fe3c07b042053f02dd65e9723ca8d3abe69f46
push id3066
push userakeybl@mozilla.com
push dateMon, 09 Dec 2013 19:58:46 +0000
treeherdermozilla-beta@a31a0dce83aa [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmasayuki
bugs926274
milestone27.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 926274: Allow swipe gestures to navigate history even when scrollbars are visible on OSX. r=masayuki
content/events/src/nsEventStateManager.cpp
widget/cocoa/nsChildView.mm
--- a/content/events/src/nsEventStateManager.cpp
+++ b/content/events/src/nsEventStateManager.cpp
@@ -3421,17 +3421,23 @@ nsEventStateManager::PostHandleEvent(nsP
           }
 
           nsIScrollableFrame* scrollTarget =
             ComputeScrollTarget(aTargetFrame, wheelEvent,
                                 COMPUTE_DEFAULT_ACTION_TARGET);
 
           nsScrollbarsForWheel::SetActiveScrollTarget(scrollTarget);
 
-          if (!scrollTarget) {
+          nsIFrame* rootScrollFrame = !aTargetFrame ? nullptr :
+            aTargetFrame->PresContext()->PresShell()->GetRootScrollFrame();
+          nsIScrollableFrame* rootScrollableFrame = nullptr;
+          if (rootScrollFrame) {
+            rootScrollableFrame = do_QueryFrame(rootScrollFrame);
+          }
+          if (!scrollTarget || scrollTarget == rootScrollableFrame) {
             wheelEvent->mViewPortIsOverscrolled = true;
           }
           wheelEvent->overflowDeltaX = wheelEvent->deltaX;
           wheelEvent->overflowDeltaY = wheelEvent->deltaY;
           WheelPrefs::GetInstance()->
             CancelApplyingUserPrefsFromOverflowDelta(wheelEvent);
           if (scrollTarget) {
             DoScrollText(scrollTarget, wheelEvent);
--- a/widget/cocoa/nsChildView.mm
+++ b/widget/cocoa/nsChildView.mm
@@ -4201,37 +4201,37 @@ NSEvent* gLastDragMouseDownEvent = nil;
     }
   } else {
     return;
   }
 
   // Track the direction we're going in.
   mCurrentSwipeDir = direction;
 
-  // If a swipe is currently being tracked kill it -- it's been interrupted
-  // by another gesture event.
-  if (mCancelSwipeAnimation && *mCancelSwipeAnimation == NO) {
-    *mCancelSwipeAnimation = YES;
-    mCancelSwipeAnimation = nil;
-  }
-
   uint32_t allowedDirections = 0;
   // We're ready to start the animation. Tell Gecko about it, and at the same
   // time ask it if it really wants to start an animation for this event.
   // This event also reports back the directions that we can swipe in.
   bool shouldStartSwipe = [self sendSwipeEvent:anEvent
                                       withKind:NS_SIMPLE_GESTURE_SWIPE_START
                              allowedDirections:&allowedDirections
                                      direction:direction
                                          delta:0.0];
 
   if (!shouldStartSwipe) {
     return;
   }
 
+  // If a swipe is currently being tracked kill it -- it's been interrupted
+  // by another gesture event.
+  if (mCancelSwipeAnimation && *mCancelSwipeAnimation == NO) {
+    *mCancelSwipeAnimation = YES;
+    mCancelSwipeAnimation = nil;
+  }
+
   CGFloat min = 0.0;
   CGFloat max = 0.0;
   if (!(direction & vDirs)) {
     min = (allowedDirections & nsIDOMSimpleGestureEvent::DIRECTION_RIGHT) ?
           -1.0 : 0.0;
     max = (allowedDirections & nsIDOMSimpleGestureEvent::DIRECTION_LEFT) ?
           1.0 : 0.0;
   }