Chromium Code Reviews

Unified Diff: third_party/WebKit/Source/web/tests/WebFrameTest.cpp

Issue 2936423003: Move Get/SetScrollOffset methods from WebFrame to WebLocalFrame. (Closed)
Patch Set: Added TODOs as suggested by dcheng@ (this patchset also accidentally includes a rebase...). Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Index: third_party/WebKit/Source/web/tests/WebFrameTest.cpp
diff --git a/third_party/WebKit/Source/web/tests/WebFrameTest.cpp b/third_party/WebKit/Source/web/tests/WebFrameTest.cpp
index 7107a03c2d27bf6137150707c06e2a31b8abbed2..a6d9ff24a9a9f9ac425c50477d1e36b95e060997 100644
--- a/third_party/WebKit/Source/web/tests/WebFrameTest.cpp
+++ b/third_party/WebKit/Source/web/tests/WebFrameTest.cpp
@@ -3050,7 +3050,7 @@ class WebFrameResizeTest : public ParameterizedWebFrameTest {
EXPECT_NEAR(expected_page_scale_factor,
web_view_helper.WebView()->PageScaleFactor(), 0.05f);
EXPECT_EQ(WebSize(),
- web_view_helper.WebView()->MainFrame()->GetScrollOffset());
+ web_view_helper.WebView()->MainFrameImpl()->GetScrollOffset());
}
// Resizing just the height should not affect pageScaleFactor or
@@ -3059,22 +3059,23 @@ class WebFrameResizeTest : public ParameterizedWebFrameTest {
web_view_helper.Resize(
WebSize(viewport_size.width, viewport_size.height));
web_view_helper.WebView()->SetPageScaleFactor(initial_page_scale_factor);
- web_view_helper.WebView()->MainFrame()->SetScrollOffset(scroll_offset);
+ web_view_helper.WebView()->MainFrameImpl()->SetScrollOffset(
+ scroll_offset);
web_view_helper.WebView()->UpdateAllLifecyclePhases();
const WebSize expected_scroll_offset =
- web_view_helper.WebView()->MainFrame()->GetScrollOffset();
+ web_view_helper.WebView()->MainFrameImpl()->GetScrollOffset();
web_view_helper.Resize(
WebSize(viewport_size.width, viewport_size.height * 0.8f));
EXPECT_EQ(initial_page_scale_factor,
web_view_helper.WebView()->PageScaleFactor());
EXPECT_EQ(expected_scroll_offset,
- web_view_helper.WebView()->MainFrame()->GetScrollOffset());
+ web_view_helper.WebView()->MainFrameImpl()->GetScrollOffset());
web_view_helper.Resize(
WebSize(viewport_size.width, viewport_size.height * 0.8f));
EXPECT_EQ(initial_page_scale_factor,
web_view_helper.WebView()->PageScaleFactor());
EXPECT_EQ(expected_scroll_offset,
- web_view_helper.WebView()->MainFrame()->GetScrollOffset());
+ web_view_helper.WebView()->MainFrameImpl()->GetScrollOffset());
}
}
};
@@ -3242,7 +3243,7 @@ void SetScaleAndScrollAndLayout(WebViewBase* web_view,
WebPoint scroll,
float scale) {
web_view->SetPageScaleFactor(scale);
- web_view->MainFrame()->SetScrollOffset(WebSize(scroll.x, scroll.y));
+ web_view->MainFrameImpl()->SetScrollOffset(WebSize(scroll.x, scroll.y));
web_view->UpdateAllLifecyclePhases();
}
@@ -4243,7 +4244,7 @@ TEST_F(WebFrameTest, ReloadWithOverrideURLPreservesState) {
FrameTestHelpers::WebViewHelper web_view_helper;
web_view_helper.InitializeAndLoad(base_url_ + first_url, &client);
web_view_helper.Resize(WebSize(kPageWidth, kPageHeight));
- web_view_helper.WebView()->MainFrame()->SetScrollOffset(
+ web_view_helper.WebView()->MainFrameImpl()->SetScrollOffset(
WebSize(kPageWidth / 4, kPageHeight / 4));
web_view_helper.WebView()->SetPageScaleFactor(kPageScaleFactor);
@@ -4252,9 +4253,10 @@ TEST_F(WebFrameTest, ReloadWithOverrideURLPreservesState) {
ToKURL(base_url_ + first_url), WebFrameLoadType::kReload);
FrameTestHelpers::PumpPendingRequestsForFrameToLoad(
web_view_helper.WebView()->MainFrame());
- EXPECT_EQ(0, web_view_helper.WebView()->MainFrame()->GetScrollOffset().width);
- EXPECT_EQ(0,
- web_view_helper.WebView()->MainFrame()->GetScrollOffset().height);
+ EXPECT_EQ(
+ 0, web_view_helper.WebView()->MainFrameImpl()->GetScrollOffset().width);
+ EXPECT_EQ(
+ 0, web_view_helper.WebView()->MainFrameImpl()->GetScrollOffset().height);
EXPECT_EQ(1.0f, web_view_helper.WebView()->PageScaleFactor());
// Reload the page using the cache. State should not be propagated.
@@ -4262,9 +4264,10 @@ TEST_F(WebFrameTest, ReloadWithOverrideURLPreservesState) {
ToKURL(base_url_ + second_url), WebFrameLoadType::kReload);
FrameTestHelpers::PumpPendingRequestsForFrameToLoad(
web_view_helper.WebView()->MainFrame());
- EXPECT_EQ(0, web_view_helper.WebView()->MainFrame()->GetScrollOffset().width);
- EXPECT_EQ(0,
- web_view_helper.WebView()->MainFrame()->GetScrollOffset().height);
+ EXPECT_EQ(
+ 0, web_view_helper.WebView()->MainFrameImpl()->GetScrollOffset().width);
+ EXPECT_EQ(
+ 0, web_view_helper.WebView()->MainFrameImpl()->GetScrollOffset().height);
EXPECT_EQ(1.0f, web_view_helper.WebView()->PageScaleFactor());
// Reload the page while bypassing the cache. State should not be propagated.
@@ -4272,9 +4275,10 @@ TEST_F(WebFrameTest, ReloadWithOverrideURLPreservesState) {
ToKURL(base_url_ + third_url), WebFrameLoadType::kReloadBypassingCache);
FrameTestHelpers::PumpPendingRequestsForFrameToLoad(
web_view_helper.WebView()->MainFrame());
- EXPECT_EQ(0, web_view_helper.WebView()->MainFrame()->GetScrollOffset().width);
- EXPECT_EQ(0,
- web_view_helper.WebView()->MainFrame()->GetScrollOffset().height);
+ EXPECT_EQ(
+ 0, web_view_helper.WebView()->MainFrameImpl()->GetScrollOffset().width);
+ EXPECT_EQ(
+ 0, web_view_helper.WebView()->MainFrameImpl()->GetScrollOffset().height);
EXPECT_EQ(1.0f, web_view_helper.WebView()->PageScaleFactor());
}
@@ -6324,7 +6328,7 @@ TEST_F(WebFrameTest, DisambiguationPopupVisualViewport) {
web_view_helper.Resize(WebSize(100, 200));
// Scroll main frame to the bottom of the document
- web_view_impl->MainFrame()->SetScrollOffset(WebSize(0, 400));
+ web_view_impl->MainFrameImpl()->SetScrollOffset(WebSize(0, 400));
EXPECT_SIZE_EQ(ScrollOffset(0, 400), frame->View()->GetScrollOffset());
web_view_impl->SetPageScaleFactor(2.0);
@@ -7894,7 +7898,7 @@ TEST_F(WebFrameTest, FrameViewScrollAccountsForBrowserControls) {
web_view->SetPageScaleFactor(2.0f);
web_view->UpdateAllLifecyclePhases();
- web_view->MainFrame()->SetScrollOffset(WebSize(0, 2000));
+ web_view->MainFrameImpl()->SetScrollOffset(WebSize(0, 2000));
EXPECT_SIZE_EQ(ScrollOffset(0, 1900), frame_view->GetScrollOffset());
// Simulate the browser controls showing by 20px, thus shrinking the viewport
@@ -7906,7 +7910,7 @@ TEST_F(WebFrameTest, FrameViewScrollAccountsForBrowserControls) {
// Show more, make sure the scroll actually gets clamped.
web_view->ApplyViewportDeltas(WebFloatSize(), WebFloatSize(), WebFloatSize(),
1.0f, 20.0f / browser_controls_height);
- web_view->MainFrame()->SetScrollOffset(WebSize(0, 2000));
+ web_view->MainFrameImpl()->SetScrollOffset(WebSize(0, 2000));
EXPECT_SIZE_EQ(ScrollOffset(0, 1940), frame_view->GetScrollOffset());
// Hide until there's 10px showing.

Powered by Google App Engine