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

Side by Side 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: Reset ViewState when trying to copy from a nullptr Created 3 years, 5 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
3 * Copyright (C) 2011 Google Inc. All rights reserved. 3 * Copyright (C) 2011 Google Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 8 *
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 // Don't propagate state from the old item if this is a different-document 348 // Don't propagate state from the old item if this is a different-document
349 // navigation, unless the before and after pages are logically related. This 349 // navigation, unless the before and after pages are logically related. This
350 // means they have the same url (ignoring fragment) and the new item was 350 // means they have the same url (ignoring fragment) and the new item was
351 // loaded via reload or client redirect. 351 // loaded via reload or client redirect.
352 HistoryCommitType history_commit_type = LoadTypeToCommitType(load_type); 352 HistoryCommitType history_commit_type = LoadTypeToCommitType(load_type);
353 if (navigation_type == HistoryNavigationType::kDifferentDocument && 353 if (navigation_type == HistoryNavigationType::kDifferentDocument &&
354 (history_commit_type != kHistoryInertCommit || 354 (history_commit_type != kHistoryInertCommit ||
355 !EqualIgnoringFragmentIdentifier(old_item->Url(), history_item_->Url()))) 355 !EqualIgnoringFragmentIdentifier(old_item->Url(), history_item_->Url())))
356 return; 356 return;
357 history_item_->SetDocumentSequenceNumber(old_item->DocumentSequenceNumber()); 357 history_item_->SetDocumentSequenceNumber(old_item->DocumentSequenceNumber());
358 history_item_->SetScrollOffset(old_item->GetScrollOffset()); 358
359 history_item_->SetDidSaveScrollOrScaleState( 359 history_item_->CopyViewStateFrom(old_item);
360 old_item->DidSaveScrollOrScaleState());
361 history_item_->SetVisualViewportScrollOffset(
362 old_item->VisualViewportScrollOffset());
363 history_item_->SetPageScaleFactor(old_item->PageScaleFactor());
364 history_item_->SetScrollRestorationType(old_item->ScrollRestorationType()); 360 history_item_->SetScrollRestorationType(old_item->ScrollRestorationType());
365 361
366 // The item sequence number determines whether items are "the same", such 362 // The item sequence number determines whether items are "the same", such
367 // back/forward navigation between items with the same item sequence number is 363 // back/forward navigation between items with the same item sequence number is
368 // a no-op. Only treat this as identical if the navigation did not create a 364 // a no-op. Only treat this as identical if the navigation did not create a
369 // back/forward entry and the url is identical or it was loaded via 365 // back/forward entry and the url is identical or it was loaded via
370 // history.replaceState(). 366 // history.replaceState().
371 if (history_commit_type == kHistoryInertCommit && 367 if (history_commit_type == kHistoryInertCommit &&
372 (navigation_type == HistoryNavigationType::kHistoryApi || 368 (navigation_type == HistoryNavigationType::kHistoryApi ||
373 old_item->Url() == history_item_->Url())) { 369 old_item->Url() == history_item_->Url())) {
(...skipping 757 matching lines...) Expand 10 before | Expand all | Expand 10 after
1131 InstallNewDocumentReason::kJavascriptURL, 1127 InstallNewDocumentReason::kJavascriptURL,
1132 kForceSynchronousParsing, NullURL()); 1128 kForceSynchronousParsing, NullURL());
1133 if (!source.IsNull()) 1129 if (!source.IsNull())
1134 writer_->AppendReplacingData(source); 1130 writer_->AppendReplacingData(source);
1135 EndWriting(); 1131 EndWriting();
1136 } 1132 }
1137 1133
1138 DEFINE_WEAK_IDENTIFIER_MAP(DocumentLoader); 1134 DEFINE_WEAK_IDENTIFIER_MAP(DocumentLoader);
1139 1135
1140 } // namespace blink 1136 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/frame/VisualViewportTest.cpp ('k') | third_party/WebKit/Source/core/loader/FrameLoader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698