| 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 3787fb643e0c5e3b8677c1250ee7f3d8058ade91..1e4ecb7dd211f8f4477142da45280cd9fd71236b 100644
|
| --- a/third_party/WebKit/Source/web/tests/WebFrameTest.cpp
|
| +++ b/third_party/WebKit/Source/web/tests/WebFrameTest.cpp
|
| @@ -7354,7 +7354,7 @@ TEST_P(ParameterizedWebFrameTest, FrameViewMoveWithSetFrameRect) {
|
| EXPECT_RECT_EQ(IntRect(100, 100, 200, 200), frameView->frameRect());
|
| }
|
|
|
| -TEST_F(WebFrameTest, FrameViewScrollAccountsForTopControls) {
|
| +TEST_F(WebFrameTest, FrameViewScrollAccountsForBrowserControls) {
|
| FakeCompositingWebViewClient client;
|
| registerMockedHttpURLLoad("long_scroll.html");
|
| FrameTestHelpers::WebViewHelper webViewHelper;
|
| @@ -7364,62 +7364,65 @@ TEST_F(WebFrameTest, FrameViewScrollAccountsForTopControls) {
|
| WebViewImpl* webView = webViewHelper.webView();
|
| FrameView* frameView = webViewHelper.webView()->mainFrameImpl()->frameView();
|
|
|
| - float topControlsHeight = 40;
|
| - webView->resizeWithTopControls(WebSize(100, 100), topControlsHeight, false);
|
| + float browserControlsHeight = 40;
|
| + webView->resizeWithBrowserControls(WebSize(100, 100), browserControlsHeight,
|
| + false);
|
| webView->setPageScaleFactor(2.0f);
|
| webView->updateAllLifecyclePhases();
|
|
|
| webView->mainFrame()->setScrollOffset(WebSize(0, 2000));
|
| EXPECT_SIZE_EQ(ScrollOffset(0, 1900), frameView->scrollOffset());
|
|
|
| - // Simulate the top controls showing by 20px, thus shrinking the viewport
|
| + // Simulate the browser controls showing by 20px, thus shrinking the viewport
|
| // and allowing it to scroll an additional 20px.
|
| webView->applyViewportDeltas(WebFloatSize(), WebFloatSize(), WebFloatSize(),
|
| - 1.0f, 20.0f / topControlsHeight);
|
| + 1.0f, 20.0f / browserControlsHeight);
|
| EXPECT_SIZE_EQ(ScrollOffset(0, 1920), frameView->maximumScrollOffset());
|
|
|
| // Show more, make sure the scroll actually gets clamped.
|
| webView->applyViewportDeltas(WebFloatSize(), WebFloatSize(), WebFloatSize(),
|
| - 1.0f, 20.0f / topControlsHeight);
|
| + 1.0f, 20.0f / browserControlsHeight);
|
| webView->mainFrame()->setScrollOffset(WebSize(0, 2000));
|
| EXPECT_SIZE_EQ(ScrollOffset(0, 1940), frameView->scrollOffset());
|
|
|
| // Hide until there's 10px showing.
|
| webView->applyViewportDeltas(WebFloatSize(), WebFloatSize(), WebFloatSize(),
|
| - 1.0f, -30.0f / topControlsHeight);
|
| + 1.0f, -30.0f / browserControlsHeight);
|
| EXPECT_SIZE_EQ(ScrollOffset(0, 1910), frameView->maximumScrollOffset());
|
|
|
| // Simulate a LayoutPart::resize. The frame is resized to accomodate
|
| - // the top controls and Blink's view of the top controls matches that of
|
| - // the CC
|
| + // the browser controls and Blink's view of the browser controls matches that
|
| + // of the CC
|
| webView->applyViewportDeltas(WebFloatSize(), WebFloatSize(), WebFloatSize(),
|
| - 1.0f, 30.0f / topControlsHeight);
|
| - webView->resizeWithTopControls(WebSize(100, 60), 40.0f, true);
|
| + 1.0f, 30.0f / browserControlsHeight);
|
| + webView->resizeWithBrowserControls(WebSize(100, 60), 40.0f, true);
|
| webView->updateAllLifecyclePhases();
|
| EXPECT_SIZE_EQ(ScrollOffset(0, 1940), frameView->maximumScrollOffset());
|
|
|
| // Now simulate hiding.
|
| webView->applyViewportDeltas(WebFloatSize(), WebFloatSize(), WebFloatSize(),
|
| - 1.0f, -10.0f / topControlsHeight);
|
| + 1.0f, -10.0f / browserControlsHeight);
|
| EXPECT_SIZE_EQ(ScrollOffset(0, 1930), frameView->maximumScrollOffset());
|
|
|
| - // Reset to original state: 100px widget height, top controls fully hidden.
|
| + // Reset to original state: 100px widget height, browser controls fully
|
| + // hidden.
|
| webView->applyViewportDeltas(WebFloatSize(), WebFloatSize(), WebFloatSize(),
|
| - 1.0f, -30.0f / topControlsHeight);
|
| - webView->resizeWithTopControls(WebSize(100, 100), topControlsHeight, false);
|
| + 1.0f, -30.0f / browserControlsHeight);
|
| + webView->resizeWithBrowserControls(WebSize(100, 100), browserControlsHeight,
|
| + false);
|
| webView->updateAllLifecyclePhases();
|
| EXPECT_SIZE_EQ(ScrollOffset(0, 1900), frameView->maximumScrollOffset());
|
|
|
| - // Show the top controls by just 1px, since we're zoomed in to 2X, that
|
| + // Show the browser controls by just 1px, since we're zoomed in to 2X, that
|
| // should allow an extra 0.5px of scrolling in the visual viewport. Make
|
| // sure we're not losing any pixels when applying the adjustment on the
|
| // main frame.
|
| webView->applyViewportDeltas(WebFloatSize(), WebFloatSize(), WebFloatSize(),
|
| - 1.0f, 1.0f / topControlsHeight);
|
| + 1.0f, 1.0f / browserControlsHeight);
|
| EXPECT_SIZE_EQ(ScrollOffset(0, 1901), frameView->maximumScrollOffset());
|
|
|
| webView->applyViewportDeltas(WebFloatSize(), WebFloatSize(), WebFloatSize(),
|
| - 1.0f, 2.0f / topControlsHeight);
|
| + 1.0f, 2.0f / browserControlsHeight);
|
| EXPECT_SIZE_EQ(ScrollOffset(0, 1903), frameView->maximumScrollOffset());
|
| }
|
|
|
|
|