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

Issue 2949073002: Changing scroll and view state in onpopstate shouldn't overwrite back/forward state restore (Closed)

Created:
3 years, 6 months ago by Nate Chapin
Modified:
3 years, 5 months ago
Reviewers:
majidvp, alexmos
CC:
chromium-reviews, blink-reviews, blink-reviews-frames_chromium.org
Target Ref:
refs/heads/master
Project:
chromium
Visibility:
Public.

Description

Changing scroll and view state in onpopstate shouldn't overwrite back/forward state restore FrameLoader::SaveScrollState attempts to avoid clobbering state that will be used for a back/forward restore by checking the committed DocumentLoader::LoadType(). As of https://codereview.chromium.org/2653673006, same-document navigations don't modify that load type, so a same-document back-forward navigation can get its scroll state clobbered by creative use of an onpopstate event handler. Store the needed state on the stack, so that even if onpopstate does trigger a SaveScrollState(), we can still restore. This also pulls scroll and view state out into a helper class of HistoryItem. This object is nullptr until state is saved for the first time, so we don't need a bool to track whether the state is default or real. BUG=734276 TEST=fast/history/change-viewport-height-in-onpopstate.html Review-Url: https://codereview.chromium.org/2949073002 Cr-Commit-Position: refs/heads/master@{#487706} Committed: https://chromium.googlesource.com/chromium/src/+/64015d479a86f06c19cac283a6e6214b38d1db10

Patch Set 1 #

Patch Set 2 : Have a helper class for ScrollAndViewState, stash it before onpopstate #

Patch Set 3 : +test #

Total comments: 10

Patch Set 4 : Non-GarbageColllected ViewState #

Total comments: 2

Patch Set 5 : Reset ViewState when trying to copy from a nullptr #

Unified diffs Side-by-side diffs Delta from patch set Stats (+161 lines, -108 lines) Patch
M content/renderer/history_serialization.cc View 1 1 chunk +6 lines, -4 lines 0 comments Download
A third_party/WebKit/LayoutTests/fast/history/change-viewport-height-in-onpopstate.html View 1 2 1 chunk +49 lines, -0 lines 0 comments Download
A third_party/WebKit/LayoutTests/fast/history/change-viewport-height-in-onpopstate-expected.txt View 1 2 1 chunk +2 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/core/exported/WebHistoryItem.cpp View 1 2 3 4 chunks +12 lines, -9 lines 0 comments Download
M third_party/WebKit/Source/core/exported/WebViewTest.cpp View 1 2 3 1 chunk +10 lines, -19 lines 0 comments Download
M third_party/WebKit/Source/core/frame/VisualViewportTest.cpp View 1 2 3 5 chunks +13 lines, -10 lines 0 comments Download
M third_party/WebKit/Source/core/loader/DocumentLoader.cpp View 1 2 3 1 chunk +2 lines, -6 lines 0 comments Download
M third_party/WebKit/Source/core/loader/FrameLoader.h View 1 2 3 1 chunk +4 lines, -2 lines 0 comments Download
M third_party/WebKit/Source/core/loader/FrameLoader.cpp View 1 2 3 5 chunks +29 lines, -19 lines 0 comments Download
M third_party/WebKit/Source/core/loader/HistoryItem.h View 1 2 3 4 2 chunks +19 lines, -14 lines 0 comments Download
M third_party/WebKit/Source/core/loader/HistoryItem.cpp View 1 2 3 2 chunks +10 lines, -21 lines 0 comments Download
M third_party/WebKit/Source/web/WebViewImpl.cpp View 1 2 3 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/web/tests/WebFrameTest.cpp View 1 2 3 2 chunks +4 lines, -2 lines 0 comments Download
M third_party/WebKit/public/web/WebHistoryItem.h View 1 1 chunk +0 lines, -1 line 0 comments Download

Messages

