Bug 669979. Don't do zoom or history actions for momentum scrolls, no matter what's going on with pixel scrolling. r=smaug,masayuki

This commit is contained in:
Boris Zbarsky 2011-08-01 13:43:23 -04:00
parent c358d9fe7e
commit fb85e72ddc
2 changed files with 13 additions and 8 deletions

View File

@ -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;

View File

@ -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;