Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(646)

Unified Diff: third_party/WebKit/Source/core/loader/DocumentLoader.cpp

Issue 2949073002: Changing scroll and view state in onpopstate shouldn't overwrite back/forward state restore (Closed)
Patch Set: +test Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/loader/DocumentLoader.cpp
diff --git a/third_party/WebKit/Source/core/loader/DocumentLoader.cpp b/third_party/WebKit/Source/core/loader/DocumentLoader.cpp
index 0287ed28e3c3169d961a0a8383ab7858301bb494..0b9012cb8ec3d90ecc82fc50600948c1f494a35c 100644
--- a/third_party/WebKit/Source/core/loader/DocumentLoader.cpp
+++ b/third_party/WebKit/Source/core/loader/DocumentLoader.cpp
@@ -354,12 +354,16 @@ void DocumentLoader::SetHistoryItemStateForCommit(
!EqualIgnoringFragmentIdentifier(old_item->Url(), history_item_->Url())))
return;
history_item_->SetDocumentSequenceNumber(old_item->DocumentSequenceNumber());
- history_item_->SetScrollOffset(old_item->GetScrollOffset());
- history_item_->SetDidSaveScrollOrScaleState(
- old_item->DidSaveScrollOrScaleState());
- history_item_->SetVisualViewportScrollOffset(
- old_item->VisualViewportScrollOffset());
- history_item_->SetPageScaleFactor(old_item->PageScaleFactor());
+
+ if (HistoryItem::ScrollAndViewState* scroll_and_scale_state =
majidvp 2017/06/26 16:19:26 s/scroll_and_scale_state/scroll_and_view_state/ I
Nate Chapin 2017/07/11 22:17:59 Done.
+ old_item->GetScrollAndViewState()) {
+ history_item_->SetScrollOffset(scroll_and_scale_state->scroll_offset_);
+ history_item_->SetVisualViewportScrollOffset(
+ scroll_and_scale_state->visual_viewport_scroll_offset_);
+ history_item_->SetPageScaleFactor(
+ scroll_and_scale_state->page_scale_factor_);
+ }
+
history_item_->SetScrollRestorationType(old_item->ScrollRestorationType());
// The item sequence number determines whether items are "the same", such

Powered by Google App Engine
This is Rietveld 408576698