diff --git a/content/events/src/nsEventStateManager.cpp b/content/events/src/nsEventStateManager.cpp index adcd9902ec6..d7595998a56 100644 --- a/content/events/src/nsEventStateManager.cpp +++ b/content/events/src/nsEventStateManager.cpp @@ -2684,12 +2684,11 @@ nsEventStateManager::DoScrollText(nsPresContext* aPresContext, } if (aScrollQuantity == eScrollByPage) - scrollView->ScrollByPages(scrollX, scrollY, NS_VMREFRESH_DEFERRED); + scrollView->ScrollByPages(scrollX, scrollY, NS_VMREFRESH_SMOOTHSCROLL); else if (aScrollQuantity == eScrollByPixel) scrollView->ScrollByPixels(scrollX, scrollY, NS_VMREFRESH_DEFERRED); else - scrollView->ScrollByLines(scrollX, scrollY, - NS_VMREFRESH_SMOOTHSCROLL | NS_VMREFRESH_DEFERRED); + scrollView->ScrollByLines(scrollX, scrollY, NS_VMREFRESH_SMOOTHSCROLL); } if (passToParent) { nsresult rv; @@ -3158,7 +3157,8 @@ nsEventStateManager::PostHandleEvent(nsPresContext* aPresContext, nsIScrollableView* sv = nsLayoutUtils::GetNearestScrollingView(aView, nsLayoutUtils::eVertical); if (sv) { nsKeyEvent * keyEvent = (nsKeyEvent *)aEvent; - sv->ScrollByPages(0, (keyEvent->keyCode != NS_VK_PAGE_UP) ? 1 : -1); + sv->ScrollByPages(0, (keyEvent->keyCode != NS_VK_PAGE_UP) ? 1 : -1, + NS_VMREFRESH_SMOOTHSCROLL); } } break; @@ -3178,7 +3178,8 @@ nsEventStateManager::PostHandleEvent(nsPresContext* aPresContext, nsIScrollableView* sv = nsLayoutUtils::GetNearestScrollingView(aView, nsLayoutUtils::eVertical); if (sv) { nsKeyEvent * keyEvent = (nsKeyEvent *)aEvent; - sv->ScrollByLines(0, (keyEvent->keyCode == NS_VK_DOWN) ? 1 : -1); + sv->ScrollByLines(0, (keyEvent->keyCode == NS_VK_DOWN) ? 1 : -1, + NS_VMREFRESH_SMOOTHSCROLL); // force the update to happen now, otherwise multiple scrolls can // occur before the update is processed. (bug #7354) @@ -3197,7 +3198,8 @@ nsEventStateManager::PostHandleEvent(nsPresContext* aPresContext, nsIScrollableView* sv = nsLayoutUtils::GetNearestScrollingView(aView, nsLayoutUtils::eHorizontal); if (sv) { nsKeyEvent * keyEvent = (nsKeyEvent *)aEvent; - sv->ScrollByLines((keyEvent->keyCode == NS_VK_RIGHT) ? 1 : -1, 0); + sv->ScrollByLines((keyEvent->keyCode == NS_VK_RIGHT) ? 1 : -1, 0, + NS_VMREFRESH_SMOOTHSCROLL); // force the update to happen now, otherwise multiple scrolls can // occur before the update is processed. (bug #7354) @@ -3218,7 +3220,7 @@ nsEventStateManager::PostHandleEvent(nsPresContext* aPresContext, if (!mCurrentFocus) { nsIScrollableView* sv = nsLayoutUtils::GetNearestScrollingView(aView, nsLayoutUtils::eVertical); if (sv) { - sv->ScrollByPages(0, 1); + sv->ScrollByPages(0, 1, NS_VMREFRESH_SMOOTHSCROLL); } } } diff --git a/docshell/test/navigation/test_bug430723.html b/docshell/test/navigation/test_bug430723.html index 9d8c2929477..deb38cb5489 100644 --- a/docshell/test/navigation/test_bug430723.html +++ b/docshell/test/navigation/test_bug430723.html @@ -65,11 +65,13 @@ var step1 =function() { "Page1: Ensure we scrollpane is at the top before we start scrolling."); sendKey('DOWN', testWindow); sendKey('UP', testWindow); - is(testWindow.document.body.scrollTop, 0, - "Page1: Ensure we can scroll down and up, back to the top."); - - // Nav to blue box page. This should fire step2. - testWindow.location = gTallBlueBoxURI; + setTimeout(function() { + is(testWindow.document.body.scrollTop, 0, + "Page1: Ensure we can scroll down and up, back to the top."); + + // Nav to blue box page. This should fire step2. + testWindow.location = gTallBlueBoxURI; + }, 0); } @@ -82,11 +84,13 @@ var step2 =function() { sendKey('DOWN', testWindow); sendKey('DOWN', testWindow); sendKey('DOWN', testWindow); - isnot(testWindow.document.body.scrollTop, 0, - "Page2: Ensure we could scrol."); - - // Navigate backwards. This should fire step3. - testWindow.history.back(); + setTimeout(function() { + isnot(testWindow.document.body.scrollTop, 0, + "Page2: Ensure we could scrol."); + + // Navigate backwards. This should fire step3. + testWindow.history.back(); + }, 0); } var step3 =function() { @@ -97,11 +101,13 @@ var step3 =function() { is(testWindow.document.body.scrollTop, 0, "Page1Again: Ensure scroll pane at top before we scroll."); sendKey('DOWN', testWindow); - isnot(testWindow.document.body.scrollTop, 0, - "Page2Again: Ensure we can still scroll."); - - testWindow.close(); - window.SimpleTest.finish(); + setTimeout(function() { + isnot(testWindow.document.body.scrollTop, 0, + "Page2Again: Ensure we can still scroll."); + + testWindow.close(); + window.SimpleTest.finish(); + }, 0); } SimpleTest.waitForExplicitFinish(); diff --git a/editor/libeditor/base/tests/test_selection_move_commands.xul b/editor/libeditor/base/tests/test_selection_move_commands.xul index 514144c6322..fae1c310c0a 100644 --- a/editor/libeditor/base/tests/test_selection_move_commands.xul +++ b/editor/libeditor/base/tests/test_selection_move_commands.xul @@ -11,6 +11,17 @@ 0, "cmd_scrollPageDown works"); ok(pageHeight <= 100, "cmd_scrollPageDown doesn't scroll too much"); doCommand("cmd_scrollBottom"); + doCommand("cmd_scrollPageUp"); + yield; testScrollCommand("cmd_scrollPageUp", root.scrollHeight - 100 - pageHeight); doCommand("cmd_scrollTop"); doCommand("cmd_scrollLineDown"); + yield; var lineHeight = -root.getBoundingClientRect().top; ok(lineHeight > 0, "Can scroll by lines"); doCommand("cmd_scrollBottom"); + doCommand("cmd_scrollLineUp"); + yield; testScrollCommand("cmd_scrollLineUp", root.scrollHeight - 100 - lineHeight); var runSelectionTests = function(selectWordNextNode, selectWordNextOffset) { diff --git a/layout/base/nsPresShell.cpp b/layout/base/nsPresShell.cpp index ed58e9eeac7..fe5759d4f6c 100644 --- a/layout/base/nsPresShell.cpp +++ b/layout/base/nsPresShell.cpp @@ -2835,7 +2835,7 @@ PresShell::ScrollPage(PRBool aForward) { nsIScrollableView* scrollView = GetViewToScroll(nsLayoutUtils::eVertical); if (scrollView) { - scrollView->ScrollByPages(0, aForward ? 1 : -1); + scrollView->ScrollByPages(0, aForward ? 1 : -1, NS_VMREFRESH_SMOOTHSCROLL); } return NS_OK; } @@ -2848,9 +2848,9 @@ PresShell::ScrollLine(PRBool aForward) #ifdef MOZ_WIDGET_COCOA // Emulate the Mac IE behavior of scrolling a minimum of 2 lines // rather than 1. This vastly improves scrolling speed. - scrollView->ScrollByLines(0, aForward ? 2 : -2); + scrollView->ScrollByLines(0, aForward ? 2 : -2, NS_VMREFRESH_SMOOTHSCROLL); #else - scrollView->ScrollByLines(0, aForward ? 1 : -1); + scrollView->ScrollByLines(0, aForward ? 1 : -1, NS_VMREFRESH_SMOOTHSCROLL); #endif //NEW FOR LINES @@ -2872,7 +2872,7 @@ PresShell::ScrollHorizontal(PRBool aLeft) { nsIScrollableView* scrollView = GetViewToScroll(nsLayoutUtils::eHorizontal); if (scrollView) { - scrollView->ScrollByLines(aLeft ? -1 : 1, 0); + scrollView->ScrollByLines(aLeft ? -1 : 1, 0, NS_VMREFRESH_SMOOTHSCROLL); //NEW FOR LINES // force the update to happen now, otherwise multiple scrolls can // occur before the update is processed. (bug #7354) diff --git a/layout/generic/nsGfxScrollFrame.cpp b/layout/generic/nsGfxScrollFrame.cpp index 6748180f3b9..22e3c07bf6c 100644 --- a/layout/generic/nsGfxScrollFrame.cpp +++ b/layout/generic/nsGfxScrollFrame.cpp @@ -1910,7 +1910,8 @@ void nsGfxScrollFrameInner::CurPosAttributeChanged(nsIContent* aContent) InternalScrollPositionDidChange(curPosX, curPosY); mFrameInitiatedScroll = PR_FALSE; } - ScrollbarChanged(mOuter->PresContext(), x, y, isSmooth ? NS_VMREFRESH_SMOOTHSCROLL : 0); + ScrollbarChanged(mOuter->PresContext(), x, y, + isSmooth ? NS_VMREFRESH_SMOOTHSCROLL : NS_VMREFRESH_DEFERRED); } } diff --git a/view/src/nsScrollPortView.cpp b/view/src/nsScrollPortView.cpp index 8872f007905..8f6fb574d0c 100644 --- a/view/src/nsScrollPortView.cpp +++ b/view/src/nsScrollPortView.cpp @@ -255,7 +255,7 @@ NS_IMETHODIMP nsScrollPortView::ScrollTo(nscoord aDestinationX, nscoord aDestina mDestinationY = aDestinationY; ClampScrollValues(mDestinationX, mDestinationY, this); - if (!(aUpdateFlags & NS_VMREFRESH_DEFERRED)) { + if (!(aUpdateFlags & (NS_VMREFRESH_DEFERRED | NS_VMREFRESH_SMOOTHSCROLL))) { // Asynchronous scrolling is not allowed, so we'll kill any existing // async-scrolling process and do an instant scroll delete mAsyncScroll;