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

Unified Diff: third_party/WebKit/Source/core/frame/VisualViewportTest.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/frame/VisualViewportTest.cpp
diff --git a/third_party/WebKit/Source/core/frame/VisualViewportTest.cpp b/third_party/WebKit/Source/core/frame/VisualViewportTest.cpp
index 26e5d5a4822d0423dc4a8934e55308b601cae4ff..d8d98617bdb66a0cf8cbca6b065012eacab814dc 100644
--- a/third_party/WebKit/Source/core/frame/VisualViewportTest.cpp
+++ b/third_party/WebKit/Source/core/frame/VisualViewportTest.cpp
@@ -879,12 +879,11 @@ TEST_P(VisualViewportTest, TestSavedToHistoryItem) {
RegisterMockedHttpURLLoad("200-by-300.html");
NavigateTo(base_url_ + "200-by-300.html");
- EXPECT_SIZE_EQ(ScrollOffset(0, 0),
- ToLocalFrame(WebViewImpl()->GetPage()->MainFrame())
- ->Loader()
- .GetDocumentLoader()
- ->GetHistoryItem()
- ->VisualViewportScrollOffset());
+ EXPECT_EQ(nullptr, ToLocalFrame(WebViewImpl()->GetPage()->MainFrame())
+ ->Loader()
+ .GetDocumentLoader()
+ ->GetHistoryItem()
+ ->GetViewState());
VisualViewport& visual_viewport = GetFrame()->GetPage()->GetVisualViewport();
visual_viewport.SetScale(2);
@@ -893,7 +892,8 @@ TEST_P(VisualViewportTest, TestSavedToHistoryItem) {
->Loader()
.GetDocumentLoader()
->GetHistoryItem()
- ->PageScaleFactor());
+ ->GetViewState()
+ ->page_scale_factor_);
visual_viewport.SetLocation(FloatPoint(10, 20));
@@ -902,7 +902,8 @@ TEST_P(VisualViewportTest, TestSavedToHistoryItem) {
->Loader()
.GetDocumentLoader()
->GetHistoryItem()
- ->VisualViewportScrollOffset());
+ ->GetViewState()
+ ->visual_viewport_scroll_offset_);
}
// Test restoring a HistoryItem properly restores the visual viewport's state.
@@ -990,7 +991,8 @@ TEST_P(VisualViewportTest,
->Loader()
.GetDocumentLoader()
->GetHistoryItem();
- EXPECT_SIZE_EQ(ScrollOffset(0, 1000), firstItem->GetScrollOffset());
+ EXPECT_SIZE_EQ(ScrollOffset(0, 1000),
+ firstItem->GetViewState()->scroll_offset_);
// Now navigate to a page which causes a smaller frame_view. Make sure that
// navigating doesn't cause the history item to set a new scroll offset
@@ -1005,7 +1007,8 @@ TEST_P(VisualViewportTest,
.GetDocumentLoader()
->GetHistoryItem());
EXPECT_LT(frame_view->FrameRect().Size().Width(), 1000);
- EXPECT_SIZE_EQ(ScrollOffset(0, 1000), firstItem->GetScrollOffset());
+ EXPECT_SIZE_EQ(ScrollOffset(0, 1000),
+ firstItem->GetViewState()->scroll_offset_);
}
// Test that the coordinates sent into moveRangeSelection are offset by the
« no previous file with comments | « third_party/WebKit/Source/core/exported/WebViewTest.cpp ('k') | third_party/WebKit/Source/core/loader/DocumentLoader.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698