Chromium Code Reviews| 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 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 307 | 307 |
| 308 class FixedLayoutTestWebViewClient : public WebViewClient { | 308 class FixedLayoutTestWebViewClient : public WebViewClient { |
| 309 public: | 309 public: |
| 310 virtual WebScreenInfo screenInfo() OVERRIDE { return m_screenInfo; } | 310 virtual WebScreenInfo screenInfo() OVERRIDE { return m_screenInfo; } |
| 311 | 311 |
| 312 WebScreenInfo m_screenInfo; | 312 WebScreenInfo m_screenInfo; |
| 313 }; | 313 }; |
| 314 | 314 |
| 315 TEST_F(WebFrameTest, FrameViewNeedsLayoutOnFixedLayoutResize) | 315 TEST_F(WebFrameTest, FrameViewNeedsLayoutOnFixedLayoutResize) |
| 316 { | 316 { |
| 317 // FIXME: This test currently fails because we assumed layout() wouldn't be called | |
|
kenneth.r.christiansen
2013/09/05 08:03:07
So how will that affect say chrome for android on
bokan
2013/09/05 20:03:36
It shouldn't affect behavior since the orientation
| |
| 318 // on resizes in fixed layout mode. Now that we've ripped out fixed layout m ode, | |
| 319 // that assumption is no longer true when we're trying to emulate that behav ior | |
| 317 registerMockedHttpURLLoad("fixed_layout.html"); | 320 registerMockedHttpURLLoad("fixed_layout.html"); |
| 318 | 321 |
| 319 FixedLayoutTestWebViewClient client; | 322 FixedLayoutTestWebViewClient client; |
| 320 int viewportWidth = 640; | 323 int viewportWidth = 640; |
| 321 int viewportHeight = 480; | 324 int viewportHeight = 480; |
| 322 | 325 |
| 323 // Make sure we initialize to minimum scale, even if the window size | 326 // Make sure we initialize to minimum scale, even if the window size |
| 324 // only becomes available after the load begins. | 327 // only becomes available after the load begins. |
| 325 m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "fixed_layout .html", true, 0, &client); | 328 m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "fixed_layout .html", true, 0, &client); |
| 326 m_webView->enableFixedLayoutMode(true); | 329 m_webView->enableFixedLayoutMode(true); |
| 330 m_webView->setLayoutSize(WebSize(viewportWidth, viewportHeight)); | |
| 327 m_webView->settings()->setViewportEnabled(true); | 331 m_webView->settings()->setViewportEnabled(true); |
| 328 m_webView->resize(WebSize(viewportWidth, viewportHeight)); | 332 m_webView->resize(WebSize(viewportWidth, viewportHeight)); |
| 329 m_webView->layout(); | 333 m_webView->layout(); |
| 330 | 334 |
| 331 webViewImpl()->mainFrameImpl()->frameView()->setFixedLayoutSize(WebCore::Int Size(100, 100)); | 335 webViewImpl()->mainFrameImpl()->frameView()->setLayoutSize(WebCore::IntSize( 100, 100)); |
| 332 EXPECT_TRUE(webViewImpl()->mainFrameImpl()->frameView()->needsLayout()); | 336 EXPECT_TRUE(webViewImpl()->mainFrameImpl()->frameView()->needsLayout()); |
| 333 | 337 |
| 334 int prevLayoutCount = webViewImpl()->mainFrameImpl()->frameView()->layoutCou nt(); | 338 int prevLayoutCount = webViewImpl()->mainFrameImpl()->frameView()->layoutCou nt(); |
| 335 webViewImpl()->mainFrameImpl()->frameView()->setFrameRect(WebCore::IntRect(0 , 0, 641, 481)); | 339 webViewImpl()->mainFrameImpl()->frameView()->setFrameRect(WebCore::IntRect(0 , 0, 641, 481)); |
| 336 EXPECT_EQ(prevLayoutCount, webViewImpl()->mainFrameImpl()->frameView()->layo utCount()); | 340 EXPECT_EQ(prevLayoutCount, webViewImpl()->mainFrameImpl()->frameView()->layo utCount()); |
| 337 | 341 |
| 338 webViewImpl()->layout(); | 342 webViewImpl()->layout(); |
| 339 } | 343 } |
| 340 | 344 |
| 341 TEST_F(WebFrameTest, ChangeInFixedLayoutTriggersTextAutosizingRecalculate) | 345 TEST_F(WebFrameTest, ChangeInFixedLayoutTriggersTextAutosizingRecalculate) |
| (...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 703 | 707 |
| 704 m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "viewport-dev ice-0.5x-initial-scale.html", true, 0, &client); | 708 m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "viewport-dev ice-0.5x-initial-scale.html", true, 0, &client); |
| 705 m_webView->enableFixedLayoutMode(true); | 709 m_webView->enableFixedLayoutMode(true); |
| 706 m_webView->settings()->setViewportEnabled(true); | 710 m_webView->settings()->setViewportEnabled(true); |
| 707 m_webView->settings()->setUseWideViewport(true); | 711 m_webView->settings()->setUseWideViewport(true); |
| 708 m_webView->settings()->setSupportDeprecatedTargetDensityDPI(true); | 712 m_webView->settings()->setSupportDeprecatedTargetDensityDPI(true); |
| 709 m_webView->settings()->setViewportMetaLayoutSizeQuirk(true); | 713 m_webView->settings()->setViewportMetaLayoutSizeQuirk(true); |
| 710 m_webView->resize(WebSize(viewportWidth, viewportHeight)); | 714 m_webView->resize(WebSize(viewportWidth, viewportHeight)); |
| 711 | 715 |
| 712 WebViewImpl* webViewImpl = static_cast<WebViewImpl*>(m_webView); | 716 WebViewImpl* webViewImpl = static_cast<WebViewImpl*>(m_webView); |
| 713 EXPECT_EQ(viewportWidth, webViewImpl->mainFrameImpl()->frameView()->fixedLay outSize().width()); | 717 EXPECT_EQ(viewportWidth, webViewImpl->mainFrameImpl()->frameView()->layoutSi ze().width()); |
| 714 } | 718 } |
| 715 | 719 |
| 716 TEST_F(WebFrameTest, ZeroValuesQuirk) | 720 TEST_F(WebFrameTest, ZeroValuesQuirk) |
| 717 { | 721 { |
| 718 registerMockedHttpURLLoad("viewport-zero-values.html"); | 722 registerMockedHttpURLLoad("viewport-zero-values.html"); |
| 719 | 723 |
| 720 FixedLayoutTestWebViewClient client; | 724 FixedLayoutTestWebViewClient client; |
| 721 client.m_screenInfo.deviceScaleFactor = 1; | 725 client.m_screenInfo.deviceScaleFactor = 1; |
| 722 int viewportWidth = 640; | 726 int viewportWidth = 640; |
| 723 int viewportHeight = 480; | 727 int viewportHeight = 480; |
| 724 | 728 |
| 725 m_webView = FrameTestHelpers::createWebView(true, 0, &client); | 729 m_webView = FrameTestHelpers::createWebView(true, 0, &client); |
| 726 m_webView->enableFixedLayoutMode(true); | 730 m_webView->enableFixedLayoutMode(true); |
| 731 m_webView->setFixedLayoutSize(WebSize(viewportWidth, viewportHeight)); | |
|
kenneth.r.christiansen
2013/09/05 08:03:07
I thought you were getting rid of fixed layout
bokan
2013/09/05 20:03:36
Yes, sorry, this should be setLayoutSize. Fixed.
| |
| 727 m_webView->settings()->setViewportEnabled(true); | 732 m_webView->settings()->setViewportEnabled(true); |
| 728 m_webView->settings()->setSupportDeprecatedTargetDensityDPI(true); | 733 m_webView->settings()->setSupportDeprecatedTargetDensityDPI(true); |
| 729 m_webView->settings()->setViewportMetaZeroValuesQuirk(true); | 734 m_webView->settings()->setViewportMetaZeroValuesQuirk(true); |
| 730 FrameTestHelpers::loadFrame(m_webView->mainFrame(), m_baseURL + "viewport-ze ro-values.html"); | 735 FrameTestHelpers::loadFrame(m_webView->mainFrame(), m_baseURL + "viewport-ze ro-values.html"); |
| 731 Platform::current()->unitTestSupport()->serveAsynchronousMockedRequests(); | 736 Platform::current()->unitTestSupport()->serveAsynchronousMockedRequests(); |
| 732 m_webView->resize(WebSize(viewportWidth, viewportHeight)); | 737 m_webView->resize(WebSize(viewportWidth, viewportHeight)); |
| 733 | 738 |
| 734 WebViewImpl* webViewImpl = static_cast<WebViewImpl*>(m_webView); | 739 WebViewImpl* webViewImpl = static_cast<WebViewImpl*>(m_webView); |
| 735 EXPECT_EQ(viewportWidth, webViewImpl->mainFrameImpl()->frameView()->fixedLay outSize().width()); | 740 EXPECT_EQ(viewportWidth, webViewImpl->mainFrameImpl()->frameView()->layoutSi ze().width()); |
| 736 EXPECT_EQ(1.0f, m_webView->pageScaleFactor()); | 741 EXPECT_EQ(1.0f, m_webView->pageScaleFactor()); |
| 737 | 742 |
| 738 m_webView->settings()->setUseWideViewport(true); | 743 m_webView->settings()->setUseWideViewport(true); |
| 739 m_webView->layout(); | 744 m_webView->layout(); |
| 740 EXPECT_EQ(viewportWidth, webViewImpl->mainFrameImpl()->frameView()->fixedLay outSize().width()); | 745 EXPECT_EQ(viewportWidth, webViewImpl->mainFrameImpl()->frameView()->layoutSi ze().width()); |
| 741 EXPECT_EQ(1.0f, m_webView->pageScaleFactor()); | 746 EXPECT_EQ(1.0f, m_webView->pageScaleFactor()); |
| 742 } | 747 } |
| 743 | 748 |
| 744 TEST_F(WebFrameTest, ScaleFactorShouldNotOscillate) | 749 TEST_F(WebFrameTest, ScaleFactorShouldNotOscillate) |
| 745 { | 750 { |
| 746 registerMockedHttpURLLoad("scale_oscillate.html"); | 751 registerMockedHttpURLLoad("scale_oscillate.html"); |
| 747 | 752 |
| 748 FixedLayoutTestWebViewClient client; | 753 FixedLayoutTestWebViewClient client; |
| 749 client.m_screenInfo.deviceScaleFactor = static_cast<float>(1.325); | 754 client.m_screenInfo.deviceScaleFactor = static_cast<float>(1.325); |
| 750 int viewportWidth = 800; | 755 int viewportWidth = 800; |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 848 registerMockedHttpURLLoad("fixed_layout.html"); | 853 registerMockedHttpURLLoad("fixed_layout.html"); |
| 849 | 854 |
| 850 FixedLayoutTestWebViewClient client; | 855 FixedLayoutTestWebViewClient client; |
| 851 client.m_screenInfo.deviceScaleFactor = 1; | 856 client.m_screenInfo.deviceScaleFactor = 1; |
| 852 // Small viewport to ensure there are always scrollbars. | 857 // Small viewport to ensure there are always scrollbars. |
| 853 int viewportWidth = 64; | 858 int viewportWidth = 64; |
| 854 int viewportHeight = 48; | 859 int viewportHeight = 48; |
| 855 | 860 |
| 856 m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "fixed_layout .html", true, 0, &client); | 861 m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "fixed_layout .html", true, 0, &client); |
| 857 m_webView->enableFixedLayoutMode(true); | 862 m_webView->enableFixedLayoutMode(true); |
| 863 m_webView->setLayoutSize(WebSize(viewportWidth, viewportHeight)); | |
| 858 m_webView->settings()->setViewportEnabled(true); | 864 m_webView->settings()->setViewportEnabled(true); |
| 859 m_webView->resize(WebSize(viewportWidth, viewportHeight)); | 865 m_webView->resize(WebSize(viewportWidth, viewportHeight)); |
| 860 m_webView->layout(); | 866 m_webView->layout(); |
| 861 | 867 |
| 862 WebCore::FrameView* view = webViewImpl()->mainFrameImpl()->frameView(); | 868 WebCore::FrameView* view = webViewImpl()->mainFrameImpl()->frameView(); |
| 863 int viewportWidthMinusScrollbar = viewportWidth - (view->verticalScrollbar() ->isOverlayScrollbar() ? 0 : 15); | 869 int viewportWidthMinusScrollbar = viewportWidth - (view->verticalScrollbar() ->isOverlayScrollbar() ? 0 : 15); |
| 864 int viewportHeightMinusScrollbar = viewportHeight - (view->horizontalScrollb ar()->isOverlayScrollbar() ? 0 : 15); | 870 int viewportHeightMinusScrollbar = viewportHeight - (view->horizontalScrollb ar()->isOverlayScrollbar() ? 0 : 15); |
| 865 | 871 |
| 866 m_webView->setPageScaleFactor(2, WebPoint()); | 872 m_webView->setPageScaleFactor(2, WebPoint()); |
| 867 | 873 |
| 868 WebCore::IntSize unscaledSize = view->unscaledVisibleContentSize(WebCore::Sc rollableArea::IncludeScrollbars); | 874 WebCore::IntSize unscaledSize = view->unscaledVisibleContentSize(WebCore::Sc rollableArea::IncludeScrollbars); |
| 869 EXPECT_EQ(viewportWidth, unscaledSize.width()); | 875 EXPECT_EQ(viewportWidth, unscaledSize.width()); |
| 870 EXPECT_EQ(viewportHeight, unscaledSize.height()); | 876 EXPECT_EQ(viewportHeight, unscaledSize.height()); |
| 871 | 877 |
| 872 WebCore::IntSize unscaledSizeMinusScrollbar = view->unscaledVisibleContentSi ze(WebCore::ScrollableArea::ExcludeScrollbars); | 878 WebCore::IntSize unscaledSizeMinusScrollbar = view->unscaledVisibleContentSi ze(WebCore::ScrollableArea::ExcludeScrollbars); |
| 873 EXPECT_EQ(viewportWidthMinusScrollbar, unscaledSizeMinusScrollbar.width()); | 879 EXPECT_EQ(viewportWidthMinusScrollbar, unscaledSizeMinusScrollbar.width()); |
| 874 EXPECT_EQ(viewportHeightMinusScrollbar, unscaledSizeMinusScrollbar.height()) ; | 880 EXPECT_EQ(viewportHeightMinusScrollbar, unscaledSizeMinusScrollbar.height()) ; |
| 875 | 881 |
| 876 WebCore::IntSize scaledSize = view->visibleContentRect().size(); | 882 WebCore::IntSize scaledSize = view->visibleContentRect().size(); |
| 877 EXPECT_EQ(ceil(viewportWidthMinusScrollbar / 2.0), scaledSize.width()); | 883 EXPECT_EQ(ceil(viewportWidthMinusScrollbar / 2.0), scaledSize.width()); |
| 878 EXPECT_EQ(ceil(viewportHeightMinusScrollbar / 2.0), scaledSize.height()); | 884 EXPECT_EQ(ceil(viewportHeightMinusScrollbar / 2.0), scaledSize.height()); |
| 879 } | 885 } |
| 880 | 886 |
| 881 TEST_F(WebFrameTest, pageScaleFactorDoesNotApplyCssTransform) | 887 TEST_F(WebFrameTest, pageScaleFactorDoesNotApplyCssTransform) |
| 882 { | 888 { |
| 889 // FIXME: This test currently fails because we assumed layout() wouldn't be called | |
| 890 // on resizes in fixed layout mode. Now that we've ripped out fixed layout m ode, | |
| 891 // that assumption is no longer true when we're trying to emulate that behav ior | |
| 883 registerMockedHttpURLLoad("fixed_layout.html"); | 892 registerMockedHttpURLLoad("fixed_layout.html"); |
| 884 | 893 |
| 885 FixedLayoutTestWebViewClient client; | 894 FixedLayoutTestWebViewClient client; |
| 886 client.m_screenInfo.deviceScaleFactor = 1; | 895 client.m_screenInfo.deviceScaleFactor = 1; |
| 887 int viewportWidth = 640; | 896 int viewportWidth = 640; |
| 888 int viewportHeight = 480; | 897 int viewportHeight = 480; |
| 889 | 898 |
| 890 m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "fixed_layout .html", true, 0, &client); | 899 m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "fixed_layout .html", true, 0, &client); |
| 891 m_webView->enableFixedLayoutMode(true); | 900 m_webView->enableFixedLayoutMode(true); |
| 892 m_webView->settings()->setViewportEnabled(true); | 901 m_webView->settings()->setViewportEnabled(true); |
| (...skipping 26 matching lines...) Expand all Loading... | |
| 919 | 928 |
| 920 m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "viewport -target-densitydpi-high.html", true, 0, &client); | 929 m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "viewport -target-densitydpi-high.html", true, 0, &client); |
| 921 m_webView->enableFixedLayoutMode(true); | 930 m_webView->enableFixedLayoutMode(true); |
| 922 m_webView->settings()->setViewportEnabled(true); | 931 m_webView->settings()->setViewportEnabled(true); |
| 923 m_webView->settings()->setSupportDeprecatedTargetDensityDPI(true); | 932 m_webView->settings()->setSupportDeprecatedTargetDensityDPI(true); |
| 924 m_webView->resize(WebSize(viewportWidth, viewportHeight)); | 933 m_webView->resize(WebSize(viewportWidth, viewportHeight)); |
| 925 | 934 |
| 926 // We need to account for the fact that logical pixels are unconditional ly multiplied by deviceScaleFactor to produce | 935 // We need to account for the fact that logical pixels are unconditional ly multiplied by deviceScaleFactor to produce |
| 927 // physical pixels. | 936 // physical pixels. |
| 928 float densityDpiScaleRatio = deviceScaleFactor * targetDpi / deviceDpi; | 937 float densityDpiScaleRatio = deviceScaleFactor * targetDpi / deviceDpi; |
| 929 EXPECT_NEAR(viewportWidth * densityDpiScaleRatio, m_webView->fixedLayout Size().width, 1.0f); | 938 WebCore::FrameView* view = webViewImpl()->mainFrameImpl()->frameView(); |
| 930 EXPECT_NEAR(viewportHeight * densityDpiScaleRatio, m_webView->fixedLayou tSize().height, 1.0f); | 939 EXPECT_NEAR(viewportWidth * densityDpiScaleRatio, view->layoutSize().wid th(), 1.0f); |
| 940 EXPECT_NEAR(viewportHeight * densityDpiScaleRatio, view->layoutSize().he ight(), 1.0f); | |
| 931 EXPECT_NEAR(1.0f / densityDpiScaleRatio, m_webView->pageScaleFactor(), 0 .01f); | 941 EXPECT_NEAR(1.0f / densityDpiScaleRatio, m_webView->pageScaleFactor(), 0 .01f); |
| 932 | 942 |
| 933 m_webView->close(); | 943 m_webView->close(); |
| 934 m_webView = 0; | 944 m_webView = 0; |
| 935 } | 945 } |
| 936 } | 946 } |
| 937 | 947 |
| 938 TEST_F(WebFrameTest, targetDensityDpiDevice) | 948 TEST_F(WebFrameTest, targetDensityDpiDevice) |
| 939 { | 949 { |
| 940 WebCore::Settings::setMockScrollbarsEnabled(true); | 950 WebCore::Settings::setMockScrollbarsEnabled(true); |
| 941 WebCore::Settings::setUsesOverlayScrollbars(true); | 951 WebCore::Settings::setUsesOverlayScrollbars(true); |
| 942 registerMockedHttpURLLoad("viewport-target-densitydpi-device.html"); | 952 registerMockedHttpURLLoad("viewport-target-densitydpi-device.html"); |
| 943 | 953 |
| 944 float deviceScaleFactors[] = { 1.0f, 4.0f / 3.0f, 2.0f }; | 954 float deviceScaleFactors[] = { 1.0f, 4.0f / 3.0f, 2.0f }; |
| 945 | 955 |
| 946 FixedLayoutTestWebViewClient client; | 956 FixedLayoutTestWebViewClient client; |
| 947 int viewportWidth = 640; | 957 int viewportWidth = 640; |
| 948 int viewportHeight = 480; | 958 int viewportHeight = 480; |
| 949 | 959 |
| 950 for (size_t i = 0; i < ARRAY_SIZE(deviceScaleFactors); ++i) { | 960 for (size_t i = 0; i < ARRAY_SIZE(deviceScaleFactors); ++i) { |
| 951 client.m_screenInfo.deviceScaleFactor = deviceScaleFactors[i]; | 961 client.m_screenInfo.deviceScaleFactor = deviceScaleFactors[i]; |
| 952 | 962 |
| 953 m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "viewport -target-densitydpi-device.html", true, 0, &client); | 963 m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "viewport -target-densitydpi-device.html", true, 0, &client); |
| 954 m_webView->enableFixedLayoutMode(true); | 964 m_webView->enableFixedLayoutMode(true); |
| 955 m_webView->settings()->setViewportEnabled(true); | 965 m_webView->settings()->setViewportEnabled(true); |
| 956 m_webView->settings()->setSupportDeprecatedTargetDensityDPI(true); | 966 m_webView->settings()->setSupportDeprecatedTargetDensityDPI(true); |
| 957 m_webView->resize(WebSize(viewportWidth, viewportHeight)); | 967 m_webView->resize(WebSize(viewportWidth, viewportHeight)); |
| 958 | 968 |
| 959 EXPECT_NEAR(viewportWidth * client.m_screenInfo.deviceScaleFactor, m_web View->fixedLayoutSize().width, 1.0f); | 969 WebCore::FrameView* view = webViewImpl()->mainFrameImpl()->frameView(); |
| 960 EXPECT_NEAR(viewportHeight * client.m_screenInfo.deviceScaleFactor, m_we bView->fixedLayoutSize().height, 1.0f); | 970 EXPECT_NEAR(viewportWidth * client.m_screenInfo.deviceScaleFactor, view- >layoutSize().width(), 1.0f); |
| 971 EXPECT_NEAR(viewportHeight * client.m_screenInfo.deviceScaleFactor, view ->layoutSize().height(), 1.0f); | |
| 961 EXPECT_NEAR(1.0f / client.m_screenInfo.deviceScaleFactor, m_webView->pag eScaleFactor(), 0.01f); | 972 EXPECT_NEAR(1.0f / client.m_screenInfo.deviceScaleFactor, m_webView->pag eScaleFactor(), 0.01f); |
| 962 | 973 |
| 963 m_webView->close(); | 974 m_webView->close(); |
| 964 m_webView = 0; | 975 m_webView = 0; |
| 965 } | 976 } |
| 966 } | 977 } |
| 967 | 978 |
| 968 class WebFrameResizeTest : public WebFrameTest { | 979 class WebFrameResizeTest : public WebFrameTest { |
| 969 protected: | 980 protected: |
| 970 | 981 |
| (...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1296 TEST_F(WebFrameTest, DivAutoZoomWideDivTest) | 1307 TEST_F(WebFrameTest, DivAutoZoomWideDivTest) |
| 1297 { | 1308 { |
| 1298 registerMockedHttpURLLoad("get_wide_div_for_auto_zoom_test.html"); | 1309 registerMockedHttpURLLoad("get_wide_div_for_auto_zoom_test.html"); |
| 1299 | 1310 |
| 1300 const float deviceScaleFactor = 2.0f; | 1311 const float deviceScaleFactor = 2.0f; |
| 1301 int viewportWidth = 640 / deviceScaleFactor; | 1312 int viewportWidth = 640 / deviceScaleFactor; |
| 1302 int viewportHeight = 1280 / deviceScaleFactor; | 1313 int viewportHeight = 1280 / deviceScaleFactor; |
| 1303 float doubleTapZoomAlreadyLegibleRatio = 1.2f; | 1314 float doubleTapZoomAlreadyLegibleRatio = 1.2f; |
| 1304 m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "get_wide_div _for_auto_zoom_test.html"); | 1315 m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "get_wide_div _for_auto_zoom_test.html"); |
| 1305 m_webView->enableFixedLayoutMode(true); | 1316 m_webView->enableFixedLayoutMode(true); |
| 1317 m_webView->setFixedLayoutSize(WebSize(viewportWidth, viewportHeight)); | |
| 1306 m_webView->resize(WebSize(viewportWidth, viewportHeight)); | 1318 m_webView->resize(WebSize(viewportWidth, viewportHeight)); |
| 1307 m_webView->setPageScaleFactorLimits(1.0f, 4); | 1319 m_webView->setPageScaleFactorLimits(1.0f, 4); |
| 1308 m_webView->setDeviceScaleFactor(deviceScaleFactor); | 1320 m_webView->setDeviceScaleFactor(deviceScaleFactor); |
| 1309 m_webView->setPageScaleFactor(1.0f, WebPoint(0, 0)); | 1321 m_webView->setPageScaleFactor(1.0f, WebPoint(0, 0)); |
| 1310 m_webView->layout(); | 1322 m_webView->layout(); |
| 1311 | 1323 |
| 1312 webViewImpl()->enableFakePageScaleAnimationForTesting(true); | 1324 webViewImpl()->enableFakePageScaleAnimationForTesting(true); |
| 1313 | 1325 |
| 1314 float doubleTapZoomAlreadyLegibleScale = webViewImpl()->minimumPageScaleFact or() * doubleTapZoomAlreadyLegibleRatio; | 1326 float doubleTapZoomAlreadyLegibleScale = webViewImpl()->minimumPageScaleFact or() * doubleTapZoomAlreadyLegibleRatio; |
| 1315 | 1327 |
| (...skipping 2362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3678 m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "push_state.h tml", true, 0, &client); | 3690 m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "push_state.h tml", true, 0, &client); |
| 3679 runPendingTasks(); | 3691 runPendingTasks(); |
| 3680 | 3692 |
| 3681 EXPECT_EQ(client.startLoadingCount(), 2); | 3693 EXPECT_EQ(client.startLoadingCount(), 2); |
| 3682 EXPECT_EQ(client.stopLoadingCount(), 2); | 3694 EXPECT_EQ(client.stopLoadingCount(), 2); |
| 3683 m_webView->close(); | 3695 m_webView->close(); |
| 3684 m_webView = 0; | 3696 m_webView = 0; |
| 3685 } | 3697 } |
| 3686 | 3698 |
| 3687 } // namespace | 3699 } // namespace |
| OLD | NEW |