diff --git a/docshell/base/nsDocShell.cpp b/docshell/base/nsDocShell.cpp index 7c8011985ea..2c088cc6f63 100644 --- a/docshell/base/nsDocShell.cpp +++ b/docshell/base/nsDocShell.cpp @@ -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 { diff --git a/layout/base/nsIPresShell.h b/layout/base/nsIPresShell.h index 4e818bc16a2..cd89f85eb4e 100644 --- a/layout/base/nsIPresShell.h +++ b/layout/base/nsIPresShell.h @@ -591,9 +591,11 @@ public: * document so that the anchor with the specified name is displayed at * the top of the window. If |aAnchorName| is empty, then this informs * the pres shell that there is no current target, and |aScroll| must - * be false. + * be false. If |aAdditionalScrollFlags| is nsIPresShell::SCROLL_SMOOTH_AUTO + * and |aScroll| is true, the scrolling may be performed with an animation. */ - virtual nsresult GoToAnchor(const nsAString& aAnchorName, bool aScroll) = 0; + virtual nsresult GoToAnchor(const nsAString& aAnchorName, bool aScroll, + uint32_t aAdditionalScrollFlags = 0) = 0; /** * Tells the presshell to scroll again to the last anchor scrolled to by diff --git a/layout/base/nsPresShell.cpp b/layout/base/nsPresShell.cpp index 752163a904e..578ac5830d5 100644 --- a/layout/base/nsPresShell.cpp +++ b/layout/base/nsPresShell.cpp @@ -3081,7 +3081,8 @@ PresShell::CreateReferenceRenderingContext() } nsresult -PresShell::GoToAnchor(const nsAString& aAnchorName, bool aScroll) +PresShell::GoToAnchor(const nsAString& aAnchorName, bool aScroll, + uint32_t aAdditionalScrollFlags) { if (!mDocument) { return NS_ERROR_FAILURE; @@ -3188,7 +3189,7 @@ PresShell::GoToAnchor(const nsAString& aAnchorName, bool aScroll) rv = ScrollContentIntoView(content, ScrollAxis(SCROLL_TOP, SCROLL_ALWAYS), ScrollAxis(), - ANCHOR_SCROLL_FLAGS); + ANCHOR_SCROLL_FLAGS | aAdditionalScrollFlags); NS_ENSURE_SUCCESS(rv, rv); nsIScrollableFrame* rootScroll = GetRootScrollFrameAsScrollable(); diff --git a/layout/base/nsPresShell.h b/layout/base/nsPresShell.h index 7dda92e030d..aaf01bce1c6 100644 --- a/layout/base/nsPresShell.h +++ b/layout/base/nsPresShell.h @@ -123,7 +123,8 @@ public: virtual void ClearFrameRefs(nsIFrame* aFrame) MOZ_OVERRIDE; virtual already_AddRefed CreateReferenceRenderingContext(); - virtual nsresult GoToAnchor(const nsAString& aAnchorName, bool aScroll) MOZ_OVERRIDE; + virtual nsresult GoToAnchor(const nsAString& aAnchorName, bool aScroll, + uint32_t aAdditionalScrollFlags = 0) MOZ_OVERRIDE; virtual nsresult ScrollToAnchor() MOZ_OVERRIDE; virtual nsresult ScrollContentIntoView(nsIContent* aContent,