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:
Kearwood (Kip) Gilbert
2014-09-15 15:54:42 -07:00
parent ee51b21371
commit aab7434ef1
4 changed files with 13 additions and 7 deletions

View File

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