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

Unified Diff: third_party/WebKit/Source/core/exported/WebHistoryItem.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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/exported/WebHistoryItem.cpp
diff --git a/third_party/WebKit/Source/core/exported/WebHistoryItem.cpp b/third_party/WebKit/Source/core/exported/WebHistoryItem.cpp
index a3668d78016a8db5bc96f48e9ad54f02cec4350c..4ca622df736402809eb6126e9f544c1b1f189830 100644
--- a/third_party/WebKit/Source/core/exported/WebHistoryItem.cpp
+++ b/third_party/WebKit/Source/core/exported/WebHistoryItem.cpp
@@ -90,7 +90,11 @@ void WebHistoryItem::SetTarget(const WebString& target) {
}
WebFloatPoint WebHistoryItem::VisualViewportScrollOffset() const {
- ScrollOffset offset = private_->VisualViewportScrollOffset();
+ HistoryItem::ViewState* scroll_and_view_state = private_->GetViewState();
+ ScrollOffset offset =
+ scroll_and_view_state
+ ? scroll_and_view_state->visual_viewport_scroll_offset_
+ : ScrollOffset();
return WebFloatPoint(offset.Width(), offset.Height());
}
@@ -100,7 +104,10 @@ void WebHistoryItem::SetVisualViewportScrollOffset(
}
WebPoint WebHistoryItem::GetScrollOffset() const {
- ScrollOffset offset = private_->GetScrollOffset();
+ HistoryItem::ViewState* scroll_and_view_state = private_->GetViewState();
+ ScrollOffset offset = scroll_and_view_state
+ ? scroll_and_view_state->scroll_offset_
+ : ScrollOffset();
return WebPoint(offset.Width(), offset.Height());
}
@@ -109,7 +116,8 @@ void WebHistoryItem::SetScrollOffset(const WebPoint& scroll_offset) {
}
float WebHistoryItem::PageScaleFactor() const {
- return private_->PageScaleFactor();
+ HistoryItem::ViewState* scroll_and_view_state = private_->GetViewState();
+ return scroll_and_view_state ? scroll_and_view_state->page_scale_factor_ : 0;
}
void WebHistoryItem::SetPageScaleFactor(float scale) {
@@ -202,12 +210,7 @@ WebVector<WebString> WebHistoryItem::GetReferencedFilePaths() const {
}
bool WebHistoryItem::DidSaveScrollOrScaleState() const {
- return private_->DidSaveScrollOrScaleState();
-}
-
-void WebHistoryItem::SetDidSaveScrollOrScaleState(
- bool has_save_scroll_or_scale_state) {
- private_->SetDidSaveScrollOrScaleState(has_save_scroll_or_scale_state);
+ return private_->GetViewState();
}
WebHistoryItem::WebHistoryItem(HistoryItem* item) : private_(item) {}

Powered by Google App Engine
This is Rietveld 408576698