Bug 1010538 - Part 5 - Enable automatic smooth scrolling for anchor links. r=mstange
- When an anchor link is clicked, the SCROLL_SMOOTH_AUTO flag is now set by PresShell::GoToAnchor when calling PresShell::ScrollContentIntoView. - Added an arguement, aAnimateScroll, to PresShell:GoToAnchor to indicate that the scroll may be animated. This will only be set to true when an anchor link is clicked. Opening a page with an anchor link will not trigger such animations.
This commit is contained in:
@@ -10730,7 +10730,8 @@ nsDocShell::ScrollToAnchor(nsACString & aCurHash, nsACString & aNewHash,
|
||||
nsresult rv = NS_ERROR_FAILURE;
|
||||
NS_ConvertUTF8toUTF16 uStr(str);
|
||||
if (!uStr.IsEmpty()) {
|
||||
rv = shell->GoToAnchor(NS_ConvertUTF8toUTF16(str), scroll);
|
||||
rv = shell->GoToAnchor(NS_ConvertUTF8toUTF16(str), scroll,
|
||||
nsIPresShell::SCROLL_SMOOTH_AUTO);
|
||||
}
|
||||
nsMemory::Free(str);
|
||||
|
||||
@@ -10764,7 +10765,8 @@ nsDocShell::ScrollToAnchor(nsACString & aCurHash, nsACString & aNewHash,
|
||||
//
|
||||
// When newHashName contains "%00", unescaped string may be empty.
|
||||
// And GoToAnchor asserts if we ask it to scroll to an empty ref.
|
||||
shell->GoToAnchor(uStr, scroll && !uStr.IsEmpty());
|
||||
shell->GoToAnchor(uStr, scroll && !uStr.IsEmpty(),
|
||||
nsIPresShell::SCROLL_SMOOTH_AUTO);
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
Reference in New Issue
Block a user