From fb85e72ddca40c80fe5ac46ac6f88e51f39c61ea Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Mon, 1 Aug 2011 13:43:23 -0400 Subject: [PATCH] Bug 669979. Don't do zoom or history actions for momentum scrolls, no matter what's going on with pixel scrolling. r=smaug,masayuki --- content/events/src/nsEventStateManager.cpp | 17 +++++++++-------- content/events/test/test_bug574663.html | 4 ++++ 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/content/events/src/nsEventStateManager.cpp b/content/events/src/nsEventStateManager.cpp index e1847dc17d6..22dca16de84 100644 --- a/content/events/src/nsEventStateManager.cpp +++ b/content/events/src/nsEventStateManager.cpp @@ -2671,14 +2671,15 @@ nsEventStateManager::ComputeWheelActionFor(nsMouseScrollEvent* aMouseEvent, // Do not scroll pixels when zooming action = -1; } - } else if (aMouseEvent->scrollFlags & nsMouseScrollEvent::kHasPixels) { - if (aUseSystemSettings || - action == MOUSE_SCROLL_N_LINES || action == MOUSE_SCROLL_PAGE || - (aMouseEvent->scrollFlags & nsMouseScrollEvent::kIsMomentum)) { - // Don't scroll lines when a pixel scroll event will follow. - // Also, don't do history scrolling or zooming for momentum scrolls. - action = -1; - } + } else if (((aMouseEvent->scrollFlags & nsMouseScrollEvent::kHasPixels) && + (aUseSystemSettings || + action == MOUSE_SCROLL_N_LINES || action == MOUSE_SCROLL_PAGE)) || + ((aMouseEvent->scrollFlags & nsMouseScrollEvent::kIsMomentum) && + (action == MOUSE_SCROLL_HISTORY || action == MOUSE_SCROLL_ZOOM))) { + // Don't scroll lines or page when a pixel scroll event will follow. + // Also, don't do history scrolling or zooming for momentum scrolls, + // no matter what's going on with pixel scrolling. + action = -1; } return action; diff --git a/content/events/test/test_bug574663.html b/content/events/test/test_bug574663.html index 9a36bb4df7b..bac5ef90b39 100644 --- a/content/events/test/test_bug574663.html +++ b/content/events/test/test_bug574663.html @@ -35,7 +35,11 @@ function sendTouchpadScrollMotion(scrollbox, direction, ctrl, momentum) { }; // first a line scroll synthesizeMouseScroll(scrollbox, 10, 10, event, win); + // Then a line scroll with hasPixels set to false + event.hasPixels = false; + synthesizeMouseScroll(scrollbox, 10, 10, event, win); // then 5 pixel scrolls + event.hasPixels = true; event.delta *= 3; event.type = "MozMousePixelScroll"; event.hasPixels = false;