Bug 279629. Allow scrolling to anchors to use smooth scrolling. r=mats

This commit is contained in:
Robert O'Callahan 2011-04-08 12:06:36 -07:00
parent a30a7a6c07
commit 05fec77aa1
2 changed files with 12 additions and 7 deletions

View File

@ -139,8 +139,8 @@ typedef struct CapturingContentInfo {
} CapturingContentInfo;
#define NS_IPRESSHELL_IID \
{ 0x3a8030b5, 0x8d2c, 0x4cb3, \
{ 0xb5, 0xae, 0xb2, 0x43, 0xa9, 0x28, 0x02, 0x82 } }
{ 0xfd4ba6e3, 0x921c, 0x4058, \
{ 0xa6, 0x1b, 0xc7, 0x14, 0x5e, 0x80, 0x50, 0x1f } }
// Constants for ScrollContentIntoView() function
#define NS_PRESSHELL_SCROLL_TOP 0
@ -573,7 +573,8 @@ public:
enum {
SCROLL_FIRST_ANCESTOR_ONLY = 0x01,
SCROLL_OVERFLOW_HIDDEN = 0x02,
SCROLL_NO_PARENT_FRAMES = 0x04
SCROLL_NO_PARENT_FRAMES = 0x04,
SCROLL_ALLOW_SMOOTH = 0x08
};
/**
* Scrolls the view of the document so that the given area of a frame

View File

@ -224,7 +224,8 @@
#define NS_TIME_FUNCTION_WITH_DOCURL do{} while(0)
#endif
#define ANCHOR_SCROLL_FLAGS (SCROLL_OVERFLOW_HIDDEN | SCROLL_NO_PARENT_FRAMES)
static const PRUint32 ANCHOR_SCROLL_FLAGS =
SCROLL_OVERFLOW_HIDDEN | SCROLL_NO_PARENT_FRAMES | SCROLL_ALLOW_SMOOTH;
#include "nsContentCID.h"
static NS_DEFINE_IID(kRangeCID, NS_RANGE_CID);
@ -1194,8 +1195,9 @@ protected:
// Information needed to properly handle scrolling content into view if the
// pre-scroll reflow flush can be interrupted. mContentToScrollTo is
// non-null between the initial scroll attempt and the first time we finish
// processing all our dirty roots. mContentScrollVPosition and
// mContentScrollHPosition are only used when it's non-null.
// processing all our dirty roots. mContentScrollVPosition,
// mContentScrollHPosition and mContentToScrollToFlags are only used when
// it's non-null.
nsCOMPtr<nsIContent> mContentToScrollTo;
PRIntn mContentScrollVPosition;
PRIntn mContentScrollHPosition;
@ -4149,7 +4151,9 @@ static void ScrollToShowRect(nsIScrollableFrame* aScrollFrame,
}
}
aScrollFrame->ScrollTo(scrollPt, nsIScrollableFrame::INSTANT);
aScrollFrame->ScrollTo(scrollPt,
(aFlags & nsIPresShell::SCROLL_ALLOW_SMOOTH) ? nsIScrollableFrame::SMOOTH :
nsIScrollableFrame::INSTANT);
}
nsresult