Bug 851485 - Restoring scroll position from history should only suppress one scroll-to-anchor. r=bzbarsky

This commit is contained in:
Mats Palmgren 2013-03-15 23:32:35 +01:00
parent d9494408fd
commit 7709c39887
3 changed files with 13 additions and 0 deletions

View File

@ -2890,6 +2890,7 @@ PresShell::GoToAnchor(const nsAString& aAnchorName, bool aScroll)
if (rootScroll && rootScroll->DidHistoryRestore()) {
// Scroll position restored from history trumps scrolling to anchor.
aScroll = false;
rootScroll->ClearDidHistoryRestore();
}
if (content) {

View File

@ -537,6 +537,9 @@ public:
virtual bool DidHistoryRestore() MOZ_OVERRIDE {
return mInner.mDidHistoryRestore;
}
virtual void ClearDidHistoryRestore() MOZ_OVERRIDE {
mInner.mDidHistoryRestore = false;
}
// nsIStatefulFrame
NS_IMETHOD SaveState(nsPresState** aState) MOZ_OVERRIDE {
@ -790,6 +793,9 @@ public:
virtual bool DidHistoryRestore() MOZ_OVERRIDE {
return mInner.mDidHistoryRestore;
}
virtual void ClearDidHistoryRestore() MOZ_OVERRIDE {
mInner.mDidHistoryRestore = false;
}
// nsIStatefulFrame
NS_IMETHOD SaveState(nsPresState** aState) MOZ_OVERRIDE {

View File

@ -237,6 +237,12 @@ public:
* Was the current presentation state for this frame restored from history?
*/
virtual bool DidHistoryRestore() = 0;
/**
* Clear the flag so that DidHistoryRestore() returns false until the next
* RestoreState call.
* @see nsIStatefulFrame::RestoreState
*/
virtual void ClearDidHistoryRestore() = 0;
};
#endif