| Index: third_party/WebKit/Source/core/exported/WebFrameTest.cpp
|
| diff --git a/third_party/WebKit/Source/core/exported/WebFrameTest.cpp b/third_party/WebKit/Source/core/exported/WebFrameTest.cpp
|
| index dd4dacf69605d0d3fcca2563107310cae5fb631a..9ef27dea3df99141aca3c59120bc5811cf7fa5f4 100644
|
| --- a/third_party/WebKit/Source/core/exported/WebFrameTest.cpp
|
| +++ b/third_party/WebKit/Source/core/exported/WebFrameTest.cpp
|
| @@ -9976,11 +9976,12 @@ TEST_P(ParameterizedWebFrameTest, SuspendedPageLoadWithRemoteMainFrame) {
|
|
|
| class OverscrollWebViewClient : public FrameTestHelpers::TestWebViewClient {
|
| public:
|
| - MOCK_METHOD4(DidOverscroll,
|
| + MOCK_METHOD5(DidOverscroll,
|
| void(const WebFloatSize&,
|
| const WebFloatSize&,
|
| const WebFloatPoint&,
|
| - const WebFloatSize&));
|
| + const WebFloatSize&,
|
| + const WebScrollBoundaryBehavior&));
|
| };
|
|
|
| typedef std::pair<bool, blink::WebGestureDevice> WebFrameOverscrollTestParam;
|
| @@ -10057,38 +10058,42 @@ TEST_P(WebFrameOverscrollTest,
|
| // scrollUpdate.
|
| ScrollBegin(&web_view_helper, -300, -316);
|
| EXPECT_CALL(client, DidOverscroll(WebFloatSize(8, 16), WebFloatSize(8, 16),
|
| - WebFloatPoint(100, 100), WebFloatSize()));
|
| + WebFloatPoint(100, 100), WebFloatSize(),
|
| + WebScrollBoundaryBehavior()));
|
| ScrollUpdate(&web_view_helper, -308, -316);
|
| Mock::VerifyAndClearExpectations(&client);
|
|
|
| EXPECT_CALL(client, DidOverscroll(WebFloatSize(0, 13), WebFloatSize(8, 29),
|
| - WebFloatPoint(100, 100), WebFloatSize()));
|
| + WebFloatPoint(100, 100), WebFloatSize(),
|
| + WebScrollBoundaryBehavior()));
|
| ScrollUpdate(&web_view_helper, 0, -13);
|
| Mock::VerifyAndClearExpectations(&client);
|
|
|
| EXPECT_CALL(client, DidOverscroll(WebFloatSize(20, 13), WebFloatSize(28, 42),
|
| - WebFloatPoint(100, 100), WebFloatSize()));
|
| + WebFloatPoint(100, 100), WebFloatSize(),
|
| + WebScrollBoundaryBehavior()));
|
| ScrollUpdate(&web_view_helper, -20, -13);
|
| Mock::VerifyAndClearExpectations(&client);
|
|
|
| // Overscroll is not reported.
|
| - EXPECT_CALL(client, DidOverscroll(_, _, _, _)).Times(0);
|
| + EXPECT_CALL(client, DidOverscroll(_, _, _, _, _)).Times(0);
|
| ScrollUpdate(&web_view_helper, 0, 1);
|
| Mock::VerifyAndClearExpectations(&client);
|
|
|
| - EXPECT_CALL(client, DidOverscroll(_, _, _, _)).Times(0);
|
| + EXPECT_CALL(client, DidOverscroll(_, _, _, _, _)).Times(0);
|
| ScrollUpdate(&web_view_helper, 1, 0);
|
| Mock::VerifyAndClearExpectations(&client);
|
|
|
| // Overscroll is reported.
|
| EXPECT_CALL(client,
|
| DidOverscroll(WebFloatSize(0, -701), WebFloatSize(0, -701),
|
| - WebFloatPoint(100, 100), WebFloatSize()));
|
| + WebFloatPoint(100, 100), WebFloatSize(),
|
| + WebScrollBoundaryBehavior()));
|
| ScrollUpdate(&web_view_helper, 0, 1000);
|
| Mock::VerifyAndClearExpectations(&client);
|
|
|
| // Overscroll is not reported.
|
| - EXPECT_CALL(client, DidOverscroll(_, _, _, _)).Times(0);
|
| + EXPECT_CALL(client, DidOverscroll(_, _, _, _, _)).Times(0);
|
| ScrollEnd(&web_view_helper);
|
| Mock::VerifyAndClearExpectations(&client);
|
| }
|
| @@ -10106,7 +10111,7 @@ TEST_P(WebFrameOverscrollTest,
|
| ScrollBegin(&web_view_helper, 0, -316);
|
|
|
| // Scroll the Div to the end.
|
| - EXPECT_CALL(client, DidOverscroll(_, _, _, _)).Times(0);
|
| + EXPECT_CALL(client, DidOverscroll(_, _, _, _, _)).Times(0);
|
| ScrollUpdate(&web_view_helper, 0, -316);
|
| Mock::VerifyAndClearExpectations(&client);
|
|
|
| @@ -10115,7 +10120,8 @@ TEST_P(WebFrameOverscrollTest,
|
|
|
| // Now On Scrolling DIV, scroll is bubbled and root layer is over-scrolled.
|
| EXPECT_CALL(client, DidOverscroll(WebFloatSize(0, 100), WebFloatSize(0, 100),
|
| - WebFloatPoint(100, 100), WebFloatSize()));
|
| + WebFloatPoint(100, 100), WebFloatSize(),
|
| + WebScrollBoundaryBehavior()));
|
| ScrollUpdate(&web_view_helper, 0, -100);
|
| ScrollUpdate(&web_view_helper, 0, -100);
|
| Mock::VerifyAndClearExpectations(&client);
|
| @@ -10125,18 +10131,19 @@ TEST_P(WebFrameOverscrollTest,
|
| // the bug, crbug.com/589320.
|
| // Page scrolls vertically, but over-scrolls horizontally.
|
| // EXPECT_CALL(client, didOverscroll(WebFloatSize(-100, 0), WebFloatSize(-100,
|
| - // 0), WebFloatPoint(100, 100), WebFloatSize()));
|
| + // 0), WebFloatPoint(100, 100), WebFloatSize(), WebScrollBoundaryBehavior()));
|
| // ScrollUpdate(&webViewHelper, 100, 50);
|
| // Mock::VerifyAndClearExpectations(&client);
|
|
|
| // Scrolling up, Overscroll is not reported.
|
| - // EXPECT_CALL(client, didOverscroll(_, _, _, _)).Times(0);
|
| + // EXPECT_CALL(client, didOverscroll(_, _, _, _, _)).Times(0);
|
| // ScrollUpdate(&webViewHelper, 0, -50);
|
| // Mock::VerifyAndClearExpectations(&client);
|
|
|
| // Page scrolls horizontally, but over-scrolls vertically.
|
| // EXPECT_CALL(client, didOverscroll(WebFloatSize(0, 100), WebFloatSize(0,
|
| - // 100), WebFloatPoint(100, 100), WebFloatSize()));
|
| + // 100), WebFloatPoint(100, 100), WebFloatSize(),
|
| + // WebScrollBoundaryBehavior()));
|
| // ScrollUpdate(&webViewHelper, -100, -100);
|
| // Mock::VerifyAndClearExpectations(&client);
|
| }
|
| @@ -10153,7 +10160,7 @@ TEST_P(WebFrameOverscrollTest, RootLayerOverscrolledOnInnerDivOverScroll) {
|
| ScrollBegin(&web_view_helper, 0, -316);
|
|
|
| // Scroll the Div to the end.
|
| - EXPECT_CALL(client, DidOverscroll(_, _, _, _)).Times(0);
|
| + EXPECT_CALL(client, DidOverscroll(_, _, _, _, _)).Times(0);
|
| ScrollUpdate(&web_view_helper, 0, -316);
|
| Mock::VerifyAndClearExpectations(&client);
|
|
|
| @@ -10162,7 +10169,8 @@ TEST_P(WebFrameOverscrollTest, RootLayerOverscrolledOnInnerDivOverScroll) {
|
|
|
| // Now On Scrolling DIV, scroll is bubbled and root layer is over-scrolled.
|
| EXPECT_CALL(client, DidOverscroll(WebFloatSize(0, 50), WebFloatSize(0, 50),
|
| - WebFloatPoint(100, 100), WebFloatSize()));
|
| + WebFloatPoint(100, 100), WebFloatSize(),
|
| + WebScrollBoundaryBehavior()));
|
| ScrollUpdate(&web_view_helper, 0, -150);
|
| Mock::VerifyAndClearExpectations(&client);
|
| }
|
| @@ -10179,7 +10187,7 @@ TEST_P(WebFrameOverscrollTest, RootLayerOverscrolledOnInnerIFrameOverScroll) {
|
|
|
| ScrollBegin(&web_view_helper, 0, -320);
|
| // Scroll the IFrame to the end.
|
| - EXPECT_CALL(client, DidOverscroll(_, _, _, _)).Times(0);
|
| + EXPECT_CALL(client, DidOverscroll(_, _, _, _, _)).Times(0);
|
|
|
| // This scroll will fully scroll the iframe but will be consumed before being
|
| // counted as overscroll.
|
| @@ -10195,7 +10203,8 @@ TEST_P(WebFrameOverscrollTest, RootLayerOverscrolledOnInnerIFrameOverScroll) {
|
|
|
| // Now On Scrolling IFrame, scroll is bubbled and root layer is over-scrolled.
|
| EXPECT_CALL(client, DidOverscroll(WebFloatSize(0, 50), WebFloatSize(0, 50),
|
| - WebFloatPoint(100, 100), WebFloatSize()));
|
| + WebFloatPoint(100, 100), WebFloatSize(),
|
| + WebScrollBoundaryBehavior()));
|
| ScrollUpdate(&web_view_helper, 0, -150);
|
| Mock::VerifyAndClearExpectations(&client);
|
|
|
| @@ -10217,29 +10226,33 @@ TEST_P(WebFrameOverscrollTest, ScaledPageRootLayerOverscrolled) {
|
| // we go back to viewport coordinates it becomes (99, 99).
|
| ScrollBegin(&web_view_helper, 0, 30);
|
| EXPECT_CALL(client, DidOverscroll(WebFloatSize(0, -30), WebFloatSize(0, -30),
|
| - WebFloatPoint(99, 99), WebFloatSize()));
|
| + WebFloatPoint(99, 99), WebFloatSize(),
|
| + WebScrollBoundaryBehavior()));
|
| ScrollUpdate(&web_view_helper, 0, 30);
|
| Mock::VerifyAndClearExpectations(&client);
|
|
|
| EXPECT_CALL(client, DidOverscroll(WebFloatSize(0, -30), WebFloatSize(0, -60),
|
| - WebFloatPoint(99, 99), WebFloatSize()));
|
| + WebFloatPoint(99, 99), WebFloatSize(),
|
| + WebScrollBoundaryBehavior()));
|
| ScrollUpdate(&web_view_helper, 0, 30);
|
| Mock::VerifyAndClearExpectations(&client);
|
|
|
| EXPECT_CALL(client,
|
| DidOverscroll(WebFloatSize(-30, -30), WebFloatSize(-30, -90),
|
| - WebFloatPoint(99, 99), WebFloatSize()));
|
| + WebFloatPoint(99, 99), WebFloatSize(),
|
| + WebScrollBoundaryBehavior()));
|
| ScrollUpdate(&web_view_helper, 30, 30);
|
| Mock::VerifyAndClearExpectations(&client);
|
|
|
| EXPECT_CALL(client,
|
| DidOverscroll(WebFloatSize(-30, 0), WebFloatSize(-60, -90),
|
| - WebFloatPoint(99, 99), WebFloatSize()));
|
| + WebFloatPoint(99, 99), WebFloatSize(),
|
| + WebScrollBoundaryBehavior()));
|
| ScrollUpdate(&web_view_helper, 30, 0);
|
| Mock::VerifyAndClearExpectations(&client);
|
|
|
| // Overscroll is not reported.
|
| - EXPECT_CALL(client, DidOverscroll(_, _, _, _)).Times(0);
|
| + EXPECT_CALL(client, DidOverscroll(_, _, _, _, _)).Times(0);
|
| ScrollEnd(&web_view_helper);
|
| Mock::VerifyAndClearExpectations(&client);
|
| }
|
| @@ -10256,53 +10269,103 @@ TEST_P(WebFrameOverscrollTest, NoOverscrollForSmallvalues) {
|
| ScrollBegin(&web_view_helper, 10, 10);
|
| EXPECT_CALL(client,
|
| DidOverscroll(WebFloatSize(-10, -10), WebFloatSize(-10, -10),
|
| - WebFloatPoint(100, 100), WebFloatSize()));
|
| + WebFloatPoint(100, 100), WebFloatSize(),
|
| + WebScrollBoundaryBehavior()));
|
| ScrollUpdate(&web_view_helper, 10, 10);
|
| Mock::VerifyAndClearExpectations(&client);
|
|
|
| EXPECT_CALL(client,
|
| DidOverscroll(WebFloatSize(0, -0.10), WebFloatSize(-10, -10.10),
|
| - WebFloatPoint(100, 100), WebFloatSize()));
|
| + WebFloatPoint(100, 100), WebFloatSize(),
|
| + WebScrollBoundaryBehavior()));
|
| ScrollUpdate(&web_view_helper, 0, 0.10);
|
| Mock::VerifyAndClearExpectations(&client);
|
|
|
| EXPECT_CALL(client, DidOverscroll(WebFloatSize(-0.10, 0),
|
| WebFloatSize(-10.10, -10.10),
|
| - WebFloatPoint(100, 100), WebFloatSize()));
|
| + WebFloatPoint(100, 100), WebFloatSize(),
|
| + WebScrollBoundaryBehavior()));
|
| ScrollUpdate(&web_view_helper, 0.10, 0);
|
| Mock::VerifyAndClearExpectations(&client);
|
|
|
| // For residual values overscrollDelta should be reset and didOverscroll
|
| // shouldn't be called.
|
| - EXPECT_CALL(client, DidOverscroll(_, _, _, _)).Times(0);
|
| + EXPECT_CALL(client, DidOverscroll(_, _, _, _, _)).Times(0);
|
| ScrollUpdate(&web_view_helper, 0, 0.09);
|
| Mock::VerifyAndClearExpectations(&client);
|
|
|
| - EXPECT_CALL(client, DidOverscroll(_, _, _, _)).Times(0);
|
| + EXPECT_CALL(client, DidOverscroll(_, _, _, _, _)).Times(0);
|
| ScrollUpdate(&web_view_helper, 0.09, 0.09);
|
| Mock::VerifyAndClearExpectations(&client);
|
|
|
| - EXPECT_CALL(client, DidOverscroll(_, _, _, _)).Times(0);
|
| + EXPECT_CALL(client, DidOverscroll(_, _, _, _, _)).Times(0);
|
| ScrollUpdate(&web_view_helper, 0.09, 0);
|
| Mock::VerifyAndClearExpectations(&client);
|
|
|
| - EXPECT_CALL(client, DidOverscroll(_, _, _, _)).Times(0);
|
| + EXPECT_CALL(client, DidOverscroll(_, _, _, _, _)).Times(0);
|
| ScrollUpdate(&web_view_helper, 0, -0.09);
|
| Mock::VerifyAndClearExpectations(&client);
|
|
|
| - EXPECT_CALL(client, DidOverscroll(_, _, _, _)).Times(0);
|
| + EXPECT_CALL(client, DidOverscroll(_, _, _, _, _)).Times(0);
|
| ScrollUpdate(&web_view_helper, -0.09, -0.09);
|
| Mock::VerifyAndClearExpectations(&client);
|
|
|
| - EXPECT_CALL(client, DidOverscroll(_, _, _, _)).Times(0);
|
| + EXPECT_CALL(client, DidOverscroll(_, _, _, _, _)).Times(0);
|
| ScrollUpdate(&web_view_helper, -0.09, 0);
|
| Mock::VerifyAndClearExpectations(&client);
|
|
|
| - EXPECT_CALL(client, DidOverscroll(_, _, _, _)).Times(0);
|
| + EXPECT_CALL(client, DidOverscroll(_, _, _, _, _)).Times(0);
|
| ScrollEnd(&web_view_helper);
|
| Mock::VerifyAndClearExpectations(&client);
|
| }
|
|
|
| +TEST_P(WebFrameOverscrollTest, OnlyMainFrameScrollBoundaryBehaviorHasEffect) {
|
| + OverscrollWebViewClient client;
|
| + RegisterMockedHttpURLLoad("overscroll/iframe-overscroll.html");
|
| + RegisterMockedHttpURLLoad("overscroll/scrollable-iframe.html");
|
| + FrameTestHelpers::WebViewHelper web_view_helper;
|
| + web_view_helper.InitializeAndLoad(
|
| + base_url_ + "overscroll/iframe-overscroll.html", nullptr, &client,
|
| + nullptr, ConfigureAndroid);
|
| + web_view_helper.Resize(WebSize(200, 200));
|
| +
|
| + WebLocalFrame* mainFrame =
|
| + web_view_helper.WebView()->MainFrame()->ToWebLocalFrame();
|
| + mainFrame->ExecuteScript(
|
| + WebScriptSource(WebString("document.body.style="
|
| + "'scroll-boundary-behavior: auto;'")));
|
| + WebLocalFrame* subframe =
|
| + web_view_helper.WebView()->MainFrame()->FirstChild()->ToWebLocalFrame();
|
| + subframe->ExecuteScript(
|
| + WebScriptSource(WebString("document.body.style="
|
| + "'scroll-boundary-behavior: none;'")));
|
| +
|
| + ScrollBegin(&web_view_helper, 100, 116);
|
| + EXPECT_CALL(
|
| + client,
|
| + DidOverscroll(WebFloatSize(-100, -100), WebFloatSize(-100, -100),
|
| + WebFloatPoint(100, 100), WebFloatSize(),
|
| + WebScrollBoundaryBehavior(
|
| + WebScrollBoundaryBehavior::ScrollBoundaryBehaviorType::
|
| + kScrollBoundaryBehaviorTypeAuto)));
|
| + ScrollUpdate(&web_view_helper, 100, 100);
|
| + Mock::VerifyAndClearExpectations(&client);
|
| +
|
| + mainFrame->ExecuteScript(
|
| + WebScriptSource(WebString("document.body.style="
|
| + "'scroll-boundary-behavior: contain;'")));
|
| +
|
| + EXPECT_CALL(
|
| + client,
|
| + DidOverscroll(WebFloatSize(-100, -100), WebFloatSize(-200, -200),
|
| + WebFloatPoint(100, 100), WebFloatSize(),
|
| + WebScrollBoundaryBehavior(
|
| + WebScrollBoundaryBehavior::ScrollBoundaryBehaviorType::
|
| + kScrollBoundaryBehaviorTypeContain)));
|
| + ScrollUpdate(&web_view_helper, 100, 100);
|
| + Mock::VerifyAndClearExpectations(&client);
|
| +}
|
| +
|
| TEST_P(ParameterizedWebFrameTest, OrientationFrameDetach) {
|
| RuntimeEnabledFeatures::SetOrientationEventEnabled(true);
|
| RegisterMockedHttpURLLoad("orientation-frame-detach.html");
|
|
|