OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 const int touchPointPadding = 32; | 160 const int touchPointPadding = 32; |
161 | 161 |
162 #define EXPECT_RECT_EQ(expected, actual) \ | 162 #define EXPECT_RECT_EQ(expected, actual) \ |
163 do { \ | 163 do { \ |
164 EXPECT_EQ(expected.x(), actual.x()); \ | 164 EXPECT_EQ(expected.x(), actual.x()); \ |
165 EXPECT_EQ(expected.y(), actual.y()); \ | 165 EXPECT_EQ(expected.y(), actual.y()); \ |
166 EXPECT_EQ(expected.width(), actual.width()); \ | 166 EXPECT_EQ(expected.width(), actual.width()); \ |
167 EXPECT_EQ(expected.height(), actual.height()); \ | 167 EXPECT_EQ(expected.height(), actual.height()); \ |
168 } while (false) | 168 } while (false) |
169 | 169 |
170 #define EXPECT_POINT_EQ(expected, actual) \ | 170 #define EXPECT_SIZE_EQ(expected, actual) \ |
171 do { \ | 171 do { \ |
172 EXPECT_EQ(expected.x(), actual.x()); \ | 172 EXPECT_EQ(expected.width(), actual.width()); \ |
173 EXPECT_EQ(expected.y(), actual.y()); \ | 173 EXPECT_EQ(expected.height(), actual.height()); \ |
174 } while (false) | 174 } while (false) |
175 | 175 |
176 #define EXPECT_FLOAT_POINT_EQ(expected, actual) \ | 176 #define EXPECT_FLOAT_POINT_EQ(expected, actual) \ |
177 do { \ | 177 do { \ |
178 EXPECT_FLOAT_EQ(expected.x(), actual.x()); \ | 178 EXPECT_FLOAT_EQ(expected.x(), actual.x()); \ |
179 EXPECT_FLOAT_EQ(expected.y(), actual.y()); \ | 179 EXPECT_FLOAT_EQ(expected.y(), actual.y()); \ |
180 } while (false) | 180 } while (false) |
181 | 181 |
182 class WebFrameTest : public ::testing::Test { | 182 class WebFrameTest : public ::testing::Test { |
183 protected: | 183 protected: |
(...skipping 2748 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2932 | 2932 |
2933 void setScaleAndScrollAndLayout(WebViewImpl* webView, | 2933 void setScaleAndScrollAndLayout(WebViewImpl* webView, |
2934 WebPoint scroll, | 2934 WebPoint scroll, |
2935 float scale) { | 2935 float scale) { |
2936 webView->setPageScaleFactor(scale); | 2936 webView->setPageScaleFactor(scale); |
2937 webView->mainFrame()->setScrollOffset(WebSize(scroll.x, scroll.y)); | 2937 webView->mainFrame()->setScrollOffset(WebSize(scroll.x, scroll.y)); |
2938 webView->updateAllLifecyclePhases(); | 2938 webView->updateAllLifecyclePhases(); |
2939 } | 2939 } |
2940 | 2940 |
2941 void simulatePageScale(WebViewImpl* webViewImpl, float& scale) { | 2941 void simulatePageScale(WebViewImpl* webViewImpl, float& scale) { |
2942 IntSize scrollDelta = | 2942 ScrollOffset scrollDelta = |
2943 webViewImpl->fakePageScaleAnimationTargetPositionForTesting() - | 2943 toScrollOffset( |
2944 webViewImpl->mainFrameImpl()->frameView()->scrollPosition(); | 2944 webViewImpl->fakePageScaleAnimationTargetPositionForTesting()) - |
| 2945 webViewImpl->mainFrameImpl()->frameView()->scrollOffset(); |
2945 float scaleDelta = webViewImpl->fakePageScaleAnimationPageScaleForTesting() / | 2946 float scaleDelta = webViewImpl->fakePageScaleAnimationPageScaleForTesting() / |
2946 webViewImpl->pageScaleFactor(); | 2947 webViewImpl->pageScaleFactor(); |
2947 webViewImpl->applyViewportDeltas(WebFloatSize(), FloatSize(scrollDelta), | 2948 webViewImpl->applyViewportDeltas(WebFloatSize(), FloatSize(scrollDelta), |
2948 WebFloatSize(), scaleDelta, 0); | 2949 WebFloatSize(), scaleDelta, 0); |
2949 scale = webViewImpl->pageScaleFactor(); | 2950 scale = webViewImpl->pageScaleFactor(); |
2950 } | 2951 } |
2951 | 2952 |
2952 void simulateMultiTargetZoom(WebViewImpl* webViewImpl, | 2953 void simulateMultiTargetZoom(WebViewImpl* webViewImpl, |
2953 const WebRect& rect, | 2954 const WebRect& rect, |
2954 float& scale) { | 2955 float& scale) { |
(...skipping 2795 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5750 | 5751 |
5751 WebViewImpl* webViewImpl = webViewHelper.webView(); | 5752 WebViewImpl* webViewImpl = webViewHelper.webView(); |
5752 ASSERT_TRUE(webViewImpl); | 5753 ASSERT_TRUE(webViewImpl); |
5753 LocalFrame* frame = webViewImpl->mainFrameImpl()->frame(); | 5754 LocalFrame* frame = webViewImpl->mainFrameImpl()->frame(); |
5754 ASSERT_TRUE(frame); | 5755 ASSERT_TRUE(frame); |
5755 | 5756 |
5756 webViewHelper.resize(WebSize(100, 200)); | 5757 webViewHelper.resize(WebSize(100, 200)); |
5757 | 5758 |
5758 // Scroll main frame to the bottom of the document | 5759 // Scroll main frame to the bottom of the document |
5759 webViewImpl->mainFrame()->setScrollOffset(WebSize(0, 400)); | 5760 webViewImpl->mainFrame()->setScrollOffset(WebSize(0, 400)); |
5760 EXPECT_POINT_EQ(IntPoint(0, 400), frame->view()->scrollPosition()); | 5761 EXPECT_SIZE_EQ(ScrollOffset(0, 400), frame->view()->scrollOffset()); |
5761 | 5762 |
5762 webViewImpl->setPageScaleFactor(2.0); | 5763 webViewImpl->setPageScaleFactor(2.0); |
5763 | 5764 |
5764 // Scroll visual viewport to the top of the main frame. | 5765 // Scroll visual viewport to the top of the main frame. |
5765 VisualViewport& visualViewport = frame->page()->frameHost().visualViewport(); | 5766 VisualViewport& visualViewport = frame->page()->frameHost().visualViewport(); |
5766 visualViewport.setLocation(FloatPoint(0, 0)); | 5767 visualViewport.setLocation(FloatPoint(0, 0)); |
5767 EXPECT_FLOAT_POINT_EQ(FloatPoint(0, 0), visualViewport.location()); | 5768 EXPECT_SIZE_EQ(ScrollOffset(0, 0), visualViewport.scrollOffset()); |
5768 | 5769 |
5769 // Tap at the top: there is nothing there. | 5770 // Tap at the top: there is nothing there. |
5770 client.resetTriggered(); | 5771 client.resetTriggered(); |
5771 webViewHelper.webView()->handleInputEvent(fatTap(10, 60)); | 5772 webViewHelper.webView()->handleInputEvent(fatTap(10, 60)); |
5772 EXPECT_FALSE(client.triggered()); | 5773 EXPECT_FALSE(client.triggered()); |
5773 | 5774 |
5774 // Scroll visual viewport to the bottom of the main frame. | 5775 // Scroll visual viewport to the bottom of the main frame. |
5775 visualViewport.setLocation(FloatPoint(0, 200)); | 5776 visualViewport.setLocation(FloatPoint(0, 200)); |
5776 EXPECT_FLOAT_POINT_EQ(FloatPoint(0, 200), visualViewport.location()); | 5777 EXPECT_SIZE_EQ(ScrollOffset(0, 200), visualViewport.scrollOffset()); |
5777 | 5778 |
5778 // Now the tap with the same coordinates should hit two elements. | 5779 // Now the tap with the same coordinates should hit two elements. |
5779 client.resetTriggered(); | 5780 client.resetTriggered(); |
5780 webViewHelper.webView()->handleInputEvent(fatTap(10, 60)); | 5781 webViewHelper.webView()->handleInputEvent(fatTap(10, 60)); |
5781 EXPECT_TRUE(client.triggered()); | 5782 EXPECT_TRUE(client.triggered()); |
5782 | 5783 |
5783 // The same tap shouldn't trigger didTapMultipleTargets() after disabling the | 5784 // The same tap shouldn't trigger didTapMultipleTargets() after disabling the |
5784 // notification for multi-target-tap. | 5785 // notification for multi-target-tap. |
5785 webViewHelper.webView()->settings()->setMultiTargetTapNotificationEnabled( | 5786 webViewHelper.webView()->settings()->setMultiTargetTapNotificationEnabled( |
5786 false); | 5787 false); |
(...skipping 716 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6503 | 6504 |
6504 WebLocalFrameImpl* frameImpl = webViewHelper.webView()->mainFrameImpl(); | 6505 WebLocalFrameImpl* frameImpl = webViewHelper.webView()->mainFrameImpl(); |
6505 DocumentLoader::InitialScrollState& initialScrollState = | 6506 DocumentLoader::InitialScrollState& initialScrollState = |
6506 frameImpl->frame()->loader().documentLoader()->initialScrollState(); | 6507 frameImpl->frame()->loader().documentLoader()->initialScrollState(); |
6507 GraphicsLayer* frameViewLayer = frameImpl->frameView()->layerForScrolling(); | 6508 GraphicsLayer* frameViewLayer = frameImpl->frameView()->layerForScrolling(); |
6508 | 6509 |
6509 EXPECT_FALSE(client.wasFrameScrolled()); | 6510 EXPECT_FALSE(client.wasFrameScrolled()); |
6510 EXPECT_FALSE(initialScrollState.wasScrolledByUser); | 6511 EXPECT_FALSE(initialScrollState.wasScrolledByUser); |
6511 | 6512 |
6512 // Do a compositor scroll, verify that this is counted as a user scroll. | 6513 // Do a compositor scroll, verify that this is counted as a user scroll. |
6513 frameViewLayer->platformLayer()->setScrollPositionDouble( | 6514 frameViewLayer->platformLayer()->setScrollOffset(WebFloatSize(0, 1)); |
6514 WebDoublePoint(0, 1)); | |
6515 frameViewLayer->didScroll(); | 6515 frameViewLayer->didScroll(); |
6516 webViewHelper.webView()->applyViewportDeltas(WebFloatSize(), WebFloatSize(), | 6516 webViewHelper.webView()->applyViewportDeltas(WebFloatSize(), WebFloatSize(), |
6517 WebFloatSize(), 1.7f, 0); | 6517 WebFloatSize(), 1.7f, 0); |
6518 EXPECT_TRUE(client.wasFrameScrolled()); | 6518 EXPECT_TRUE(client.wasFrameScrolled()); |
6519 EXPECT_TRUE(initialScrollState.wasScrolledByUser); | 6519 EXPECT_TRUE(initialScrollState.wasScrolledByUser); |
6520 | 6520 |
6521 client.reset(); | 6521 client.reset(); |
6522 initialScrollState.wasScrolledByUser = false; | 6522 initialScrollState.wasScrolledByUser = false; |
6523 | 6523 |
6524 // The page scale 1.0f and scroll. | 6524 // The page scale 1.0f and scroll. |
6525 frameViewLayer->platformLayer()->setScrollPositionDouble( | 6525 frameViewLayer->platformLayer()->setScrollOffset(WebFloatSize(0, 2)); |
6526 WebDoublePoint(0, 2)); | |
6527 frameViewLayer->didScroll(); | 6526 frameViewLayer->didScroll(); |
6528 webViewHelper.webView()->applyViewportDeltas(WebFloatSize(), WebFloatSize(), | 6527 webViewHelper.webView()->applyViewportDeltas(WebFloatSize(), WebFloatSize(), |
6529 WebFloatSize(), 1.0f, 0); | 6528 WebFloatSize(), 1.0f, 0); |
6530 EXPECT_TRUE(client.wasFrameScrolled()); | 6529 EXPECT_TRUE(client.wasFrameScrolled()); |
6531 EXPECT_TRUE(initialScrollState.wasScrolledByUser); | 6530 EXPECT_TRUE(initialScrollState.wasScrolledByUser); |
6532 client.reset(); | 6531 client.reset(); |
6533 initialScrollState.wasScrolledByUser = false; | 6532 initialScrollState.wasScrolledByUser = false; |
6534 | 6533 |
6535 // No scroll event if there is no scroll delta. | 6534 // No scroll event if there is no scroll delta. |
6536 frameViewLayer->didScroll(); | 6535 frameViewLayer->didScroll(); |
6537 webViewHelper.webView()->applyViewportDeltas(WebFloatSize(), WebFloatSize(), | 6536 webViewHelper.webView()->applyViewportDeltas(WebFloatSize(), WebFloatSize(), |
6538 WebFloatSize(), 1.0f, 0); | 6537 WebFloatSize(), 1.0f, 0); |
6539 EXPECT_FALSE(client.wasFrameScrolled()); | 6538 EXPECT_FALSE(client.wasFrameScrolled()); |
6540 EXPECT_FALSE(initialScrollState.wasScrolledByUser); | 6539 EXPECT_FALSE(initialScrollState.wasScrolledByUser); |
6541 client.reset(); | 6540 client.reset(); |
6542 | 6541 |
6543 // Non zero page scale and scroll. | 6542 // Non zero page scale and scroll. |
6544 frameViewLayer->platformLayer()->setScrollPositionDouble( | 6543 frameViewLayer->platformLayer()->setScrollOffset(WebFloatSize(9, 15)); |
6545 WebDoublePoint(9, 15)); | |
6546 frameViewLayer->didScroll(); | 6544 frameViewLayer->didScroll(); |
6547 webViewHelper.webView()->applyViewportDeltas(WebFloatSize(), WebFloatSize(), | 6545 webViewHelper.webView()->applyViewportDeltas(WebFloatSize(), WebFloatSize(), |
6548 WebFloatSize(), 0.6f, 0); | 6546 WebFloatSize(), 0.6f, 0); |
6549 EXPECT_TRUE(client.wasFrameScrolled()); | 6547 EXPECT_TRUE(client.wasFrameScrolled()); |
6550 EXPECT_TRUE(initialScrollState.wasScrolledByUser); | 6548 EXPECT_TRUE(initialScrollState.wasScrolledByUser); |
6551 client.reset(); | 6549 client.reset(); |
6552 initialScrollState.wasScrolledByUser = false; | 6550 initialScrollState.wasScrolledByUser = false; |
6553 | 6551 |
6554 // Programmatic scroll. | 6552 // Programmatic scroll. |
6555 frameImpl->executeScript(WebScriptSource("window.scrollTo(0, 20);")); | 6553 frameImpl->executeScript(WebScriptSource("window.scrollTo(0, 20);")); |
(...skipping 743 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7299 | 7297 |
7300 WebViewImpl* webView = webViewHelper.webView(); | 7298 WebViewImpl* webView = webViewHelper.webView(); |
7301 FrameView* frameView = webViewHelper.webView()->mainFrameImpl()->frameView(); | 7299 FrameView* frameView = webViewHelper.webView()->mainFrameImpl()->frameView(); |
7302 | 7300 |
7303 float topControlsHeight = 40; | 7301 float topControlsHeight = 40; |
7304 webView->resizeWithTopControls(WebSize(100, 100), topControlsHeight, false); | 7302 webView->resizeWithTopControls(WebSize(100, 100), topControlsHeight, false); |
7305 webView->setPageScaleFactor(2.0f); | 7303 webView->setPageScaleFactor(2.0f); |
7306 webView->updateAllLifecyclePhases(); | 7304 webView->updateAllLifecyclePhases(); |
7307 | 7305 |
7308 webView->mainFrame()->setScrollOffset(WebSize(0, 2000)); | 7306 webView->mainFrame()->setScrollOffset(WebSize(0, 2000)); |
7309 EXPECT_POINT_EQ(IntPoint(0, 1900), IntPoint(frameView->scrollOffset())); | 7307 EXPECT_SIZE_EQ(ScrollOffset(0, 1900), frameView->scrollOffset()); |
7310 | 7308 |
7311 // Simulate the top controls showing by 20px, thus shrinking the viewport | 7309 // Simulate the top controls showing by 20px, thus shrinking the viewport |
7312 // and allowing it to scroll an additional 20px. | 7310 // and allowing it to scroll an additional 20px. |
7313 webView->applyViewportDeltas(WebFloatSize(), WebFloatSize(), WebFloatSize(), | 7311 webView->applyViewportDeltas(WebFloatSize(), WebFloatSize(), WebFloatSize(), |
7314 1.0f, 20.0f / topControlsHeight); | 7312 1.0f, 20.0f / topControlsHeight); |
7315 EXPECT_POINT_EQ(IntPoint(0, 1920), frameView->maximumScrollPosition()); | 7313 EXPECT_SIZE_EQ(ScrollOffset(0, 1920), frameView->maximumScrollOffset()); |
7316 | 7314 |
7317 // Show more, make sure the scroll actually gets clamped. | 7315 // Show more, make sure the scroll actually gets clamped. |
7318 webView->applyViewportDeltas(WebFloatSize(), WebFloatSize(), WebFloatSize(), | 7316 webView->applyViewportDeltas(WebFloatSize(), WebFloatSize(), WebFloatSize(), |
7319 1.0f, 20.0f / topControlsHeight); | 7317 1.0f, 20.0f / topControlsHeight); |
7320 webView->mainFrame()->setScrollOffset(WebSize(0, 2000)); | 7318 webView->mainFrame()->setScrollOffset(WebSize(0, 2000)); |
7321 EXPECT_POINT_EQ(IntPoint(0, 1940), IntPoint(frameView->scrollOffset())); | 7319 EXPECT_SIZE_EQ(ScrollOffset(0, 1940), frameView->scrollOffset()); |
7322 | 7320 |
7323 // Hide until there's 10px showing. | 7321 // Hide until there's 10px showing. |
7324 webView->applyViewportDeltas(WebFloatSize(), WebFloatSize(), WebFloatSize(), | 7322 webView->applyViewportDeltas(WebFloatSize(), WebFloatSize(), WebFloatSize(), |
7325 1.0f, -30.0f / topControlsHeight); | 7323 1.0f, -30.0f / topControlsHeight); |
7326 EXPECT_POINT_EQ(IntPoint(0, 1910), frameView->maximumScrollPosition()); | 7324 EXPECT_SIZE_EQ(ScrollOffset(0, 1910), frameView->maximumScrollOffset()); |
7327 | 7325 |
7328 // Simulate a LayoutPart::resize. The frame is resized to accomodate | 7326 // Simulate a LayoutPart::resize. The frame is resized to accomodate |
7329 // the top controls and Blink's view of the top controls matches that of | 7327 // the top controls and Blink's view of the top controls matches that of |
7330 // the CC | 7328 // the CC |
7331 webView->applyViewportDeltas(WebFloatSize(), WebFloatSize(), WebFloatSize(), | 7329 webView->applyViewportDeltas(WebFloatSize(), WebFloatSize(), WebFloatSize(), |
7332 1.0f, 30.0f / topControlsHeight); | 7330 1.0f, 30.0f / topControlsHeight); |
7333 webView->resizeWithTopControls(WebSize(100, 60), 40.0f, true); | 7331 webView->resizeWithTopControls(WebSize(100, 60), 40.0f, true); |
7334 webView->updateAllLifecyclePhases(); | 7332 webView->updateAllLifecyclePhases(); |
7335 EXPECT_POINT_EQ(IntPoint(0, 1940), frameView->maximumScrollPosition()); | 7333 EXPECT_SIZE_EQ(ScrollOffset(0, 1940), frameView->maximumScrollOffset()); |
7336 | 7334 |
7337 // Now simulate hiding. | 7335 // Now simulate hiding. |
7338 webView->applyViewportDeltas(WebFloatSize(), WebFloatSize(), WebFloatSize(), | 7336 webView->applyViewportDeltas(WebFloatSize(), WebFloatSize(), WebFloatSize(), |
7339 1.0f, -10.0f / topControlsHeight); | 7337 1.0f, -10.0f / topControlsHeight); |
7340 EXPECT_POINT_EQ(IntPoint(0, 1930), frameView->maximumScrollPosition()); | 7338 EXPECT_SIZE_EQ(ScrollOffset(0, 1930), frameView->maximumScrollOffset()); |
7341 | 7339 |
7342 // Reset to original state: 100px widget height, top controls fully hidden. | 7340 // Reset to original state: 100px widget height, top controls fully hidden. |
7343 webView->applyViewportDeltas(WebFloatSize(), WebFloatSize(), WebFloatSize(), | 7341 webView->applyViewportDeltas(WebFloatSize(), WebFloatSize(), WebFloatSize(), |
7344 1.0f, -30.0f / topControlsHeight); | 7342 1.0f, -30.0f / topControlsHeight); |
7345 webView->resizeWithTopControls(WebSize(100, 100), topControlsHeight, false); | 7343 webView->resizeWithTopControls(WebSize(100, 100), topControlsHeight, false); |
7346 webView->updateAllLifecyclePhases(); | 7344 webView->updateAllLifecyclePhases(); |
7347 EXPECT_POINT_EQ(IntPoint(0, 1900), frameView->maximumScrollPosition()); | 7345 EXPECT_SIZE_EQ(ScrollOffset(0, 1900), frameView->maximumScrollOffset()); |
7348 | 7346 |
7349 // Show the top controls by just 1px, since we're zoomed in to 2X, that | 7347 // Show the top controls by just 1px, since we're zoomed in to 2X, that |
7350 // should allow an extra 0.5px of scrolling in the visual viewport. Make | 7348 // should allow an extra 0.5px of scrolling in the visual viewport. Make |
7351 // sure we're not losing any pixels when applying the adjustment on the | 7349 // sure we're not losing any pixels when applying the adjustment on the |
7352 // main frame. | 7350 // main frame. |
7353 webView->applyViewportDeltas(WebFloatSize(), WebFloatSize(), WebFloatSize(), | 7351 webView->applyViewportDeltas(WebFloatSize(), WebFloatSize(), WebFloatSize(), |
7354 1.0f, 1.0f / topControlsHeight); | 7352 1.0f, 1.0f / topControlsHeight); |
7355 EXPECT_POINT_EQ(IntPoint(0, 1901), frameView->maximumScrollPosition()); | 7353 EXPECT_SIZE_EQ(ScrollOffset(0, 1901), frameView->maximumScrollOffset()); |
7356 | 7354 |
7357 webView->applyViewportDeltas(WebFloatSize(), WebFloatSize(), WebFloatSize(), | 7355 webView->applyViewportDeltas(WebFloatSize(), WebFloatSize(), WebFloatSize(), |
7358 1.0f, 2.0f / topControlsHeight); | 7356 1.0f, 2.0f / topControlsHeight); |
7359 EXPECT_POINT_EQ(IntPoint(0, 1903), frameView->maximumScrollPosition()); | 7357 EXPECT_SIZE_EQ(ScrollOffset(0, 1903), frameView->maximumScrollOffset()); |
7360 } | 7358 } |
7361 | 7359 |
7362 TEST_F(WebFrameTest, MaximumScrollPositionCanBeNegative) { | 7360 TEST_F(WebFrameTest, MaximumScrollPositionCanBeNegative) { |
7363 registerMockedHttpURLLoad("rtl-overview-mode.html"); | 7361 registerMockedHttpURLLoad("rtl-overview-mode.html"); |
7364 | 7362 |
7365 FixedLayoutTestWebViewClient client; | 7363 FixedLayoutTestWebViewClient client; |
7366 client.m_screenInfo.deviceScaleFactor = 1; | 7364 client.m_screenInfo.deviceScaleFactor = 1; |
7367 int viewportWidth = 640; | 7365 int viewportWidth = 640; |
7368 int viewportHeight = 480; | 7366 int viewportHeight = 480; |
7369 | 7367 |
7370 FrameTestHelpers::WebViewHelper webViewHelper; | 7368 FrameTestHelpers::WebViewHelper webViewHelper; |
7371 webViewHelper.initializeAndLoad(m_baseURL + "rtl-overview-mode.html", true, | 7369 webViewHelper.initializeAndLoad(m_baseURL + "rtl-overview-mode.html", true, |
7372 nullptr, &client, nullptr, | 7370 nullptr, &client, nullptr, |
7373 enableViewportSettings); | 7371 enableViewportSettings); |
7374 webViewHelper.webView()->setInitialPageScaleOverride(-1); | 7372 webViewHelper.webView()->setInitialPageScaleOverride(-1); |
7375 webViewHelper.webView()->settings()->setWideViewportQuirkEnabled(true); | 7373 webViewHelper.webView()->settings()->setWideViewportQuirkEnabled(true); |
7376 webViewHelper.webView()->settings()->setLoadWithOverviewMode(true); | 7374 webViewHelper.webView()->settings()->setLoadWithOverviewMode(true); |
7377 webViewHelper.webView()->settings()->setUseWideViewport(true); | 7375 webViewHelper.webView()->settings()->setUseWideViewport(true); |
7378 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); | 7376 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); |
7379 webViewHelper.webView()->updateAllLifecyclePhases(); | 7377 webViewHelper.webView()->updateAllLifecyclePhases(); |
7380 | 7378 |
7381 FrameView* frameView = webViewHelper.webView()->mainFrameImpl()->frameView(); | 7379 FrameView* frameView = webViewHelper.webView()->mainFrameImpl()->frameView(); |
7382 EXPECT_LT(frameView->maximumScrollPosition().x(), 0); | 7380 EXPECT_LT(frameView->maximumScrollOffset().width(), 0); |
7383 } | 7381 } |
7384 | 7382 |
7385 TEST_P(ParameterizedWebFrameTest, FullscreenLayerSize) { | 7383 TEST_P(ParameterizedWebFrameTest, FullscreenLayerSize) { |
7386 FakeCompositingWebViewClient client; | 7384 FakeCompositingWebViewClient client; |
7387 registerMockedHttpURLLoad("fullscreen_div.html"); | 7385 registerMockedHttpURLLoad("fullscreen_div.html"); |
7388 FrameTestHelpers::WebViewHelper webViewHelper; | 7386 FrameTestHelpers::WebViewHelper webViewHelper; |
7389 int viewportWidth = 640; | 7387 int viewportWidth = 640; |
7390 int viewportHeight = 480; | 7388 int viewportHeight = 480; |
7391 client.m_screenInfo.rect.width = viewportWidth; | 7389 client.m_screenInfo.rect.width = viewportWidth; |
7392 client.m_screenInfo.rect.height = viewportHeight; | 7390 client.m_screenInfo.rect.height = viewportHeight; |
(...skipping 2766 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10159 Platform::current()->getURLLoaderMockFactory()->setLoaderDelegate(nullptr); | 10157 Platform::current()->getURLLoaderMockFactory()->setLoaderDelegate(nullptr); |
10160 | 10158 |
10161 Document* document = | 10159 Document* document = |
10162 toLocalFrame(helper.webView()->page()->mainFrame())->document(); | 10160 toLocalFrame(helper.webView()->page()->mainFrame())->document(); |
10163 EXPECT_TRUE(document->isImageDocument()); | 10161 EXPECT_TRUE(document->isImageDocument()); |
10164 EXPECT_EQ(Resource::DecodeError, | 10162 EXPECT_EQ(Resource::DecodeError, |
10165 toImageDocument(document)->cachedImage()->getStatus()); | 10163 toImageDocument(document)->cachedImage()->getStatus()); |
10166 } | 10164 } |
10167 | 10165 |
10168 } // namespace blink | 10166 } // namespace blink |
OLD | NEW |