Total messages: 40 (28 generated)
Nate Chapin
majidvp, what do you think of this bugfix+cleanup?
3 years, 6 months ago (2017-06-22 02:31:02 UTC) #15
majidvp
This is a nice clean up. https://codereview.chromium.org/2949073002/diff/40001/third_party/WebKit/Source/core/loader/DocumentLoader.cpp File third_party/WebKit/Source/core/loader/DocumentLoader.cpp (right): https://codereview.chromium.org/2949073002/diff/40001/third_party/WebKit/Source/core/loader/DocumentLoader.cpp#newcode358 third_party/WebKit/Source/core/loader/DocumentLoader.cpp:358: if (HistoryItem::ScrollAndViewState* scroll_and_scale_state ...
3 years, 5 months ago (2017-06-26 16:19:27 UTC) #16
Nate Chapin
https://codereview.chromium.org/2949073002/diff/40001/third_party/WebKit/Source/core/loader/DocumentLoader.cpp File third_party/WebKit/Source/core/loader/DocumentLoader.cpp (right): https://codereview.chromium.org/2949073002/diff/40001/third_party/WebKit/Source/core/loader/DocumentLoader.cpp#newcode358 third_party/WebKit/Source/core/loader/DocumentLoader.cpp:358: if (HistoryItem::ScrollAndViewState* scroll_and_scale_state = On 2017/06/26 16:19:26, majidvp wrote: ...
3 years, 5 months ago (2017-07-11 22:17:59 UTC) #19
majidvp
https://codereview.chromium.org/2949073002/diff/60001/third_party/WebKit/Source/core/loader/HistoryItem.h File third_party/WebKit/Source/core/loader/HistoryItem.h (right): https://codereview.chromium.org/2949073002/diff/60001/third_party/WebKit/Source/core/loader/HistoryItem.h#newcode76 third_party/WebKit/Source/core/loader/HistoryItem.h:76: view_state_ = WTF::MakeUnique<ViewState>(*other->view_state_.get()); shouldn't we reset() in the nullptr ...
3 years, 5 months ago (2017-07-17 20:06:15 UTC) #22
Nate Chapin
https://codereview.chromium.org/2949073002/diff/60001/third_party/WebKit/Source/core/loader/HistoryItem.h File third_party/WebKit/Source/core/loader/HistoryItem.h (right): https://codereview.chromium.org/2949073002/diff/60001/third_party/WebKit/Source/core/loader/HistoryItem.h#newcode76 third_party/WebKit/Source/core/loader/HistoryItem.h:76: view_state_ = WTF::MakeUnique<ViewState>(*other->view_state_.get()); On 2017/07/17 20:06:15, majidvp wrote: > ...
3 years, 5 months ago (2017-07-17 20:38:43 UTC) #25
majidvp
lgtm
3 years, 5 months ago (2017-07-18 12:26:34 UTC) #28
commit-bot: I haz the power
CQ is trying da patch. Follow status at: https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2949073002/80001
3 years, 5 months ago (2017-07-18 18:05:42 UTC) #30
commit-bot: I haz the power
Try jobs failed on following builders: chromium_presubmit on master.tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/chromium_presubmit/builds/492720)
3 years, 5 months ago (2017-07-18 18:19:33 UTC) #32
Nate Chapin
alexmos, would you mind reviewing the content/renderer/ change?
3 years, 5 months ago (2017-07-18 18:23:37 UTC) #34
alexmos
content/renderer/ LGTM
3 years, 5 months ago (2017-07-18 20:48:28 UTC) #35
commit-bot: I haz the power
CQ is trying da patch. Follow status at: https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2949073002/80001
3 years, 5 months ago (2017-07-18 23:15:49 UTC) #37
commit-bot: I haz the power
3 years, 5 months ago (2017-07-19 01:23:19 UTC) #40
Message was sent while issue was closed.
Committed patchset #5 (id:80001) as
https://chromium.googlesource.com/chromium/src/+/64015d479a86f06c19cac283a6e6...

Powered by Google App Engine
This is Rietveld 408576698