| 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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 #include "web/tests/FrameTestHelpers.h" | 124 #include "web/tests/FrameTestHelpers.h" |
| 125 #include "wtf/Forward.h" | 125 #include "wtf/Forward.h" |
| 126 #include "wtf/dtoa/utils.h" | 126 #include "wtf/dtoa/utils.h" |
| 127 #include <gmock/gmock.h> | 127 #include <gmock/gmock.h> |
| 128 #include <gtest/gtest.h> | 128 #include <gtest/gtest.h> |
| 129 #include <map> | 129 #include <map> |
| 130 #include <stdarg.h> | 130 #include <stdarg.h> |
| 131 #include <v8.h> | 131 #include <v8.h> |
| 132 | 132 |
| 133 using blink::URLTestHelpers::toKURL; | 133 using blink::URLTestHelpers::toKURL; |
| 134 using blink::FrameTestHelpers::UseMockScrollbarSettings; | |
| 135 using blink::testing::runPendingTasks; | 134 using blink::testing::runPendingTasks; |
| 136 using testing::ElementsAre; | 135 using testing::ElementsAre; |
| 137 using testing::Mock; | 136 using testing::Mock; |
| 138 using testing::_; | 137 using testing::_; |
| 139 | 138 |
| 140 namespace blink { | 139 namespace blink { |
| 141 | 140 |
| 142 ::std::ostream& operator<<(::std::ostream& os, const WebFloatSize& size) | 141 ::std::ostream& operator<<(::std::ostream& os, const WebFloatSize& size) |
| 143 { | 142 { |
| 144 return os << "WebFloatSize: [" | 143 return os << "WebFloatSize: [" |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 void removeElementById(WebLocalFrameImpl* frame, const AtomicString& id) | 265 void removeElementById(WebLocalFrameImpl* frame, const AtomicString& id) |
| 267 { | 266 { |
| 268 Element* element = frame->frame()->document()->getElementById(id); | 267 Element* element = frame->frame()->document()->getElementById(id); |
| 269 ASSERT(element); | 268 ASSERT(element); |
| 270 element->remove(); | 269 element->remove(); |
| 271 } | 270 } |
| 272 | 271 |
| 273 std::string m_baseURL; | 272 std::string m_baseURL; |
| 274 std::string m_notBaseURL; | 273 std::string m_notBaseURL; |
| 275 std::string m_chromeURL; | 274 std::string m_chromeURL; |
| 275 FrameTestHelpers::UseMockScrollbarSettings m_mockScrollbarSettings; |
| 276 }; | 276 }; |
| 277 | 277 |
| 278 enum ParameterizedWebFrameTestConfig { | 278 enum ParameterizedWebFrameTestConfig { |
| 279 Default, | 279 Default, |
| 280 RootLayerScrolls | 280 RootLayerScrolls |
| 281 }; | 281 }; |
| 282 | 282 |
| 283 class ParameterizedWebFrameTest | 283 class ParameterizedWebFrameTest |
| 284 : public WebFrameTest | 284 : public WebFrameTest |
| 285 , public ::testing::WithParamInterface<ParameterizedWebFrameTestConfig> | 285 , public ::testing::WithParamInterface<ParameterizedWebFrameTestConfig> |
| (...skipping 618 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 904 multiplierChecked = true; | 904 multiplierChecked = true; |
| 905 } | 905 } |
| 906 } | 906 } |
| 907 return multiplierChecked; | 907 return multiplierChecked; |
| 908 } | 908 } |
| 909 | 909 |
| 910 } // anonymous namespace | 910 } // anonymous namespace |
| 911 | 911 |
| 912 TEST_P(ParameterizedWebFrameTest, ChangeInFixedLayoutResetsTextAutosizingMultipl
iers) | 912 TEST_P(ParameterizedWebFrameTest, ChangeInFixedLayoutResetsTextAutosizingMultipl
iers) |
| 913 { | 913 { |
| 914 UseMockScrollbarSettings mockScrollbarSettings; | |
| 915 registerMockedHttpURLLoad("fixed_layout.html"); | 914 registerMockedHttpURLLoad("fixed_layout.html"); |
| 916 | 915 |
| 917 FixedLayoutTestWebViewClient client; | 916 FixedLayoutTestWebViewClient client; |
| 918 int viewportWidth = 640; | 917 int viewportWidth = 640; |
| 919 int viewportHeight = 480; | 918 int viewportHeight = 480; |
| 920 | 919 |
| 921 FrameTestHelpers::WebViewHelper webViewHelper(this); | 920 FrameTestHelpers::WebViewHelper webViewHelper(this); |
| 922 webViewHelper.initializeAndLoad(m_baseURL + "fixed_layout.html", true, 0, &c
lient, enableViewportSettings); | 921 webViewHelper.initializeAndLoad(m_baseURL + "fixed_layout.html", true, 0, &c
lient, enableViewportSettings); |
| 923 | 922 |
| 924 Document* document = toLocalFrame(webViewHelper.webViewImpl()->page()->mainF
rame())->document(); | 923 Document* document = toLocalFrame(webViewHelper.webViewImpl()->page()->mainF
rame())->document(); |
| 925 document->settings()->setTextAutosizingEnabled(true); | 924 document->settings()->setTextAutosizingEnabled(true); |
| 926 EXPECT_TRUE(document->settings()->textAutosizingEnabled()); | 925 EXPECT_TRUE(document->settings()->textAutosizingEnabled()); |
| 927 webViewHelper.webViewImpl()->resize(WebSize(viewportWidth, viewportHeight)); | 926 webViewHelper.webViewImpl()->resize(WebSize(viewportWidth, viewportHeight)); |
| 928 webViewHelper.webViewImpl()->layout(); | 927 webViewHelper.webViewImpl()->layout(); |
| 929 | 928 |
| 930 EXPECT_TRUE(setTextAutosizingMultiplier(document, 2)); | 929 EXPECT_TRUE(setTextAutosizingMultiplier(document, 2)); |
| 931 | 930 |
| 932 ViewportDescription description = document->viewportDescription(); | 931 ViewportDescription description = document->viewportDescription(); |
| 933 // Choose a width that's not going match the viewport width of the loaded do
cument. | 932 // Choose a width that's not going match the viewport width of the loaded do
cument. |
| 934 description.minWidth = Length(100, blink::Fixed); | 933 description.minWidth = Length(100, blink::Fixed); |
| 935 description.maxWidth = Length(100, blink::Fixed); | 934 description.maxWidth = Length(100, blink::Fixed); |
| 936 webViewHelper.webViewImpl()->updatePageDefinedViewportConstraints(descriptio
n); | 935 webViewHelper.webViewImpl()->updatePageDefinedViewportConstraints(descriptio
n); |
| 937 | 936 |
| 938 EXPECT_TRUE(checkTextAutosizingMultiplier(document, 1)); | 937 EXPECT_TRUE(checkTextAutosizingMultiplier(document, 1)); |
| 939 } | 938 } |
| 940 | 939 |
| 941 TEST_P(ParameterizedWebFrameTest, WorkingTextAutosizingMultipliers_VirtualViewpo
rt) | 940 TEST_P(ParameterizedWebFrameTest, WorkingTextAutosizingMultipliers_VirtualViewpo
rt) |
| 942 { | 941 { |
| 943 UseMockScrollbarSettings mockScrollbarSettings; | |
| 944 const std::string htmlFile = "fixed_layout.html"; | 942 const std::string htmlFile = "fixed_layout.html"; |
| 945 registerMockedHttpURLLoad(htmlFile); | 943 registerMockedHttpURLLoad(htmlFile); |
| 946 | 944 |
| 947 FixedLayoutTestWebViewClient client; | 945 FixedLayoutTestWebViewClient client; |
| 948 | 946 |
| 949 FrameTestHelpers::WebViewHelper webViewHelper(this); | 947 FrameTestHelpers::WebViewHelper webViewHelper(this); |
| 950 webViewHelper.initializeAndLoad(m_baseURL + htmlFile, true, 0, &client, conf
igureAndroid); | 948 webViewHelper.initializeAndLoad(m_baseURL + htmlFile, true, 0, &client, conf
igureAndroid); |
| 951 | 949 |
| 952 Document* document = toLocalFrame(webViewHelper.webViewImpl()->page()->mainF
rame())->document(); | 950 Document* document = toLocalFrame(webViewHelper.webViewImpl()->page()->mainF
rame())->document(); |
| 953 document->settings()->setTextAutosizingEnabled(true); | 951 document->settings()->setTextAutosizingEnabled(true); |
| 954 EXPECT_TRUE(document->settings()->textAutosizingEnabled()); | 952 EXPECT_TRUE(document->settings()->textAutosizingEnabled()); |
| 955 | 953 |
| 956 webViewHelper.webView()->resize(WebSize(490, 800)); | 954 webViewHelper.webView()->resize(WebSize(490, 800)); |
| 957 | 955 |
| 958 // Multiplier: 980 / 490 = 2.0 | 956 // Multiplier: 980 / 490 = 2.0 |
| 959 EXPECT_TRUE(checkTextAutosizingMultiplier(document, 2.0)); | 957 EXPECT_TRUE(checkTextAutosizingMultiplier(document, 2.0)); |
| 960 } | 958 } |
| 961 | 959 |
| 962 TEST_P(ParameterizedWebFrameTest, VisualViewportSetSizeInvalidatesTextAutosizing
Multipliers) | 960 TEST_P(ParameterizedWebFrameTest, VisualViewportSetSizeInvalidatesTextAutosizing
Multipliers) |
| 963 { | 961 { |
| 964 UseMockScrollbarSettings mockScrollbarSettings; | |
| 965 registerMockedHttpURLLoad("iframe_reload.html"); | 962 registerMockedHttpURLLoad("iframe_reload.html"); |
| 966 registerMockedHttpURLLoad("visible_iframe.html"); | 963 registerMockedHttpURLLoad("visible_iframe.html"); |
| 967 | 964 |
| 968 FixedLayoutTestWebViewClient client; | 965 FixedLayoutTestWebViewClient client; |
| 969 int viewportWidth = 640; | 966 int viewportWidth = 640; |
| 970 int viewportHeight = 480; | 967 int viewportHeight = 480; |
| 971 | 968 |
| 972 FrameTestHelpers::WebViewHelper webViewHelper(this); | 969 FrameTestHelpers::WebViewHelper webViewHelper(this); |
| 973 webViewHelper.initializeAndLoad(m_baseURL + "iframe_reload.html", true, 0, &
client, enableViewportSettings); | 970 webViewHelper.initializeAndLoad(m_baseURL + "iframe_reload.html", true, 0, &
client, enableViewportSettings); |
| 974 | 971 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 997 continue; | 994 continue; |
| 998 for (LayoutObject* layoutObject = toLocalFrame(frame)->document()->layou
tView(); layoutObject; layoutObject = layoutObject->nextInPreOrder()) { | 995 for (LayoutObject* layoutObject = toLocalFrame(frame)->document()->layou
tView(); layoutObject; layoutObject = layoutObject->nextInPreOrder()) { |
| 999 if (layoutObject->isText()) | 996 if (layoutObject->isText()) |
| 1000 EXPECT_TRUE(layoutObject->needsLayout()); | 997 EXPECT_TRUE(layoutObject->needsLayout()); |
| 1001 } | 998 } |
| 1002 } | 999 } |
| 1003 } | 1000 } |
| 1004 | 1001 |
| 1005 TEST_P(ParameterizedWebFrameTest, ZeroHeightPositiveWidthNotIgnored) | 1002 TEST_P(ParameterizedWebFrameTest, ZeroHeightPositiveWidthNotIgnored) |
| 1006 { | 1003 { |
| 1007 UseMockScrollbarSettings mockScrollbarSettings; | |
| 1008 | |
| 1009 FixedLayoutTestWebViewClient client; | 1004 FixedLayoutTestWebViewClient client; |
| 1010 client.m_screenInfo.deviceScaleFactor = 1; | 1005 client.m_screenInfo.deviceScaleFactor = 1; |
| 1011 int viewportWidth = 1280; | 1006 int viewportWidth = 1280; |
| 1012 int viewportHeight = 0; | 1007 int viewportHeight = 0; |
| 1013 | 1008 |
| 1014 FrameTestHelpers::WebViewHelper webViewHelper(this); | 1009 FrameTestHelpers::WebViewHelper webViewHelper(this); |
| 1015 webViewHelper.initialize(true, 0, &client, enableViewportSettings); | 1010 webViewHelper.initialize(true, 0, &client, enableViewportSettings); |
| 1016 webViewHelper.webView()->resize(WebSize(viewportWidth, viewportHeight)); | 1011 webViewHelper.webView()->resize(WebSize(viewportWidth, viewportHeight)); |
| 1017 | 1012 |
| 1018 EXPECT_EQ(viewportWidth, webViewHelper.webViewImpl()->mainFrameImpl()->frame
View()->layoutSize().width()); | 1013 EXPECT_EQ(viewportWidth, webViewHelper.webViewImpl()->mainFrameImpl()->frame
View()->layoutSize().width()); |
| 1019 EXPECT_EQ(viewportHeight, webViewHelper.webViewImpl()->mainFrameImpl()->fram
eView()->layoutSize().height()); | 1014 EXPECT_EQ(viewportHeight, webViewHelper.webViewImpl()->mainFrameImpl()->fram
eView()->layoutSize().height()); |
| 1020 } | 1015 } |
| 1021 | 1016 |
| 1022 TEST_P(ParameterizedWebFrameTest, DeviceScaleFactorUsesDefaultWithoutViewportTag
) | 1017 TEST_P(ParameterizedWebFrameTest, DeviceScaleFactorUsesDefaultWithoutViewportTag
) |
| 1023 { | 1018 { |
| 1024 UseMockScrollbarSettings mockScrollbarSettings; | |
| 1025 registerMockedHttpURLLoad("no_viewport_tag.html"); | 1019 registerMockedHttpURLLoad("no_viewport_tag.html"); |
| 1026 | 1020 |
| 1027 int viewportWidth = 640; | 1021 int viewportWidth = 640; |
| 1028 int viewportHeight = 480; | 1022 int viewportHeight = 480; |
| 1029 | 1023 |
| 1030 FixedLayoutTestWebViewClient client; | 1024 FixedLayoutTestWebViewClient client; |
| 1031 client.m_screenInfo.deviceScaleFactor = 2; | 1025 client.m_screenInfo.deviceScaleFactor = 2; |
| 1032 | 1026 |
| 1033 FrameTestHelpers::WebViewHelper webViewHelper(this); | 1027 FrameTestHelpers::WebViewHelper webViewHelper(this); |
| 1034 webViewHelper.initializeAndLoad(m_baseURL + "no_viewport_tag.html", true, 0,
&client, enableViewportSettings); | 1028 webViewHelper.initializeAndLoad(m_baseURL + "no_viewport_tag.html", true, 0,
&client, enableViewportSettings); |
| 1035 | 1029 |
| 1036 webViewHelper.webView()->resize(WebSize(viewportWidth, viewportHeight)); | 1030 webViewHelper.webView()->resize(WebSize(viewportWidth, viewportHeight)); |
| 1037 webViewHelper.webView()->layout(); | 1031 webViewHelper.webView()->layout(); |
| 1038 | 1032 |
| 1039 EXPECT_EQ(2, webViewHelper.webView()->deviceScaleFactor()); | 1033 EXPECT_EQ(2, webViewHelper.webView()->deviceScaleFactor()); |
| 1040 | 1034 |
| 1041 // Device scale factor should be independent of page scale. | 1035 // Device scale factor should be independent of page scale. |
| 1042 webViewHelper.webView()->setDefaultPageScaleLimits(1, 2); | 1036 webViewHelper.webView()->setDefaultPageScaleLimits(1, 2); |
| 1043 webViewHelper.webView()->setPageScaleFactor(0.5); | 1037 webViewHelper.webView()->setPageScaleFactor(0.5); |
| 1044 webViewHelper.webView()->layout(); | 1038 webViewHelper.webView()->layout(); |
| 1045 EXPECT_EQ(1, webViewHelper.webView()->pageScaleFactor()); | 1039 EXPECT_EQ(1, webViewHelper.webView()->pageScaleFactor()); |
| 1046 | 1040 |
| 1047 // Force the layout to happen before leaving the test. | 1041 // Force the layout to happen before leaving the test. |
| 1048 webViewHelper.webView()->mainFrame()->contentAsText(1024).utf8(); | 1042 webViewHelper.webView()->mainFrame()->contentAsText(1024).utf8(); |
| 1049 } | 1043 } |
| 1050 | 1044 |
| 1051 TEST_P(ParameterizedWebFrameTest, FixedLayoutInitializeAtMinimumScale) | 1045 TEST_P(ParameterizedWebFrameTest, FixedLayoutInitializeAtMinimumScale) |
| 1052 { | 1046 { |
| 1053 UseMockScrollbarSettings mockScrollbarSettings; | |
| 1054 | |
| 1055 registerMockedHttpURLLoad("fixed_layout.html"); | 1047 registerMockedHttpURLLoad("fixed_layout.html"); |
| 1056 | 1048 |
| 1057 FixedLayoutTestWebViewClient client; | 1049 FixedLayoutTestWebViewClient client; |
| 1058 client.m_screenInfo.deviceScaleFactor = 1; | 1050 client.m_screenInfo.deviceScaleFactor = 1; |
| 1059 int viewportWidth = 640; | 1051 int viewportWidth = 640; |
| 1060 int viewportHeight = 480; | 1052 int viewportHeight = 480; |
| 1061 | 1053 |
| 1062 // Make sure we initialize to minimum scale, even if the window size | 1054 // Make sure we initialize to minimum scale, even if the window size |
| 1063 // only becomes available after the load begins. | 1055 // only becomes available after the load begins. |
| 1064 FrameTestHelpers::WebViewHelper webViewHelper(this); | 1056 FrameTestHelpers::WebViewHelper webViewHelper(this); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 1082 webViewHelper.webViewImpl()->didChangeContentsSize(); | 1074 webViewHelper.webViewImpl()->didChangeContentsSize(); |
| 1083 EXPECT_EQ(userPinchPageScaleFactor, webViewHelper.webView()->pageScaleFactor
()); | 1075 EXPECT_EQ(userPinchPageScaleFactor, webViewHelper.webView()->pageScaleFactor
()); |
| 1084 | 1076 |
| 1085 // Make sure we don't reset to initial scale if the viewport size changes. | 1077 // Make sure we don't reset to initial scale if the viewport size changes. |
| 1086 webViewHelper.webView()->resize(WebSize(viewportWidth, viewportHeight + 100)
); | 1078 webViewHelper.webView()->resize(WebSize(viewportWidth, viewportHeight + 100)
); |
| 1087 EXPECT_EQ(userPinchPageScaleFactor, webViewHelper.webView()->pageScaleFactor
()); | 1079 EXPECT_EQ(userPinchPageScaleFactor, webViewHelper.webView()->pageScaleFactor
()); |
| 1088 } | 1080 } |
| 1089 | 1081 |
| 1090 TEST_P(ParameterizedWebFrameTest, WideDocumentInitializeAtMinimumScale) | 1082 TEST_P(ParameterizedWebFrameTest, WideDocumentInitializeAtMinimumScale) |
| 1091 { | 1083 { |
| 1092 UseMockScrollbarSettings mockScrollbarSettings; | |
| 1093 | |
| 1094 registerMockedHttpURLLoad("wide_document.html"); | 1084 registerMockedHttpURLLoad("wide_document.html"); |
| 1095 | 1085 |
| 1096 FixedLayoutTestWebViewClient client; | 1086 FixedLayoutTestWebViewClient client; |
| 1097 client.m_screenInfo.deviceScaleFactor = 1; | 1087 client.m_screenInfo.deviceScaleFactor = 1; |
| 1098 int viewportWidth = 640; | 1088 int viewportWidth = 640; |
| 1099 int viewportHeight = 480; | 1089 int viewportHeight = 480; |
| 1100 | 1090 |
| 1101 // Make sure we initialize to minimum scale, even if the window size | 1091 // Make sure we initialize to minimum scale, even if the window size |
| 1102 // only becomes available after the load begins. | 1092 // only becomes available after the load begins. |
| 1103 FrameTestHelpers::WebViewHelper webViewHelper(this); | 1093 FrameTestHelpers::WebViewHelper webViewHelper(this); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 1121 webViewHelper.webViewImpl()->didChangeContentsSize(); | 1111 webViewHelper.webViewImpl()->didChangeContentsSize(); |
| 1122 EXPECT_EQ(userPinchPageScaleFactor, webViewHelper.webView()->pageScaleFactor
()); | 1112 EXPECT_EQ(userPinchPageScaleFactor, webViewHelper.webView()->pageScaleFactor
()); |
| 1123 | 1113 |
| 1124 // Make sure we don't reset to initial scale if the viewport size changes. | 1114 // Make sure we don't reset to initial scale if the viewport size changes. |
| 1125 webViewHelper.webView()->resize(WebSize(viewportWidth, viewportHeight + 100)
); | 1115 webViewHelper.webView()->resize(WebSize(viewportWidth, viewportHeight + 100)
); |
| 1126 EXPECT_EQ(userPinchPageScaleFactor, webViewHelper.webView()->pageScaleFactor
()); | 1116 EXPECT_EQ(userPinchPageScaleFactor, webViewHelper.webView()->pageScaleFactor
()); |
| 1127 } | 1117 } |
| 1128 | 1118 |
| 1129 TEST_P(ParameterizedWebFrameTest, DelayedViewportInitialScale) | 1119 TEST_P(ParameterizedWebFrameTest, DelayedViewportInitialScale) |
| 1130 { | 1120 { |
| 1131 UseMockScrollbarSettings mockScrollbarSettings; | |
| 1132 registerMockedHttpURLLoad("viewport-auto-initial-scale.html"); | 1121 registerMockedHttpURLLoad("viewport-auto-initial-scale.html"); |
| 1133 | 1122 |
| 1134 FixedLayoutTestWebViewClient client; | 1123 FixedLayoutTestWebViewClient client; |
| 1135 client.m_screenInfo.deviceScaleFactor = 1; | 1124 client.m_screenInfo.deviceScaleFactor = 1; |
| 1136 int viewportWidth = 640; | 1125 int viewportWidth = 640; |
| 1137 int viewportHeight = 480; | 1126 int viewportHeight = 480; |
| 1138 | 1127 |
| 1139 FrameTestHelpers::WebViewHelper webViewHelper(this); | 1128 FrameTestHelpers::WebViewHelper webViewHelper(this); |
| 1140 webViewHelper.initializeAndLoad(m_baseURL + "viewport-auto-initial-scale.htm
l", true, 0, &client, enableViewportSettings); | 1129 webViewHelper.initializeAndLoad(m_baseURL + "viewport-auto-initial-scale.htm
l", true, 0, &client, enableViewportSettings); |
| 1141 webViewHelper.webView()->resize(WebSize(viewportWidth, viewportHeight)); | 1130 webViewHelper.webView()->resize(WebSize(viewportWidth, viewportHeight)); |
| 1142 | 1131 |
| 1143 EXPECT_EQ(0.25f, webViewHelper.webView()->pageScaleFactor()); | 1132 EXPECT_EQ(0.25f, webViewHelper.webView()->pageScaleFactor()); |
| 1144 | 1133 |
| 1145 Document* document = toLocalFrame(webViewHelper.webViewImpl()->page()->mainF
rame())->document(); | 1134 Document* document = toLocalFrame(webViewHelper.webViewImpl()->page()->mainF
rame())->document(); |
| 1146 ViewportDescription description = document->viewportDescription(); | 1135 ViewportDescription description = document->viewportDescription(); |
| 1147 description.zoom = 2; | 1136 description.zoom = 2; |
| 1148 document->setViewportDescription(description); | 1137 document->setViewportDescription(description); |
| 1149 webViewHelper.webView()->layout(); | 1138 webViewHelper.webView()->layout(); |
| 1150 EXPECT_EQ(2, webViewHelper.webView()->pageScaleFactor()); | 1139 EXPECT_EQ(2, webViewHelper.webView()->pageScaleFactor()); |
| 1151 } | 1140 } |
| 1152 | 1141 |
| 1153 TEST_P(ParameterizedWebFrameTest, setLoadWithOverviewModeToFalse) | 1142 TEST_P(ParameterizedWebFrameTest, setLoadWithOverviewModeToFalse) |
| 1154 { | 1143 { |
| 1155 UseMockScrollbarSettings mockScrollbarSettings; | |
| 1156 registerMockedHttpURLLoad("viewport-auto-initial-scale.html"); | 1144 registerMockedHttpURLLoad("viewport-auto-initial-scale.html"); |
| 1157 | 1145 |
| 1158 FixedLayoutTestWebViewClient client; | 1146 FixedLayoutTestWebViewClient client; |
| 1159 client.m_screenInfo.deviceScaleFactor = 1; | 1147 client.m_screenInfo.deviceScaleFactor = 1; |
| 1160 int viewportWidth = 640; | 1148 int viewportWidth = 640; |
| 1161 int viewportHeight = 480; | 1149 int viewportHeight = 480; |
| 1162 | 1150 |
| 1163 FrameTestHelpers::WebViewHelper webViewHelper(this); | 1151 FrameTestHelpers::WebViewHelper webViewHelper(this); |
| 1164 webViewHelper.initializeAndLoad(m_baseURL + "viewport-auto-initial-scale.htm
l", true, 0, &client, enableViewportSettings); | 1152 webViewHelper.initializeAndLoad(m_baseURL + "viewport-auto-initial-scale.htm
l", true, 0, &client, enableViewportSettings); |
| 1165 webViewHelper.webView()->settings()->setWideViewportQuirkEnabled(true); | 1153 webViewHelper.webView()->settings()->setWideViewportQuirkEnabled(true); |
| 1166 webViewHelper.webView()->settings()->setLoadWithOverviewMode(false); | 1154 webViewHelper.webView()->settings()->setLoadWithOverviewMode(false); |
| 1167 webViewHelper.webView()->resize(WebSize(viewportWidth, viewportHeight)); | 1155 webViewHelper.webView()->resize(WebSize(viewportWidth, viewportHeight)); |
| 1168 | 1156 |
| 1169 // The page must be displayed at 100% zoom. | 1157 // The page must be displayed at 100% zoom. |
| 1170 EXPECT_EQ(1.0f, webViewHelper.webView()->pageScaleFactor()); | 1158 EXPECT_EQ(1.0f, webViewHelper.webView()->pageScaleFactor()); |
| 1171 } | 1159 } |
| 1172 | 1160 |
| 1173 TEST_P(ParameterizedWebFrameTest, SetLoadWithOverviewModeToFalseAndNoWideViewpor
t) | 1161 TEST_P(ParameterizedWebFrameTest, SetLoadWithOverviewModeToFalseAndNoWideViewpor
t) |
| 1174 { | 1162 { |
| 1175 UseMockScrollbarSettings mockScrollbarSettings; | |
| 1176 registerMockedHttpURLLoad("large-div.html"); | 1163 registerMockedHttpURLLoad("large-div.html"); |
| 1177 | 1164 |
| 1178 FixedLayoutTestWebViewClient client; | 1165 FixedLayoutTestWebViewClient client; |
| 1179 client.m_screenInfo.deviceScaleFactor = 1; | 1166 client.m_screenInfo.deviceScaleFactor = 1; |
| 1180 int viewportWidth = 640; | 1167 int viewportWidth = 640; |
| 1181 int viewportHeight = 480; | 1168 int viewportHeight = 480; |
| 1182 | 1169 |
| 1183 FrameTestHelpers::WebViewHelper webViewHelper(this); | 1170 FrameTestHelpers::WebViewHelper webViewHelper(this); |
| 1184 webViewHelper.initializeAndLoad(m_baseURL + "large-div.html", true, 0, &clie
nt, enableViewportSettings); | 1171 webViewHelper.initializeAndLoad(m_baseURL + "large-div.html", true, 0, &clie
nt, enableViewportSettings); |
| 1185 webViewHelper.webView()->settings()->setLoadWithOverviewMode(false); | 1172 webViewHelper.webView()->settings()->setLoadWithOverviewMode(false); |
| 1186 webViewHelper.webView()->settings()->setWideViewportQuirkEnabled(true); | 1173 webViewHelper.webView()->settings()->setWideViewportQuirkEnabled(true); |
| 1187 webViewHelper.webView()->settings()->setUseWideViewport(false); | 1174 webViewHelper.webView()->settings()->setUseWideViewport(false); |
| 1188 webViewHelper.webView()->resize(WebSize(viewportWidth, viewportHeight)); | 1175 webViewHelper.webView()->resize(WebSize(viewportWidth, viewportHeight)); |
| 1189 | 1176 |
| 1190 // The page must be displayed at 100% zoom, despite that it hosts a wide div
element. | 1177 // The page must be displayed at 100% zoom, despite that it hosts a wide div
element. |
| 1191 EXPECT_EQ(1.0f, webViewHelper.webView()->pageScaleFactor()); | 1178 EXPECT_EQ(1.0f, webViewHelper.webView()->pageScaleFactor()); |
| 1192 } | 1179 } |
| 1193 | 1180 |
| 1194 TEST_P(ParameterizedWebFrameTest, NoWideViewportIgnoresPageViewportWidth) | 1181 TEST_P(ParameterizedWebFrameTest, NoWideViewportIgnoresPageViewportWidth) |
| 1195 { | 1182 { |
| 1196 UseMockScrollbarSettings mockScrollbarSettings; | |
| 1197 registerMockedHttpURLLoad("viewport-auto-initial-scale.html"); | 1183 registerMockedHttpURLLoad("viewport-auto-initial-scale.html"); |
| 1198 | 1184 |
| 1199 FixedLayoutTestWebViewClient client; | 1185 FixedLayoutTestWebViewClient client; |
| 1200 client.m_screenInfo.deviceScaleFactor = 1; | 1186 client.m_screenInfo.deviceScaleFactor = 1; |
| 1201 int viewportWidth = 640; | 1187 int viewportWidth = 640; |
| 1202 int viewportHeight = 480; | 1188 int viewportHeight = 480; |
| 1203 | 1189 |
| 1204 FrameTestHelpers::WebViewHelper webViewHelper(this); | 1190 FrameTestHelpers::WebViewHelper webViewHelper(this); |
| 1205 webViewHelper.initializeAndLoad(m_baseURL + "viewport-auto-initial-scale.htm
l", true, 0, &client, enableViewportSettings); | 1191 webViewHelper.initializeAndLoad(m_baseURL + "viewport-auto-initial-scale.htm
l", true, 0, &client, enableViewportSettings); |
| 1206 webViewHelper.webView()->settings()->setWideViewportQuirkEnabled(true); | 1192 webViewHelper.webView()->settings()->setWideViewportQuirkEnabled(true); |
| 1207 webViewHelper.webView()->settings()->setUseWideViewport(false); | 1193 webViewHelper.webView()->settings()->setUseWideViewport(false); |
| 1208 webViewHelper.webView()->resize(WebSize(viewportWidth, viewportHeight)); | 1194 webViewHelper.webView()->resize(WebSize(viewportWidth, viewportHeight)); |
| 1209 | 1195 |
| 1210 // The page sets viewport width to 3000, but with UseWideViewport == false i
s must be ignored. | 1196 // The page sets viewport width to 3000, but with UseWideViewport == false i
s must be ignored. |
| 1211 EXPECT_EQ(viewportWidth, webViewHelper.webViewImpl()->mainFrameImpl()->frame
View()->contentsSize().width()); | 1197 EXPECT_EQ(viewportWidth, webViewHelper.webViewImpl()->mainFrameImpl()->frame
View()->contentsSize().width()); |
| 1212 EXPECT_EQ(viewportHeight, webViewHelper.webViewImpl()->mainFrameImpl()->fram
eView()->contentsSize().height()); | 1198 EXPECT_EQ(viewportHeight, webViewHelper.webViewImpl()->mainFrameImpl()->fram
eView()->contentsSize().height()); |
| 1213 } | 1199 } |
| 1214 | 1200 |
| 1215 TEST_P(ParameterizedWebFrameTest, NoWideViewportIgnoresPageViewportWidthButAccou
ntsScale) | 1201 TEST_P(ParameterizedWebFrameTest, NoWideViewportIgnoresPageViewportWidthButAccou
ntsScale) |
| 1216 { | 1202 { |
| 1217 UseMockScrollbarSettings mockScrollbarSettings; | |
| 1218 registerMockedHttpURLLoad("viewport-wide-2x-initial-scale.html"); | 1203 registerMockedHttpURLLoad("viewport-wide-2x-initial-scale.html"); |
| 1219 | 1204 |
| 1220 FixedLayoutTestWebViewClient client; | 1205 FixedLayoutTestWebViewClient client; |
| 1221 client.m_screenInfo.deviceScaleFactor = 1; | 1206 client.m_screenInfo.deviceScaleFactor = 1; |
| 1222 int viewportWidth = 640; | 1207 int viewportWidth = 640; |
| 1223 int viewportHeight = 480; | 1208 int viewportHeight = 480; |
| 1224 | 1209 |
| 1225 FrameTestHelpers::WebViewHelper webViewHelper(this); | 1210 FrameTestHelpers::WebViewHelper webViewHelper(this); |
| 1226 webViewHelper.initializeAndLoad(m_baseURL + "viewport-wide-2x-initial-scale.
html", true, 0, &client, enableViewportSettings); | 1211 webViewHelper.initializeAndLoad(m_baseURL + "viewport-wide-2x-initial-scale.
html", true, 0, &client, enableViewportSettings); |
| 1227 webViewHelper.webView()->settings()->setWideViewportQuirkEnabled(true); | 1212 webViewHelper.webView()->settings()->setWideViewportQuirkEnabled(true); |
| 1228 webViewHelper.webView()->settings()->setUseWideViewport(false); | 1213 webViewHelper.webView()->settings()->setUseWideViewport(false); |
| 1229 webViewHelper.webView()->resize(WebSize(viewportWidth, viewportHeight)); | 1214 webViewHelper.webView()->resize(WebSize(viewportWidth, viewportHeight)); |
| 1230 | 1215 |
| 1231 // The page sets viewport width to 3000, but with UseWideViewport == false i
t must be ignored. | 1216 // The page sets viewport width to 3000, but with UseWideViewport == false i
t must be ignored. |
| 1232 // While the initial scale specified by the page must be accounted. | 1217 // While the initial scale specified by the page must be accounted. |
| 1233 EXPECT_EQ(viewportWidth / 2, webViewHelper.webViewImpl()->mainFrameImpl()->f
rameView()->contentsSize().width()); | 1218 EXPECT_EQ(viewportWidth / 2, webViewHelper.webViewImpl()->mainFrameImpl()->f
rameView()->contentsSize().width()); |
| 1234 EXPECT_EQ(viewportHeight / 2, webViewHelper.webViewImpl()->mainFrameImpl()->
frameView()->contentsSize().height()); | 1219 EXPECT_EQ(viewportHeight / 2, webViewHelper.webViewImpl()->mainFrameImpl()->
frameView()->contentsSize().height()); |
| 1235 } | 1220 } |
| 1236 | 1221 |
| 1237 TEST_P(ParameterizedWebFrameTest, WideViewportSetsTo980WithoutViewportTag) | 1222 TEST_P(ParameterizedWebFrameTest, WideViewportSetsTo980WithoutViewportTag) |
| 1238 { | 1223 { |
| 1239 UseMockScrollbarSettings mockScrollbarSettings; | |
| 1240 registerMockedHttpURLLoad("no_viewport_tag.html"); | 1224 registerMockedHttpURLLoad("no_viewport_tag.html"); |
| 1241 | 1225 |
| 1242 FixedLayoutTestWebViewClient client; | 1226 FixedLayoutTestWebViewClient client; |
| 1243 client.m_screenInfo.deviceScaleFactor = 1; | 1227 client.m_screenInfo.deviceScaleFactor = 1; |
| 1244 int viewportWidth = 640; | 1228 int viewportWidth = 640; |
| 1245 int viewportHeight = 480; | 1229 int viewportHeight = 480; |
| 1246 | 1230 |
| 1247 FrameTestHelpers::WebViewHelper webViewHelper(this); | 1231 FrameTestHelpers::WebViewHelper webViewHelper(this); |
| 1248 webViewHelper.initializeAndLoad(m_baseURL + "no_viewport_tag.html", true, 0,
&client, enableViewportSettings); | 1232 webViewHelper.initializeAndLoad(m_baseURL + "no_viewport_tag.html", true, 0,
&client, enableViewportSettings); |
| 1249 applyViewportStyleOverride(&webViewHelper); | 1233 applyViewportStyleOverride(&webViewHelper); |
| 1250 webViewHelper.webView()->settings()->setWideViewportQuirkEnabled(true); | 1234 webViewHelper.webView()->settings()->setWideViewportQuirkEnabled(true); |
| 1251 webViewHelper.webView()->settings()->setUseWideViewport(true); | 1235 webViewHelper.webView()->settings()->setUseWideViewport(true); |
| 1252 webViewHelper.webView()->resize(WebSize(viewportWidth, viewportHeight)); | 1236 webViewHelper.webView()->resize(WebSize(viewportWidth, viewportHeight)); |
| 1253 | 1237 |
| 1254 EXPECT_EQ(980, webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->co
ntentsSize().width()); | 1238 EXPECT_EQ(980, webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->co
ntentsSize().width()); |
| 1255 EXPECT_EQ(980.0 / viewportWidth * viewportHeight, webViewHelper.webViewImpl(
)->mainFrameImpl()->frameView()->contentsSize().height()); | 1239 EXPECT_EQ(980.0 / viewportWidth * viewportHeight, webViewHelper.webViewImpl(
)->mainFrameImpl()->frameView()->contentsSize().height()); |
| 1256 } | 1240 } |
| 1257 | 1241 |
| 1258 TEST_P(ParameterizedWebFrameTest, WideViewportSetsTo980WithXhtmlMp) | 1242 TEST_P(ParameterizedWebFrameTest, WideViewportSetsTo980WithXhtmlMp) |
| 1259 { | 1243 { |
| 1260 UseMockScrollbarSettings mockScrollbarSettings; | |
| 1261 registerMockedHttpURLLoad("viewport/viewport-legacy-xhtmlmp.html"); | 1244 registerMockedHttpURLLoad("viewport/viewport-legacy-xhtmlmp.html"); |
| 1262 | 1245 |
| 1263 FixedLayoutTestWebViewClient client; | 1246 FixedLayoutTestWebViewClient client; |
| 1264 client.m_screenInfo.deviceScaleFactor = 1; | 1247 client.m_screenInfo.deviceScaleFactor = 1; |
| 1265 int viewportWidth = 640; | 1248 int viewportWidth = 640; |
| 1266 int viewportHeight = 480; | 1249 int viewportHeight = 480; |
| 1267 | 1250 |
| 1268 FrameTestHelpers::WebViewHelper webViewHelper(this); | 1251 FrameTestHelpers::WebViewHelper webViewHelper(this); |
| 1269 webViewHelper.initialize(true, 0, &client, enableViewportSettings); | 1252 webViewHelper.initialize(true, 0, &client, enableViewportSettings); |
| 1270 applyViewportStyleOverride(&webViewHelper); | 1253 applyViewportStyleOverride(&webViewHelper); |
| 1271 webViewHelper.webView()->settings()->setWideViewportQuirkEnabled(true); | 1254 webViewHelper.webView()->settings()->setWideViewportQuirkEnabled(true); |
| 1272 webViewHelper.webView()->settings()->setUseWideViewport(true); | 1255 webViewHelper.webView()->settings()->setUseWideViewport(true); |
| 1273 FrameTestHelpers::loadFrame(webViewHelper.webView()->mainFrame(), m_baseURL
+ "viewport/viewport-legacy-xhtmlmp.html"); | 1256 FrameTestHelpers::loadFrame(webViewHelper.webView()->mainFrame(), m_baseURL
+ "viewport/viewport-legacy-xhtmlmp.html"); |
| 1274 | 1257 |
| 1275 webViewHelper.webView()->resize(WebSize(viewportWidth, viewportHeight)); | 1258 webViewHelper.webView()->resize(WebSize(viewportWidth, viewportHeight)); |
| 1276 EXPECT_EQ(viewportWidth, webViewHelper.webViewImpl()->mainFrameImpl()->frame
View()->contentsSize().width()); | 1259 EXPECT_EQ(viewportWidth, webViewHelper.webViewImpl()->mainFrameImpl()->frame
View()->contentsSize().width()); |
| 1277 EXPECT_EQ(viewportHeight, webViewHelper.webViewImpl()->mainFrameImpl()->fram
eView()->contentsSize().height()); | 1260 EXPECT_EQ(viewportHeight, webViewHelper.webViewImpl()->mainFrameImpl()->fram
eView()->contentsSize().height()); |
| 1278 } | 1261 } |
| 1279 | 1262 |
| 1280 TEST_P(ParameterizedWebFrameTest, NoWideViewportAndHeightInMeta) | 1263 TEST_P(ParameterizedWebFrameTest, NoWideViewportAndHeightInMeta) |
| 1281 { | 1264 { |
| 1282 UseMockScrollbarSettings mockScrollbarSettings; | |
| 1283 registerMockedHttpURLLoad("viewport-height-1000.html"); | 1265 registerMockedHttpURLLoad("viewport-height-1000.html"); |
| 1284 | 1266 |
| 1285 FixedLayoutTestWebViewClient client; | 1267 FixedLayoutTestWebViewClient client; |
| 1286 client.m_screenInfo.deviceScaleFactor = 1; | 1268 client.m_screenInfo.deviceScaleFactor = 1; |
| 1287 int viewportWidth = 640; | 1269 int viewportWidth = 640; |
| 1288 int viewportHeight = 480; | 1270 int viewportHeight = 480; |
| 1289 | 1271 |
| 1290 FrameTestHelpers::WebViewHelper webViewHelper(this); | 1272 FrameTestHelpers::WebViewHelper webViewHelper(this); |
| 1291 webViewHelper.initializeAndLoad(m_baseURL + "viewport-height-1000.html", tru
e, 0, &client, enableViewportSettings); | 1273 webViewHelper.initializeAndLoad(m_baseURL + "viewport-height-1000.html", tru
e, 0, &client, enableViewportSettings); |
| 1292 webViewHelper.webView()->settings()->setWideViewportQuirkEnabled(true); | 1274 webViewHelper.webView()->settings()->setWideViewportQuirkEnabled(true); |
| 1293 webViewHelper.webView()->settings()->setUseWideViewport(false); | 1275 webViewHelper.webView()->settings()->setUseWideViewport(false); |
| 1294 webViewHelper.webView()->resize(WebSize(viewportWidth, viewportHeight)); | 1276 webViewHelper.webView()->resize(WebSize(viewportWidth, viewportHeight)); |
| 1295 | 1277 |
| 1296 EXPECT_EQ(viewportWidth, webViewHelper.webViewImpl()->mainFrameImpl()->frame
View()->contentsSize().width()); | 1278 EXPECT_EQ(viewportWidth, webViewHelper.webViewImpl()->mainFrameImpl()->frame
View()->contentsSize().width()); |
| 1297 } | 1279 } |
| 1298 | 1280 |
| 1299 TEST_P(ParameterizedWebFrameTest, WideViewportSetsTo980WithAutoWidth) | 1281 TEST_P(ParameterizedWebFrameTest, WideViewportSetsTo980WithAutoWidth) |
| 1300 { | 1282 { |
| 1301 UseMockScrollbarSettings mockScrollbarSettings; | |
| 1302 registerMockedHttpURLLoad("viewport-2x-initial-scale.html"); | 1283 registerMockedHttpURLLoad("viewport-2x-initial-scale.html"); |
| 1303 | 1284 |
| 1304 FixedLayoutTestWebViewClient client; | 1285 FixedLayoutTestWebViewClient client; |
| 1305 client.m_screenInfo.deviceScaleFactor = 1; | 1286 client.m_screenInfo.deviceScaleFactor = 1; |
| 1306 int viewportWidth = 640; | 1287 int viewportWidth = 640; |
| 1307 int viewportHeight = 480; | 1288 int viewportHeight = 480; |
| 1308 | 1289 |
| 1309 FrameTestHelpers::WebViewHelper webViewHelper(this); | 1290 FrameTestHelpers::WebViewHelper webViewHelper(this); |
| 1310 webViewHelper.initializeAndLoad(m_baseURL + "viewport-2x-initial-scale.html"
, true, 0, &client, enableViewportSettings); | 1291 webViewHelper.initializeAndLoad(m_baseURL + "viewport-2x-initial-scale.html"
, true, 0, &client, enableViewportSettings); |
| 1311 applyViewportStyleOverride(&webViewHelper); | 1292 applyViewportStyleOverride(&webViewHelper); |
| 1312 webViewHelper.webView()->settings()->setWideViewportQuirkEnabled(true); | 1293 webViewHelper.webView()->settings()->setWideViewportQuirkEnabled(true); |
| 1313 webViewHelper.webView()->settings()->setUseWideViewport(true); | 1294 webViewHelper.webView()->settings()->setUseWideViewport(true); |
| 1314 webViewHelper.webView()->resize(WebSize(viewportWidth, viewportHeight)); | 1295 webViewHelper.webView()->resize(WebSize(viewportWidth, viewportHeight)); |
| 1315 | 1296 |
| 1316 EXPECT_EQ(980, webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->co
ntentsSize().width()); | 1297 EXPECT_EQ(980, webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->co
ntentsSize().width()); |
| 1317 EXPECT_EQ(980.0 / viewportWidth * viewportHeight, webViewHelper.webViewImpl(
)->mainFrameImpl()->frameView()->contentsSize().height()); | 1298 EXPECT_EQ(980.0 / viewportWidth * viewportHeight, webViewHelper.webViewImpl(
)->mainFrameImpl()->frameView()->contentsSize().height()); |
| 1318 } | 1299 } |
| 1319 | 1300 |
| 1320 TEST_P(ParameterizedWebFrameTest, PageViewportInitialScaleOverridesLoadWithOverv
iewMode) | 1301 TEST_P(ParameterizedWebFrameTest, PageViewportInitialScaleOverridesLoadWithOverv
iewMode) |
| 1321 { | 1302 { |
| 1322 UseMockScrollbarSettings mockScrollbarSettings; | |
| 1323 registerMockedHttpURLLoad("viewport-wide-2x-initial-scale.html"); | 1303 registerMockedHttpURLLoad("viewport-wide-2x-initial-scale.html"); |
| 1324 | 1304 |
| 1325 FixedLayoutTestWebViewClient client; | 1305 FixedLayoutTestWebViewClient client; |
| 1326 client.m_screenInfo.deviceScaleFactor = 1; | 1306 client.m_screenInfo.deviceScaleFactor = 1; |
| 1327 int viewportWidth = 640; | 1307 int viewportWidth = 640; |
| 1328 int viewportHeight = 480; | 1308 int viewportHeight = 480; |
| 1329 | 1309 |
| 1330 FrameTestHelpers::WebViewHelper webViewHelper(this); | 1310 FrameTestHelpers::WebViewHelper webViewHelper(this); |
| 1331 webViewHelper.initializeAndLoad(m_baseURL + "viewport-wide-2x-initial-scale.
html", true, 0, &client, enableViewportSettings); | 1311 webViewHelper.initializeAndLoad(m_baseURL + "viewport-wide-2x-initial-scale.
html", true, 0, &client, enableViewportSettings); |
| 1332 webViewHelper.webView()->settings()->setLoadWithOverviewMode(false); | 1312 webViewHelper.webView()->settings()->setLoadWithOverviewMode(false); |
| 1333 webViewHelper.webView()->resize(WebSize(viewportWidth, viewportHeight)); | 1313 webViewHelper.webView()->resize(WebSize(viewportWidth, viewportHeight)); |
| 1334 | 1314 |
| 1335 // The page must be displayed at 200% zoom, as specified in its viewport met
a tag. | 1315 // The page must be displayed at 200% zoom, as specified in its viewport met
a tag. |
| 1336 EXPECT_EQ(2.0f, webViewHelper.webView()->pageScaleFactor()); | 1316 EXPECT_EQ(2.0f, webViewHelper.webView()->pageScaleFactor()); |
| 1337 } | 1317 } |
| 1338 | 1318 |
| 1339 TEST_P(ParameterizedWebFrameTest, setInitialPageScaleFactorPermanently) | 1319 TEST_P(ParameterizedWebFrameTest, setInitialPageScaleFactorPermanently) |
| 1340 { | 1320 { |
| 1341 UseMockScrollbarSettings mockScrollbarSettings; | |
| 1342 | |
| 1343 registerMockedHttpURLLoad("fixed_layout.html"); | 1321 registerMockedHttpURLLoad("fixed_layout.html"); |
| 1344 | 1322 |
| 1345 FixedLayoutTestWebViewClient client; | 1323 FixedLayoutTestWebViewClient client; |
| 1346 client.m_screenInfo.deviceScaleFactor = 1; | 1324 client.m_screenInfo.deviceScaleFactor = 1; |
| 1347 float enforcedPageScaleFactor = 2.0f; | 1325 float enforcedPageScaleFactor = 2.0f; |
| 1348 | 1326 |
| 1349 FrameTestHelpers::WebViewHelper webViewHelper(this); | 1327 FrameTestHelpers::WebViewHelper webViewHelper(this); |
| 1350 webViewHelper.initializeAndLoad(m_baseURL + "fixed_layout.html", true, 0, &c
lient, enableViewportSettings); | 1328 webViewHelper.initializeAndLoad(m_baseURL + "fixed_layout.html", true, 0, &c
lient, enableViewportSettings); |
| 1351 applyViewportStyleOverride(&webViewHelper); | 1329 applyViewportStyleOverride(&webViewHelper); |
| 1352 webViewHelper.webView()->settings()->setWideViewportQuirkEnabled(true); | 1330 webViewHelper.webView()->settings()->setWideViewportQuirkEnabled(true); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 1363 | 1341 |
| 1364 EXPECT_EQ(enforcedPageScaleFactor, webViewHelper.webView()->pageScaleFactor(
)); | 1342 EXPECT_EQ(enforcedPageScaleFactor, webViewHelper.webView()->pageScaleFactor(
)); |
| 1365 | 1343 |
| 1366 webViewHelper.webView()->setInitialPageScaleOverride(-1); | 1344 webViewHelper.webView()->setInitialPageScaleOverride(-1); |
| 1367 webViewHelper.webView()->layout(); | 1345 webViewHelper.webView()->layout(); |
| 1368 EXPECT_EQ(1.0, webViewHelper.webView()->pageScaleFactor()); | 1346 EXPECT_EQ(1.0, webViewHelper.webView()->pageScaleFactor()); |
| 1369 } | 1347 } |
| 1370 | 1348 |
| 1371 TEST_P(ParameterizedWebFrameTest, PermanentInitialPageScaleFactorOverridesLoadWi
thOverviewMode) | 1349 TEST_P(ParameterizedWebFrameTest, PermanentInitialPageScaleFactorOverridesLoadWi
thOverviewMode) |
| 1372 { | 1350 { |
| 1373 UseMockScrollbarSettings mockScrollbarSettings; | |
| 1374 registerMockedHttpURLLoad("viewport-auto-initial-scale.html"); | 1351 registerMockedHttpURLLoad("viewport-auto-initial-scale.html"); |
| 1375 | 1352 |
| 1376 FixedLayoutTestWebViewClient client; | 1353 FixedLayoutTestWebViewClient client; |
| 1377 client.m_screenInfo.deviceScaleFactor = 1; | 1354 client.m_screenInfo.deviceScaleFactor = 1; |
| 1378 int viewportWidth = 640; | 1355 int viewportWidth = 640; |
| 1379 int viewportHeight = 480; | 1356 int viewportHeight = 480; |
| 1380 float enforcedPageScaleFactor = 0.5f; | 1357 float enforcedPageScaleFactor = 0.5f; |
| 1381 | 1358 |
| 1382 FrameTestHelpers::WebViewHelper webViewHelper(this); | 1359 FrameTestHelpers::WebViewHelper webViewHelper(this); |
| 1383 webViewHelper.initializeAndLoad(m_baseURL + "viewport-auto-initial-scale.htm
l", true, 0, &client, enableViewportSettings); | 1360 webViewHelper.initializeAndLoad(m_baseURL + "viewport-auto-initial-scale.htm
l", true, 0, &client, enableViewportSettings); |
| 1384 webViewHelper.webView()->settings()->setLoadWithOverviewMode(false); | 1361 webViewHelper.webView()->settings()->setLoadWithOverviewMode(false); |
| 1385 webViewHelper.webView()->setInitialPageScaleOverride(enforcedPageScaleFactor
); | 1362 webViewHelper.webView()->setInitialPageScaleOverride(enforcedPageScaleFactor
); |
| 1386 webViewHelper.webView()->resize(WebSize(viewportWidth, viewportHeight)); | 1363 webViewHelper.webView()->resize(WebSize(viewportWidth, viewportHeight)); |
| 1387 | 1364 |
| 1388 EXPECT_EQ(enforcedPageScaleFactor, webViewHelper.webView()->pageScaleFactor(
)); | 1365 EXPECT_EQ(enforcedPageScaleFactor, webViewHelper.webView()->pageScaleFactor(
)); |
| 1389 } | 1366 } |
| 1390 | 1367 |
| 1391 TEST_P(ParameterizedWebFrameTest, PermanentInitialPageScaleFactorOverridesPageVi
ewportInitialScale) | 1368 TEST_P(ParameterizedWebFrameTest, PermanentInitialPageScaleFactorOverridesPageVi
ewportInitialScale) |
| 1392 { | 1369 { |
| 1393 UseMockScrollbarSettings mockScrollbarSettings; | |
| 1394 registerMockedHttpURLLoad("viewport-wide-2x-initial-scale.html"); | 1370 registerMockedHttpURLLoad("viewport-wide-2x-initial-scale.html"); |
| 1395 | 1371 |
| 1396 FixedLayoutTestWebViewClient client; | 1372 FixedLayoutTestWebViewClient client; |
| 1397 client.m_screenInfo.deviceScaleFactor = 1; | 1373 client.m_screenInfo.deviceScaleFactor = 1; |
| 1398 int viewportWidth = 640; | 1374 int viewportWidth = 640; |
| 1399 int viewportHeight = 480; | 1375 int viewportHeight = 480; |
| 1400 float enforcedPageScaleFactor = 0.5f; | 1376 float enforcedPageScaleFactor = 0.5f; |
| 1401 | 1377 |
| 1402 FrameTestHelpers::WebViewHelper webViewHelper(this); | 1378 FrameTestHelpers::WebViewHelper webViewHelper(this); |
| 1403 webViewHelper.initializeAndLoad(m_baseURL + "viewport-wide-2x-initial-scale.
html", true, 0, &client, enableViewportSettings); | 1379 webViewHelper.initializeAndLoad(m_baseURL + "viewport-wide-2x-initial-scale.
html", true, 0, &client, enableViewportSettings); |
| 1404 webViewHelper.webView()->setInitialPageScaleOverride(enforcedPageScaleFactor
); | 1380 webViewHelper.webView()->setInitialPageScaleOverride(enforcedPageScaleFactor
); |
| 1405 webViewHelper.webView()->resize(WebSize(viewportWidth, viewportHeight)); | 1381 webViewHelper.webView()->resize(WebSize(viewportWidth, viewportHeight)); |
| 1406 | 1382 |
| 1407 EXPECT_EQ(enforcedPageScaleFactor, webViewHelper.webView()->pageScaleFactor(
)); | 1383 EXPECT_EQ(enforcedPageScaleFactor, webViewHelper.webView()->pageScaleFactor(
)); |
| 1408 } | 1384 } |
| 1409 | 1385 |
| 1410 TEST_P(ParameterizedWebFrameTest, SmallPermanentInitialPageScaleFactorIsClobbere
d) | 1386 TEST_P(ParameterizedWebFrameTest, SmallPermanentInitialPageScaleFactorIsClobbere
d) |
| 1411 { | 1387 { |
| 1412 UseMockScrollbarSettings mockScrollbarSettings; | |
| 1413 const char* pages[] = { | 1388 const char* pages[] = { |
| 1414 // These pages trigger the clobbering condition. There must be a matchin
g item in "pageScaleFactors" array. | 1389 // These pages trigger the clobbering condition. There must be a matchin
g item in "pageScaleFactors" array. |
| 1415 "viewport-device-0.5x-initial-scale.html", | 1390 "viewport-device-0.5x-initial-scale.html", |
| 1416 "viewport-initial-scale-1.html", | 1391 "viewport-initial-scale-1.html", |
| 1417 // These ones do not. | 1392 // These ones do not. |
| 1418 "viewport-auto-initial-scale.html", | 1393 "viewport-auto-initial-scale.html", |
| 1419 "viewport-target-densitydpi-device-and-fixed-width.html" | 1394 "viewport-target-densitydpi-device-and-fixed-width.html" |
| 1420 }; | 1395 }; |
| 1421 float pageScaleFactors[] = { 0.5f, 1.0f }; | 1396 float pageScaleFactors[] = { 0.5f, 1.0f }; |
| 1422 for (size_t i = 0; i < ARRAY_SIZE(pages); ++i) | 1397 for (size_t i = 0; i < ARRAY_SIZE(pages); ++i) |
| (...skipping 15 matching lines...) Expand all Loading... |
| 1438 webViewHelper.webView()->resize(WebSize(viewportWidth, viewportHeigh
t)); | 1413 webViewHelper.webView()->resize(WebSize(viewportWidth, viewportHeigh
t)); |
| 1439 | 1414 |
| 1440 float expectedPageScaleFactor = quirkEnabled && i < ARRAY_SIZE(pageS
caleFactors) ? pageScaleFactors[i] : enforcedPageScaleFactor; | 1415 float expectedPageScaleFactor = quirkEnabled && i < ARRAY_SIZE(pageS
caleFactors) ? pageScaleFactors[i] : enforcedPageScaleFactor; |
| 1441 EXPECT_EQ(expectedPageScaleFactor, webViewHelper.webView()->pageScal
eFactor()); | 1416 EXPECT_EQ(expectedPageScaleFactor, webViewHelper.webView()->pageScal
eFactor()); |
| 1442 } | 1417 } |
| 1443 } | 1418 } |
| 1444 } | 1419 } |
| 1445 | 1420 |
| 1446 TEST_P(ParameterizedWebFrameTest, PermanentInitialPageScaleFactorAffectsLayoutWi
dth) | 1421 TEST_P(ParameterizedWebFrameTest, PermanentInitialPageScaleFactorAffectsLayoutWi
dth) |
| 1447 { | 1422 { |
| 1448 UseMockScrollbarSettings mockScrollbarSettings; | |
| 1449 | |
| 1450 FixedLayoutTestWebViewClient client; | 1423 FixedLayoutTestWebViewClient client; |
| 1451 client.m_screenInfo.deviceScaleFactor = 1; | 1424 client.m_screenInfo.deviceScaleFactor = 1; |
| 1452 int viewportWidth = 640; | 1425 int viewportWidth = 640; |
| 1453 int viewportHeight = 480; | 1426 int viewportHeight = 480; |
| 1454 float enforcedPageScaleFactor = 0.5; | 1427 float enforcedPageScaleFactor = 0.5; |
| 1455 | 1428 |
| 1456 FrameTestHelpers::WebViewHelper webViewHelper(this); | 1429 FrameTestHelpers::WebViewHelper webViewHelper(this); |
| 1457 webViewHelper.initializeAndLoad("about:blank", true, 0, &client, enableViewp
ortSettings); | 1430 webViewHelper.initializeAndLoad("about:blank", true, 0, &client, enableViewp
ortSettings); |
| 1458 webViewHelper.webView()->settings()->setWideViewportQuirkEnabled(true); | 1431 webViewHelper.webView()->settings()->setWideViewportQuirkEnabled(true); |
| 1459 webViewHelper.webView()->settings()->setUseWideViewport(false); | 1432 webViewHelper.webView()->settings()->setUseWideViewport(false); |
| 1460 webViewHelper.webView()->settings()->setLoadWithOverviewMode(false); | 1433 webViewHelper.webView()->settings()->setLoadWithOverviewMode(false); |
| 1461 webViewHelper.webView()->setInitialPageScaleOverride(enforcedPageScaleFactor
); | 1434 webViewHelper.webView()->setInitialPageScaleOverride(enforcedPageScaleFactor
); |
| 1462 webViewHelper.webView()->resize(WebSize(viewportWidth, viewportHeight)); | 1435 webViewHelper.webView()->resize(WebSize(viewportWidth, viewportHeight)); |
| 1463 | 1436 |
| 1464 EXPECT_EQ(viewportWidth / enforcedPageScaleFactor, webViewHelper.webViewImpl
()->mainFrameImpl()->frameView()->contentsSize().width()); | 1437 EXPECT_EQ(viewportWidth / enforcedPageScaleFactor, webViewHelper.webViewImpl
()->mainFrameImpl()->frameView()->contentsSize().width()); |
| 1465 EXPECT_EQ(enforcedPageScaleFactor, webViewHelper.webView()->pageScaleFactor(
)); | 1438 EXPECT_EQ(enforcedPageScaleFactor, webViewHelper.webView()->pageScaleFactor(
)); |
| 1466 } | 1439 } |
| 1467 | 1440 |
| 1468 TEST_P(ParameterizedWebFrameTest, DocumentElementClientHeightWorksWithWrapConten
tMode) | 1441 TEST_P(ParameterizedWebFrameTest, DocumentElementClientHeightWorksWithWrapConten
tMode) |
| 1469 { | 1442 { |
| 1470 UseMockScrollbarSettings mockScrollbarSettings; | |
| 1471 registerMockedHttpURLLoad("0-by-0.html"); | 1443 registerMockedHttpURLLoad("0-by-0.html"); |
| 1472 | 1444 |
| 1473 FixedLayoutTestWebViewClient client; | 1445 FixedLayoutTestWebViewClient client; |
| 1474 client.m_screenInfo.deviceScaleFactor = 1; | 1446 client.m_screenInfo.deviceScaleFactor = 1; |
| 1475 int viewportWidth = 640; | 1447 int viewportWidth = 640; |
| 1476 int viewportHeight = 480; | 1448 int viewportHeight = 480; |
| 1477 | 1449 |
| 1478 FrameTestHelpers::WebViewHelper webViewHelper(this); | 1450 FrameTestHelpers::WebViewHelper webViewHelper(this); |
| 1479 | 1451 |
| 1480 webViewHelper.initializeAndLoad(m_baseURL + "0-by-0.html", true, 0, &client,
configureAndroid); | 1452 webViewHelper.initializeAndLoad(m_baseURL + "0-by-0.html", true, 0, &client,
configureAndroid); |
| 1481 webViewHelper.webView()->settings()->setForceZeroLayoutHeight(true); | 1453 webViewHelper.webView()->settings()->setForceZeroLayoutHeight(true); |
| 1482 webViewHelper.webView()->resize(WebSize(viewportWidth, viewportHeight)); | 1454 webViewHelper.webView()->resize(WebSize(viewportWidth, viewportHeight)); |
| 1483 | 1455 |
| 1484 LocalFrame* frame = webViewHelper.webViewImpl()->mainFrameImpl()->frame(); | 1456 LocalFrame* frame = webViewHelper.webViewImpl()->mainFrameImpl()->frame(); |
| 1485 Document* document = frame->document(); | 1457 Document* document = frame->document(); |
| 1486 EXPECT_EQ(viewportHeight, document->documentElement()->clientHeight()); | 1458 EXPECT_EQ(viewportHeight, document->documentElement()->clientHeight()); |
| 1487 EXPECT_EQ(viewportWidth, document->documentElement()->clientWidth()); | 1459 EXPECT_EQ(viewportWidth, document->documentElement()->clientWidth()); |
| 1488 } | 1460 } |
| 1489 | 1461 |
| 1490 TEST_P(ParameterizedWebFrameTest, SetForceZeroLayoutHeightWorksWithWrapContentMo
de) | 1462 TEST_P(ParameterizedWebFrameTest, SetForceZeroLayoutHeightWorksWithWrapContentMo
de) |
| 1491 { | 1463 { |
| 1492 UseMockScrollbarSettings mockScrollbarSettings; | |
| 1493 registerMockedHttpURLLoad("0-by-0.html"); | 1464 registerMockedHttpURLLoad("0-by-0.html"); |
| 1494 | 1465 |
| 1495 FixedLayoutTestWebViewClient client; | 1466 FixedLayoutTestWebViewClient client; |
| 1496 client.m_screenInfo.deviceScaleFactor = 1; | 1467 client.m_screenInfo.deviceScaleFactor = 1; |
| 1497 int viewportWidth = 640; | 1468 int viewportWidth = 640; |
| 1498 int viewportHeight = 480; | 1469 int viewportHeight = 480; |
| 1499 | 1470 |
| 1500 FrameTestHelpers::WebViewHelper webViewHelper(this); | 1471 FrameTestHelpers::WebViewHelper webViewHelper(this); |
| 1501 | 1472 |
| 1502 webViewHelper.initializeAndLoad(m_baseURL + "0-by-0.html", true, 0, &client,
configureAndroid); | 1473 webViewHelper.initializeAndLoad(m_baseURL + "0-by-0.html", true, 0, &client,
configureAndroid); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 1525 | 1496 |
| 1526 LocalFrame* frame = webViewHelper.webViewImpl()->mainFrameImpl()->frame(); | 1497 LocalFrame* frame = webViewHelper.webViewImpl()->mainFrameImpl()->frame(); |
| 1527 VisualViewport& visualViewport = frame->page()->frameHost().visualViewport()
; | 1498 VisualViewport& visualViewport = frame->page()->frameHost().visualViewport()
; |
| 1528 EXPECT_EQ(viewportHeight, visualViewport.containerLayer()->size().height()); | 1499 EXPECT_EQ(viewportHeight, visualViewport.containerLayer()->size().height()); |
| 1529 EXPECT_TRUE(visualViewport.containerLayer()->platformLayer()->masksToBounds(
)); | 1500 EXPECT_TRUE(visualViewport.containerLayer()->platformLayer()->masksToBounds(
)); |
| 1530 EXPECT_FALSE(compositor->containerLayer()->platformLayer()->masksToBounds())
; | 1501 EXPECT_FALSE(compositor->containerLayer()->platformLayer()->masksToBounds())
; |
| 1531 } | 1502 } |
| 1532 | 1503 |
| 1533 TEST_P(ParameterizedWebFrameTest, SetForceZeroLayoutHeight) | 1504 TEST_P(ParameterizedWebFrameTest, SetForceZeroLayoutHeight) |
| 1534 { | 1505 { |
| 1535 UseMockScrollbarSettings mockScrollbarSettings; | |
| 1536 registerMockedHttpURLLoad("200-by-300.html"); | 1506 registerMockedHttpURLLoad("200-by-300.html"); |
| 1537 | 1507 |
| 1538 FixedLayoutTestWebViewClient client; | 1508 FixedLayoutTestWebViewClient client; |
| 1539 client.m_screenInfo.deviceScaleFactor = 1; | 1509 client.m_screenInfo.deviceScaleFactor = 1; |
| 1540 int viewportWidth = 640; | 1510 int viewportWidth = 640; |
| 1541 int viewportHeight = 480; | 1511 int viewportHeight = 480; |
| 1542 | 1512 |
| 1543 FrameTestHelpers::WebViewHelper webViewHelper(this); | 1513 FrameTestHelpers::WebViewHelper webViewHelper(this); |
| 1544 | 1514 |
| 1545 webViewHelper.initializeAndLoad(m_baseURL + "200-by-300.html", true, 0, &cli
ent, enableViewportSettings); | 1515 webViewHelper.initializeAndLoad(m_baseURL + "200-by-300.html", true, 0, &cli
ent, enableViewportSettings); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 1565 } | 1535 } |
| 1566 | 1536 |
| 1567 TEST_F(WebFrameTest, SetForceZeroLayoutHeightWorksWithRelayoutsWhenHeightChanged
) | 1537 TEST_F(WebFrameTest, SetForceZeroLayoutHeightWorksWithRelayoutsWhenHeightChanged
) |
| 1568 { | 1538 { |
| 1569 // this unit test is an attempt to target a real world case where an app cou
ld | 1539 // this unit test is an attempt to target a real world case where an app cou
ld |
| 1570 // 1. call resize(width, 0) and setForceZeroLayoutHeight(true) | 1540 // 1. call resize(width, 0) and setForceZeroLayoutHeight(true) |
| 1571 // 2. load content (hoping that the viewport height would increase | 1541 // 2. load content (hoping that the viewport height would increase |
| 1572 // as more content is added) | 1542 // as more content is added) |
| 1573 // 3. fail to register touch events aimed at the loaded content | 1543 // 3. fail to register touch events aimed at the loaded content |
| 1574 // because the layout is only updated if either width or height is changed | 1544 // because the layout is only updated if either width or height is changed |
| 1575 UseMockScrollbarSettings mockScrollbarSettings; | |
| 1576 registerMockedHttpURLLoad("button.html"); | 1545 registerMockedHttpURLLoad("button.html"); |
| 1577 | 1546 |
| 1578 FixedLayoutTestWebViewClient client; | 1547 FixedLayoutTestWebViewClient client; |
| 1579 client.m_screenInfo.deviceScaleFactor = 1; | 1548 client.m_screenInfo.deviceScaleFactor = 1; |
| 1580 int viewportWidth = 640; | 1549 int viewportWidth = 640; |
| 1581 int viewportHeight = 480; | 1550 int viewportHeight = 480; |
| 1582 | 1551 |
| 1583 FrameTestHelpers::WebViewHelper webViewHelper; | 1552 FrameTestHelpers::WebViewHelper webViewHelper; |
| 1584 | 1553 |
| 1585 webViewHelper.initializeAndLoad(m_baseURL + "button.html", true, 0, &client,
configureAndroid); | 1554 webViewHelper.initializeAndLoad(m_baseURL + "button.html", true, 0, &client,
configureAndroid); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 1602 EXPECT_EQ(String("oldValue"), element->innerText()); | 1571 EXPECT_EQ(String("oldValue"), element->innerText()); |
| 1603 | 1572 |
| 1604 PlatformGestureEvent gestureEvent(PlatformEvent::Type::GestureTap, hitPoint,
hitPoint, IntSize(0, 0), 0, PlatformEvent::NoModifiers, PlatformGestureSourceTo
uchscreen); | 1573 PlatformGestureEvent gestureEvent(PlatformEvent::Type::GestureTap, hitPoint,
hitPoint, IntSize(0, 0), 0, PlatformEvent::NoModifiers, PlatformGestureSourceTo
uchscreen); |
| 1605 webViewHelper.webViewImpl()->mainFrameImpl()->frame()->eventHandler().handle
GestureEvent(gestureEvent); | 1574 webViewHelper.webViewImpl()->mainFrameImpl()->frame()->eventHandler().handle
GestureEvent(gestureEvent); |
| 1606 // when pressed, the button changes its own text to "updatedValue" | 1575 // when pressed, the button changes its own text to "updatedValue" |
| 1607 EXPECT_EQ(String("updatedValue"), element->innerText()); | 1576 EXPECT_EQ(String("updatedValue"), element->innerText()); |
| 1608 } | 1577 } |
| 1609 | 1578 |
| 1610 TEST_P(ParameterizedWebFrameTest, SetForceZeroLayoutHeightWorksAcrossNavigations
) | 1579 TEST_P(ParameterizedWebFrameTest, SetForceZeroLayoutHeightWorksAcrossNavigations
) |
| 1611 { | 1580 { |
| 1612 UseMockScrollbarSettings mockScrollbarSettings; | |
| 1613 registerMockedHttpURLLoad("200-by-300.html"); | 1581 registerMockedHttpURLLoad("200-by-300.html"); |
| 1614 registerMockedHttpURLLoad("large-div.html"); | 1582 registerMockedHttpURLLoad("large-div.html"); |
| 1615 | 1583 |
| 1616 FixedLayoutTestWebViewClient client; | 1584 FixedLayoutTestWebViewClient client; |
| 1617 client.m_screenInfo.deviceScaleFactor = 1; | 1585 client.m_screenInfo.deviceScaleFactor = 1; |
| 1618 int viewportWidth = 640; | 1586 int viewportWidth = 640; |
| 1619 int viewportHeight = 480; | 1587 int viewportHeight = 480; |
| 1620 | 1588 |
| 1621 FrameTestHelpers::WebViewHelper webViewHelper(this); | 1589 FrameTestHelpers::WebViewHelper webViewHelper(this); |
| 1622 | 1590 |
| 1623 webViewHelper.initializeAndLoad(m_baseURL + "200-by-300.html", true, 0, &cli
ent, enableViewportSettings); | 1591 webViewHelper.initializeAndLoad(m_baseURL + "200-by-300.html", true, 0, &cli
ent, enableViewportSettings); |
| 1624 webViewHelper.webView()->settings()->setForceZeroLayoutHeight(true); | 1592 webViewHelper.webView()->settings()->setForceZeroLayoutHeight(true); |
| 1625 webViewHelper.webView()->resize(WebSize(viewportWidth, viewportHeight)); | 1593 webViewHelper.webView()->resize(WebSize(viewportWidth, viewportHeight)); |
| 1626 webViewHelper.webView()->layout(); | 1594 webViewHelper.webView()->layout(); |
| 1627 | 1595 |
| 1628 FrameTestHelpers::loadFrame(webViewHelper.webView()->mainFrame(), m_baseURL
+ "large-div.html"); | 1596 FrameTestHelpers::loadFrame(webViewHelper.webView()->mainFrame(), m_baseURL
+ "large-div.html"); |
| 1629 webViewHelper.webView()->layout(); | 1597 webViewHelper.webView()->layout(); |
| 1630 | 1598 |
| 1631 EXPECT_EQ(0, webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->layo
utSize().height()); | 1599 EXPECT_EQ(0, webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->layo
utSize().height()); |
| 1632 } | 1600 } |
| 1633 | 1601 |
| 1634 TEST_P(ParameterizedWebFrameTest, SetForceZeroLayoutHeightWithWideViewportQuirk) | 1602 TEST_P(ParameterizedWebFrameTest, SetForceZeroLayoutHeightWithWideViewportQuirk) |
| 1635 { | 1603 { |
| 1636 UseMockScrollbarSettings mockScrollbarSettings; | |
| 1637 registerMockedHttpURLLoad("200-by-300.html"); | 1604 registerMockedHttpURLLoad("200-by-300.html"); |
| 1638 | 1605 |
| 1639 FixedLayoutTestWebViewClient client; | 1606 FixedLayoutTestWebViewClient client; |
| 1640 client.m_screenInfo.deviceScaleFactor = 1; | 1607 client.m_screenInfo.deviceScaleFactor = 1; |
| 1641 int viewportWidth = 640; | 1608 int viewportWidth = 640; |
| 1642 int viewportHeight = 480; | 1609 int viewportHeight = 480; |
| 1643 | 1610 |
| 1644 FrameTestHelpers::WebViewHelper webViewHelper(this); | 1611 FrameTestHelpers::WebViewHelper webViewHelper(this); |
| 1645 | 1612 |
| 1646 webViewHelper.initializeAndLoad(m_baseURL + "200-by-300.html", true, 0, &cli
ent, enableViewportSettings); | 1613 webViewHelper.initializeAndLoad(m_baseURL + "200-by-300.html", true, 0, &cli
ent, enableViewportSettings); |
| 1647 webViewHelper.webView()->settings()->setWideViewportQuirkEnabled(true); | 1614 webViewHelper.webView()->settings()->setWideViewportQuirkEnabled(true); |
| 1648 webViewHelper.webView()->settings()->setUseWideViewport(true); | 1615 webViewHelper.webView()->settings()->setUseWideViewport(true); |
| 1649 webViewHelper.webView()->settings()->setForceZeroLayoutHeight(true); | 1616 webViewHelper.webView()->settings()->setForceZeroLayoutHeight(true); |
| 1650 webViewHelper.webView()->resize(WebSize(viewportWidth, viewportHeight)); | 1617 webViewHelper.webView()->resize(WebSize(viewportWidth, viewportHeight)); |
| 1651 webViewHelper.webView()->layout(); | 1618 webViewHelper.webView()->layout(); |
| 1652 | 1619 |
| 1653 EXPECT_EQ(0, webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->layo
utSize().height()); | 1620 EXPECT_EQ(0, webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->layo
utSize().height()); |
| 1654 } | 1621 } |
| 1655 | 1622 |
| 1656 TEST_P(ParameterizedWebFrameTest, WideViewportAndWideContentWithInitialScale) | 1623 TEST_P(ParameterizedWebFrameTest, WideViewportAndWideContentWithInitialScale) |
| 1657 { | 1624 { |
| 1658 UseMockScrollbarSettings mockScrollbarSettings; | |
| 1659 registerMockedHttpURLLoad("wide_document_width_viewport.html"); | 1625 registerMockedHttpURLLoad("wide_document_width_viewport.html"); |
| 1660 registerMockedHttpURLLoad("white-1x1.png"); | 1626 registerMockedHttpURLLoad("white-1x1.png"); |
| 1661 | 1627 |
| 1662 FixedLayoutTestWebViewClient client; | 1628 FixedLayoutTestWebViewClient client; |
| 1663 client.m_screenInfo.deviceScaleFactor = 1; | 1629 client.m_screenInfo.deviceScaleFactor = 1; |
| 1664 int viewportWidth = 600; | 1630 int viewportWidth = 600; |
| 1665 int viewportHeight = 800; | 1631 int viewportHeight = 800; |
| 1666 | 1632 |
| 1667 FrameTestHelpers::WebViewHelper webViewHelper(this); | 1633 FrameTestHelpers::WebViewHelper webViewHelper(this); |
| 1668 webViewHelper.initializeAndLoad("about:blank", true, 0, &client, enableViewp
ortSettings); | 1634 webViewHelper.initializeAndLoad("about:blank", true, 0, &client, enableViewp
ortSettings); |
| 1669 webViewHelper.webView()->settings()->setWideViewportQuirkEnabled(true); | 1635 webViewHelper.webView()->settings()->setWideViewportQuirkEnabled(true); |
| 1670 webViewHelper.webView()->settings()->setUseWideViewport(true); | 1636 webViewHelper.webView()->settings()->setUseWideViewport(true); |
| 1671 webViewHelper.webView()->settings()->setViewportMetaLayoutSizeQuirk(true); | 1637 webViewHelper.webView()->settings()->setViewportMetaLayoutSizeQuirk(true); |
| 1672 webViewHelper.webView()->resize(WebSize(viewportWidth, viewportHeight)); | 1638 webViewHelper.webView()->resize(WebSize(viewportWidth, viewportHeight)); |
| 1673 | 1639 |
| 1674 FrameTestHelpers::loadFrame(webViewHelper.webView()->mainFrame(), m_baseURL
+ "wide_document_width_viewport.html"); | 1640 FrameTestHelpers::loadFrame(webViewHelper.webView()->mainFrame(), m_baseURL
+ "wide_document_width_viewport.html"); |
| 1675 webViewHelper.webView()->resize(WebSize(viewportWidth, viewportHeight)); | 1641 webViewHelper.webView()->resize(WebSize(viewportWidth, viewportHeight)); |
| 1676 | 1642 |
| 1677 int wideDocumentWidth = 800; | 1643 int wideDocumentWidth = 800; |
| 1678 float minimumPageScaleFactor = viewportWidth / (float) wideDocumentWidth; | 1644 float minimumPageScaleFactor = viewportWidth / (float) wideDocumentWidth; |
| 1679 EXPECT_EQ(minimumPageScaleFactor, webViewHelper.webViewImpl()->pageScaleFact
or()); | 1645 EXPECT_EQ(minimumPageScaleFactor, webViewHelper.webViewImpl()->pageScaleFact
or()); |
| 1680 EXPECT_EQ(minimumPageScaleFactor, webViewHelper.webViewImpl()->minimumPageSc
aleFactor()); | 1646 EXPECT_EQ(minimumPageScaleFactor, webViewHelper.webViewImpl()->minimumPageSc
aleFactor()); |
| 1681 } | 1647 } |
| 1682 | 1648 |
| 1683 TEST_P(ParameterizedWebFrameTest, WideViewportQuirkClobbersHeight) | 1649 TEST_P(ParameterizedWebFrameTest, WideViewportQuirkClobbersHeight) |
| 1684 { | 1650 { |
| 1685 UseMockScrollbarSettings mockScrollbarSettings; | |
| 1686 registerMockedHttpURLLoad("viewport-height-1000.html"); | 1651 registerMockedHttpURLLoad("viewport-height-1000.html"); |
| 1687 | 1652 |
| 1688 FixedLayoutTestWebViewClient client; | 1653 FixedLayoutTestWebViewClient client; |
| 1689 client.m_screenInfo.deviceScaleFactor = 1; | 1654 client.m_screenInfo.deviceScaleFactor = 1; |
| 1690 int viewportWidth = 600; | 1655 int viewportWidth = 600; |
| 1691 int viewportHeight = 800; | 1656 int viewportHeight = 800; |
| 1692 | 1657 |
| 1693 FrameTestHelpers::WebViewHelper webViewHelper(this); | 1658 FrameTestHelpers::WebViewHelper webViewHelper(this); |
| 1694 webViewHelper.initializeAndLoad("about:blank", true, 0, &client, enableViewp
ortSettings); | 1659 webViewHelper.initializeAndLoad("about:blank", true, 0, &client, enableViewp
ortSettings); |
| 1695 webViewHelper.webView()->settings()->setWideViewportQuirkEnabled(true); | 1660 webViewHelper.webView()->settings()->setWideViewportQuirkEnabled(true); |
| 1696 webViewHelper.webView()->settings()->setUseWideViewport(false); | 1661 webViewHelper.webView()->settings()->setUseWideViewport(false); |
| 1697 webViewHelper.webView()->settings()->setViewportMetaLayoutSizeQuirk(true); | 1662 webViewHelper.webView()->settings()->setViewportMetaLayoutSizeQuirk(true); |
| 1698 webViewHelper.webView()->resize(WebSize(viewportWidth, viewportHeight)); | 1663 webViewHelper.webView()->resize(WebSize(viewportWidth, viewportHeight)); |
| 1699 | 1664 |
| 1700 FrameTestHelpers::loadFrame(webViewHelper.webView()->mainFrame(), m_baseURL
+ "viewport-height-1000.html"); | 1665 FrameTestHelpers::loadFrame(webViewHelper.webView()->mainFrame(), m_baseURL
+ "viewport-height-1000.html"); |
| 1701 webViewHelper.webView()->resize(WebSize(viewportWidth, viewportHeight)); | 1666 webViewHelper.webView()->resize(WebSize(viewportWidth, viewportHeight)); |
| 1702 | 1667 |
| 1703 EXPECT_EQ(800, webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->la
youtSize().height()); | 1668 EXPECT_EQ(800, webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->la
youtSize().height()); |
| 1704 EXPECT_EQ(1, webViewHelper.webView()->pageScaleFactor()); | 1669 EXPECT_EQ(1, webViewHelper.webView()->pageScaleFactor()); |
| 1705 } | 1670 } |
| 1706 | 1671 |
| 1707 TEST_P(ParameterizedWebFrameTest, LayoutSize320Quirk) | 1672 TEST_P(ParameterizedWebFrameTest, LayoutSize320Quirk) |
| 1708 { | 1673 { |
| 1709 UseMockScrollbarSettings mockScrollbarSettings; | |
| 1710 registerMockedHttpURLLoad("viewport/viewport-30.html"); | 1674 registerMockedHttpURLLoad("viewport/viewport-30.html"); |
| 1711 | 1675 |
| 1712 FixedLayoutTestWebViewClient client; | 1676 FixedLayoutTestWebViewClient client; |
| 1713 client.m_screenInfo.deviceScaleFactor = 1; | 1677 client.m_screenInfo.deviceScaleFactor = 1; |
| 1714 int viewportWidth = 600; | 1678 int viewportWidth = 600; |
| 1715 int viewportHeight = 800; | 1679 int viewportHeight = 800; |
| 1716 | 1680 |
| 1717 FrameTestHelpers::WebViewHelper webViewHelper(this); | 1681 FrameTestHelpers::WebViewHelper webViewHelper(this); |
| 1718 webViewHelper.initializeAndLoad("about:blank", true, 0, &client, enableViewp
ortSettings); | 1682 webViewHelper.initializeAndLoad("about:blank", true, 0, &client, enableViewp
ortSettings); |
| 1719 webViewHelper.webView()->settings()->setWideViewportQuirkEnabled(true); | 1683 webViewHelper.webView()->settings()->setWideViewportQuirkEnabled(true); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1751 EXPECT_EQ(1000, webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->l
ayoutSize().height()); | 1715 EXPECT_EQ(1000, webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->l
ayoutSize().height()); |
| 1752 | 1716 |
| 1753 description.maxHeight = Length(320, blink::Fixed); | 1717 description.maxHeight = Length(320, blink::Fixed); |
| 1754 document->setViewportDescription(description); | 1718 document->setViewportDescription(description); |
| 1755 webViewHelper.webView()->layout(); | 1719 webViewHelper.webView()->layout(); |
| 1756 EXPECT_EQ(800, webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->la
youtSize().height()); | 1720 EXPECT_EQ(800, webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->la
youtSize().height()); |
| 1757 } | 1721 } |
| 1758 | 1722 |
| 1759 TEST_P(ParameterizedWebFrameTest, ZeroValuesQuirk) | 1723 TEST_P(ParameterizedWebFrameTest, ZeroValuesQuirk) |
| 1760 { | 1724 { |
| 1761 UseMockScrollbarSettings mockScrollbarSettings; | |
| 1762 registerMockedHttpURLLoad("viewport-zero-values.html"); | 1725 registerMockedHttpURLLoad("viewport-zero-values.html"); |
| 1763 | 1726 |
| 1764 FixedLayoutTestWebViewClient client; | 1727 FixedLayoutTestWebViewClient client; |
| 1765 client.m_screenInfo.deviceScaleFactor = 1; | 1728 client.m_screenInfo.deviceScaleFactor = 1; |
| 1766 int viewportWidth = 640; | 1729 int viewportWidth = 640; |
| 1767 int viewportHeight = 480; | 1730 int viewportHeight = 480; |
| 1768 | 1731 |
| 1769 FrameTestHelpers::WebViewHelper webViewHelper(this); | 1732 FrameTestHelpers::WebViewHelper webViewHelper(this); |
| 1770 webViewHelper.initialize(true, 0, &client, enableViewportSettings); | 1733 webViewHelper.initialize(true, 0, &client, enableViewportSettings); |
| 1771 webViewHelper.webView()->settings()->setViewportMetaZeroValuesQuirk(true); | 1734 webViewHelper.webView()->settings()->setViewportMetaZeroValuesQuirk(true); |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1839 webViewHelper.webView()->settings()->setIgnoreMainFrameOverflowHiddenQuirk(t
rue); | 1802 webViewHelper.webView()->settings()->setIgnoreMainFrameOverflowHiddenQuirk(t
rue); |
| 1840 FrameTestHelpers::loadFrame(webViewHelper.webView()->mainFrame(), m_baseURL
+ "body-overflow-hidden.html"); | 1803 FrameTestHelpers::loadFrame(webViewHelper.webView()->mainFrame(), m_baseURL
+ "body-overflow-hidden.html"); |
| 1841 webViewHelper.webView()->resize(WebSize(viewportWidth, viewportHeight)); | 1804 webViewHelper.webView()->resize(WebSize(viewportWidth, viewportHeight)); |
| 1842 | 1805 |
| 1843 FrameView* view = webViewHelper.webViewImpl()->mainFrameImpl()->frameView(); | 1806 FrameView* view = webViewHelper.webViewImpl()->mainFrameImpl()->frameView(); |
| 1844 EXPECT_TRUE(view->userInputScrollable(VerticalScrollbar)); | 1807 EXPECT_TRUE(view->userInputScrollable(VerticalScrollbar)); |
| 1845 } | 1808 } |
| 1846 | 1809 |
| 1847 TEST_P(ParameterizedWebFrameTest, NonZeroValuesNoQuirk) | 1810 TEST_P(ParameterizedWebFrameTest, NonZeroValuesNoQuirk) |
| 1848 { | 1811 { |
| 1849 UseMockScrollbarSettings mockScrollbarSettings; | |
| 1850 registerMockedHttpURLLoad("viewport-nonzero-values.html"); | 1812 registerMockedHttpURLLoad("viewport-nonzero-values.html"); |
| 1851 | 1813 |
| 1852 FixedLayoutTestWebViewClient client; | 1814 FixedLayoutTestWebViewClient client; |
| 1853 client.m_screenInfo.deviceScaleFactor = 1; | 1815 client.m_screenInfo.deviceScaleFactor = 1; |
| 1854 int viewportWidth = 640; | 1816 int viewportWidth = 640; |
| 1855 int viewportHeight = 480; | 1817 int viewportHeight = 480; |
| 1856 float expectedPageScaleFactor = 0.5f; | 1818 float expectedPageScaleFactor = 0.5f; |
| 1857 | 1819 |
| 1858 FrameTestHelpers::WebViewHelper webViewHelper(this); | 1820 FrameTestHelpers::WebViewHelper webViewHelper(this); |
| 1859 webViewHelper.initialize(true, 0, &client, enableViewportSettings); | 1821 webViewHelper.initialize(true, 0, &client, enableViewportSettings); |
| 1860 webViewHelper.webView()->settings()->setViewportMetaZeroValuesQuirk(true); | 1822 webViewHelper.webView()->settings()->setViewportMetaZeroValuesQuirk(true); |
| 1861 webViewHelper.webView()->settings()->setWideViewportQuirkEnabled(true); | 1823 webViewHelper.webView()->settings()->setWideViewportQuirkEnabled(true); |
| 1862 FrameTestHelpers::loadFrame(webViewHelper.webView()->mainFrame(), m_baseURL
+ "viewport-nonzero-values.html"); | 1824 FrameTestHelpers::loadFrame(webViewHelper.webView()->mainFrame(), m_baseURL
+ "viewport-nonzero-values.html"); |
| 1863 webViewHelper.webView()->resize(WebSize(viewportWidth, viewportHeight)); | 1825 webViewHelper.webView()->resize(WebSize(viewportWidth, viewportHeight)); |
| 1864 | 1826 |
| 1865 EXPECT_EQ(viewportWidth / expectedPageScaleFactor, webViewHelper.webViewImpl
()->mainFrameImpl()->frameView()->layoutSize().width()); | 1827 EXPECT_EQ(viewportWidth / expectedPageScaleFactor, webViewHelper.webViewImpl
()->mainFrameImpl()->frameView()->layoutSize().width()); |
| 1866 EXPECT_EQ(expectedPageScaleFactor, webViewHelper.webView()->pageScaleFactor(
)); | 1828 EXPECT_EQ(expectedPageScaleFactor, webViewHelper.webView()->pageScaleFactor(
)); |
| 1867 | 1829 |
| 1868 webViewHelper.webView()->settings()->setUseWideViewport(true); | 1830 webViewHelper.webView()->settings()->setUseWideViewport(true); |
| 1869 webViewHelper.webView()->layout(); | 1831 webViewHelper.webView()->layout(); |
| 1870 EXPECT_EQ(viewportWidth / expectedPageScaleFactor, webViewHelper.webViewImpl
()->mainFrameImpl()->frameView()->layoutSize().width()); | 1832 EXPECT_EQ(viewportWidth / expectedPageScaleFactor, webViewHelper.webViewImpl
()->mainFrameImpl()->frameView()->layoutSize().width()); |
| 1871 EXPECT_EQ(expectedPageScaleFactor, webViewHelper.webView()->pageScaleFactor(
)); | 1833 EXPECT_EQ(expectedPageScaleFactor, webViewHelper.webView()->pageScaleFactor(
)); |
| 1872 } | 1834 } |
| 1873 | 1835 |
| 1874 TEST_P(ParameterizedWebFrameTest, setPageScaleFactorDoesNotLayout) | 1836 TEST_P(ParameterizedWebFrameTest, setPageScaleFactorDoesNotLayout) |
| 1875 { | 1837 { |
| 1876 UseMockScrollbarSettings mockScrollbarSettings; | |
| 1877 registerMockedHttpURLLoad("fixed_layout.html"); | 1838 registerMockedHttpURLLoad("fixed_layout.html"); |
| 1878 | 1839 |
| 1879 FixedLayoutTestWebViewClient client; | 1840 FixedLayoutTestWebViewClient client; |
| 1880 client.m_screenInfo.deviceScaleFactor = 1; | 1841 client.m_screenInfo.deviceScaleFactor = 1; |
| 1881 // Small viewport to ensure there are always scrollbars. | 1842 // Small viewport to ensure there are always scrollbars. |
| 1882 int viewportWidth = 64; | 1843 int viewportWidth = 64; |
| 1883 int viewportHeight = 48; | 1844 int viewportHeight = 48; |
| 1884 | 1845 |
| 1885 FrameTestHelpers::WebViewHelper webViewHelper(this); | 1846 FrameTestHelpers::WebViewHelper webViewHelper(this); |
| 1886 webViewHelper.initializeAndLoad(m_baseURL + "fixed_layout.html", true, 0, &c
lient, enableViewportSettings); | 1847 webViewHelper.initializeAndLoad(m_baseURL + "fixed_layout.html", true, 0, &c
lient, enableViewportSettings); |
| 1887 webViewHelper.webView()->resize(WebSize(viewportWidth, viewportHeight)); | 1848 webViewHelper.webView()->resize(WebSize(viewportWidth, viewportHeight)); |
| 1888 webViewHelper.webView()->layout(); | 1849 webViewHelper.webView()->layout(); |
| 1889 | 1850 |
| 1890 int prevLayoutCount = webViewHelper.webViewImpl()->mainFrameImpl()->frameVie
w()->layoutCount(); | 1851 int prevLayoutCount = webViewHelper.webViewImpl()->mainFrameImpl()->frameVie
w()->layoutCount(); |
| 1891 webViewHelper.webViewImpl()->setPageScaleFactor(3); | 1852 webViewHelper.webViewImpl()->setPageScaleFactor(3); |
| 1892 EXPECT_FALSE(webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->need
sLayout()); | 1853 EXPECT_FALSE(webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->need
sLayout()); |
| 1893 EXPECT_EQ(prevLayoutCount, webViewHelper.webViewImpl()->mainFrameImpl()->fra
meView()->layoutCount()); | 1854 EXPECT_EQ(prevLayoutCount, webViewHelper.webViewImpl()->mainFrameImpl()->fra
meView()->layoutCount()); |
| 1894 } | 1855 } |
| 1895 | 1856 |
| 1896 TEST_P(ParameterizedWebFrameTest, setPageScaleFactorWithOverlayScrollbarsDoesNot
Layout) | 1857 TEST_P(ParameterizedWebFrameTest, setPageScaleFactorWithOverlayScrollbarsDoesNot
Layout) |
| 1897 { | 1858 { |
| 1898 UseMockScrollbarSettings mockScrollbarSettings; | |
| 1899 | |
| 1900 registerMockedHttpURLLoad("fixed_layout.html"); | 1859 registerMockedHttpURLLoad("fixed_layout.html"); |
| 1901 | 1860 |
| 1902 FixedLayoutTestWebViewClient client; | 1861 FixedLayoutTestWebViewClient client; |
| 1903 client.m_screenInfo.deviceScaleFactor = 1; | 1862 client.m_screenInfo.deviceScaleFactor = 1; |
| 1904 int viewportWidth = 640; | 1863 int viewportWidth = 640; |
| 1905 int viewportHeight = 480; | 1864 int viewportHeight = 480; |
| 1906 | 1865 |
| 1907 FrameTestHelpers::WebViewHelper webViewHelper(this); | 1866 FrameTestHelpers::WebViewHelper webViewHelper(this); |
| 1908 webViewHelper.initializeAndLoad(m_baseURL + "fixed_layout.html", true, 0, &c
lient, enableViewportSettings); | 1867 webViewHelper.initializeAndLoad(m_baseURL + "fixed_layout.html", true, 0, &c
lient, enableViewportSettings); |
| 1909 webViewHelper.webView()->resize(WebSize(viewportWidth, viewportHeight)); | 1868 webViewHelper.webView()->resize(WebSize(viewportWidth, viewportHeight)); |
| 1910 webViewHelper.webView()->layout(); | 1869 webViewHelper.webView()->layout(); |
| 1911 | 1870 |
| 1912 int prevLayoutCount = webViewHelper.webViewImpl()->mainFrameImpl()->frameVie
w()->layoutCount(); | 1871 int prevLayoutCount = webViewHelper.webViewImpl()->mainFrameImpl()->frameVie
w()->layoutCount(); |
| 1913 webViewHelper.webViewImpl()->setPageScaleFactor(30); | 1872 webViewHelper.webViewImpl()->setPageScaleFactor(30); |
| 1914 EXPECT_FALSE(webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->need
sLayout()); | 1873 EXPECT_FALSE(webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->need
sLayout()); |
| 1915 EXPECT_EQ(prevLayoutCount, webViewHelper.webViewImpl()->mainFrameImpl()->fra
meView()->layoutCount()); | 1874 EXPECT_EQ(prevLayoutCount, webViewHelper.webViewImpl()->mainFrameImpl()->fra
meView()->layoutCount()); |
| 1916 | 1875 |
| 1917 } | 1876 } |
| 1918 | 1877 |
| 1919 TEST_P(ParameterizedWebFrameTest, pageScaleFactorWrittenToHistoryItem) | 1878 TEST_P(ParameterizedWebFrameTest, pageScaleFactorWrittenToHistoryItem) |
| 1920 { | 1879 { |
| 1921 UseMockScrollbarSettings mockScrollbarSettings; | |
| 1922 registerMockedHttpURLLoad("fixed_layout.html"); | 1880 registerMockedHttpURLLoad("fixed_layout.html"); |
| 1923 | 1881 |
| 1924 FixedLayoutTestWebViewClient client; | 1882 FixedLayoutTestWebViewClient client; |
| 1925 client.m_screenInfo.deviceScaleFactor = 1; | 1883 client.m_screenInfo.deviceScaleFactor = 1; |
| 1926 int viewportWidth = 640; | 1884 int viewportWidth = 640; |
| 1927 int viewportHeight = 480; | 1885 int viewportHeight = 480; |
| 1928 | 1886 |
| 1929 FrameTestHelpers::WebViewHelper webViewHelper(this); | 1887 FrameTestHelpers::WebViewHelper webViewHelper(this); |
| 1930 webViewHelper.initializeAndLoad(m_baseURL + "fixed_layout.html", true, 0, &c
lient, enableViewportSettings); | 1888 webViewHelper.initializeAndLoad(m_baseURL + "fixed_layout.html", true, 0, &c
lient, enableViewportSettings); |
| 1931 webViewHelper.webView()->resize(WebSize(viewportWidth, viewportHeight)); | 1889 webViewHelper.webView()->resize(WebSize(viewportWidth, viewportHeight)); |
| 1932 webViewHelper.webView()->layout(); | 1890 webViewHelper.webView()->layout(); |
| 1933 | 1891 |
| 1934 webViewHelper.webView()->setPageScaleFactor(3); | 1892 webViewHelper.webView()->setPageScaleFactor(3); |
| 1935 EXPECT_EQ(3, toLocalFrame(webViewHelper.webViewImpl()->page()->mainFrame())-
>loader().currentItem()->pageScaleFactor()); | 1893 EXPECT_EQ(3, toLocalFrame(webViewHelper.webViewImpl()->page()->mainFrame())-
>loader().currentItem()->pageScaleFactor()); |
| 1936 } | 1894 } |
| 1937 | 1895 |
| 1938 TEST_P(ParameterizedWebFrameTest, initialScaleWrittenToHistoryItem) | 1896 TEST_P(ParameterizedWebFrameTest, initialScaleWrittenToHistoryItem) |
| 1939 { | 1897 { |
| 1940 UseMockScrollbarSettings mockScrollbarSettings; | |
| 1941 registerMockedHttpURLLoad("fixed_layout.html"); | 1898 registerMockedHttpURLLoad("fixed_layout.html"); |
| 1942 | 1899 |
| 1943 FixedLayoutTestWebViewClient client; | 1900 FixedLayoutTestWebViewClient client; |
| 1944 client.m_screenInfo.deviceScaleFactor = 1; | 1901 client.m_screenInfo.deviceScaleFactor = 1; |
| 1945 int viewportWidth = 640; | 1902 int viewportWidth = 640; |
| 1946 int viewportHeight = 480; | 1903 int viewportHeight = 480; |
| 1947 | 1904 |
| 1948 FrameTestHelpers::WebViewHelper webViewHelper(this); | 1905 FrameTestHelpers::WebViewHelper webViewHelper(this); |
| 1949 webViewHelper.initialize(true, 0, &client, enableViewportSettings); | 1906 webViewHelper.initialize(true, 0, &client, enableViewportSettings); |
| 1950 webViewHelper.webView()->setDefaultPageScaleLimits(0.25f, 5); | 1907 webViewHelper.webView()->setDefaultPageScaleLimits(0.25f, 5); |
| 1951 FrameTestHelpers::loadFrame(webViewHelper.webView()->mainFrame(), m_baseURL
+ "fixed_layout.html"); | 1908 FrameTestHelpers::loadFrame(webViewHelper.webView()->mainFrame(), m_baseURL
+ "fixed_layout.html"); |
| 1952 webViewHelper.webView()->resize(WebSize(viewportWidth, viewportHeight)); | 1909 webViewHelper.webView()->resize(WebSize(viewportWidth, viewportHeight)); |
| 1953 webViewHelper.webView()->layout(); | 1910 webViewHelper.webView()->layout(); |
| 1954 | 1911 |
| 1955 int defaultFixedLayoutWidth = 980; | 1912 int defaultFixedLayoutWidth = 980; |
| 1956 float minimumPageScaleFactor = viewportWidth / (float) defaultFixedLayoutWid
th; | 1913 float minimumPageScaleFactor = viewportWidth / (float) defaultFixedLayoutWid
th; |
| 1957 EXPECT_EQ(minimumPageScaleFactor, toLocalFrame(webViewHelper.webViewImpl()->
page()->mainFrame())->loader().currentItem()->pageScaleFactor()); | 1914 EXPECT_EQ(minimumPageScaleFactor, toLocalFrame(webViewHelper.webViewImpl()->
page()->mainFrame())->loader().currentItem()->pageScaleFactor()); |
| 1958 } | 1915 } |
| 1959 | 1916 |
| 1960 TEST_P(ParameterizedWebFrameTest, pageScaleFactorDoesntShrinkFrameView) | 1917 TEST_P(ParameterizedWebFrameTest, pageScaleFactorDoesntShrinkFrameView) |
| 1961 { | 1918 { |
| 1962 UseMockScrollbarSettings mockScrollbarSettings; | |
| 1963 registerMockedHttpURLLoad("large-div.html"); | 1919 registerMockedHttpURLLoad("large-div.html"); |
| 1964 | 1920 |
| 1965 FixedLayoutTestWebViewClient client; | 1921 FixedLayoutTestWebViewClient client; |
| 1966 client.m_screenInfo.deviceScaleFactor = 1; | 1922 client.m_screenInfo.deviceScaleFactor = 1; |
| 1967 // Small viewport to ensure there are always scrollbars. | 1923 // Small viewport to ensure there are always scrollbars. |
| 1968 int viewportWidth = 64; | 1924 int viewportWidth = 64; |
| 1969 int viewportHeight = 48; | 1925 int viewportHeight = 48; |
| 1970 | 1926 |
| 1971 FrameTestHelpers::WebViewHelper webViewHelper(this); | 1927 FrameTestHelpers::WebViewHelper webViewHelper(this); |
| 1972 webViewHelper.initializeAndLoad(m_baseURL + "large-div.html", true, 0, &clie
nt, enableViewportSettings); | 1928 webViewHelper.initializeAndLoad(m_baseURL + "large-div.html", true, 0, &clie
nt, enableViewportSettings); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 1993 EXPECT_EQ(viewportWidthMinusScrollbar, unscaledSizeMinusScrollbar.width()); | 1949 EXPECT_EQ(viewportWidthMinusScrollbar, unscaledSizeMinusScrollbar.width()); |
| 1994 EXPECT_EQ(viewportHeightMinusScrollbar, unscaledSizeMinusScrollbar.height())
; | 1950 EXPECT_EQ(viewportHeightMinusScrollbar, unscaledSizeMinusScrollbar.height())
; |
| 1995 | 1951 |
| 1996 IntSize frameViewSize = view->visibleContentRect().size(); | 1952 IntSize frameViewSize = view->visibleContentRect().size(); |
| 1997 EXPECT_EQ(viewportWidthMinusScrollbar, frameViewSize.width()); | 1953 EXPECT_EQ(viewportWidthMinusScrollbar, frameViewSize.width()); |
| 1998 EXPECT_EQ(viewportHeightMinusScrollbar, frameViewSize.height()); | 1954 EXPECT_EQ(viewportHeightMinusScrollbar, frameViewSize.height()); |
| 1999 } | 1955 } |
| 2000 | 1956 |
| 2001 TEST_P(ParameterizedWebFrameTest, pageScaleFactorDoesNotApplyCssTransform) | 1957 TEST_P(ParameterizedWebFrameTest, pageScaleFactorDoesNotApplyCssTransform) |
| 2002 { | 1958 { |
| 2003 UseMockScrollbarSettings mockScrollbarSettings; | |
| 2004 registerMockedHttpURLLoad("fixed_layout.html"); | 1959 registerMockedHttpURLLoad("fixed_layout.html"); |
| 2005 | 1960 |
| 2006 FixedLayoutTestWebViewClient client; | 1961 FixedLayoutTestWebViewClient client; |
| 2007 client.m_screenInfo.deviceScaleFactor = 1; | 1962 client.m_screenInfo.deviceScaleFactor = 1; |
| 2008 int viewportWidth = 640; | 1963 int viewportWidth = 640; |
| 2009 int viewportHeight = 480; | 1964 int viewportHeight = 480; |
| 2010 | 1965 |
| 2011 FrameTestHelpers::WebViewHelper webViewHelper(this); | 1966 FrameTestHelpers::WebViewHelper webViewHelper(this); |
| 2012 webViewHelper.initializeAndLoad(m_baseURL + "fixed_layout.html", true, 0, &c
lient, enableViewportSettings); | 1967 webViewHelper.initializeAndLoad(m_baseURL + "fixed_layout.html", true, 0, &c
lient, enableViewportSettings); |
| 2013 webViewHelper.webView()->resize(WebSize(viewportWidth, viewportHeight)); | 1968 webViewHelper.webView()->resize(WebSize(viewportWidth, viewportHeight)); |
| 2014 webViewHelper.webView()->layout(); | 1969 webViewHelper.webView()->layout(); |
| 2015 | 1970 |
| 2016 webViewHelper.webView()->setPageScaleFactor(2); | 1971 webViewHelper.webView()->setPageScaleFactor(2); |
| 2017 | 1972 |
| 2018 EXPECT_EQ(980, toLocalFrame(webViewHelper.webViewImpl()->page()->mainFrame()
)->contentLayoutObject()->unscaledDocumentRect().width()); | 1973 EXPECT_EQ(980, toLocalFrame(webViewHelper.webViewImpl()->page()->mainFrame()
)->contentLayoutObject()->unscaledDocumentRect().width()); |
| 2019 EXPECT_EQ(980, webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->co
ntentsSize().width()); | 1974 EXPECT_EQ(980, webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->co
ntentsSize().width()); |
| 2020 } | 1975 } |
| 2021 | 1976 |
| 2022 TEST_P(ParameterizedWebFrameTest, targetDensityDpiHigh) | 1977 TEST_P(ParameterizedWebFrameTest, targetDensityDpiHigh) |
| 2023 { | 1978 { |
| 2024 UseMockScrollbarSettings mockScrollbarSettings; | |
| 2025 registerMockedHttpURLLoad("viewport-target-densitydpi-high.html"); | 1979 registerMockedHttpURLLoad("viewport-target-densitydpi-high.html"); |
| 2026 | 1980 |
| 2027 FixedLayoutTestWebViewClient client; | 1981 FixedLayoutTestWebViewClient client; |
| 2028 // high-dpi = 240 | 1982 // high-dpi = 240 |
| 2029 float targetDpi = 240.0f; | 1983 float targetDpi = 240.0f; |
| 2030 float deviceScaleFactors[] = { 1.0f, 4.0f / 3.0f, 2.0f }; | 1984 float deviceScaleFactors[] = { 1.0f, 4.0f / 3.0f, 2.0f }; |
| 2031 int viewportWidth = 640; | 1985 int viewportWidth = 640; |
| 2032 int viewportHeight = 480; | 1986 int viewportHeight = 480; |
| 2033 | 1987 |
| 2034 for (size_t i = 0; i < ARRAY_SIZE(deviceScaleFactors); ++i) { | 1988 for (size_t i = 0; i < ARRAY_SIZE(deviceScaleFactors); ++i) { |
| (...skipping 11 matching lines...) Expand all Loading... |
| 2046 // physical pixels. | 2000 // physical pixels. |
| 2047 float densityDpiScaleRatio = deviceScaleFactor * targetDpi / deviceDpi; | 2001 float densityDpiScaleRatio = deviceScaleFactor * targetDpi / deviceDpi; |
| 2048 EXPECT_NEAR(viewportWidth * densityDpiScaleRatio, webViewHelper.webViewI
mpl()->mainFrameImpl()->frameView()->layoutSize().width(), 1.0f); | 2002 EXPECT_NEAR(viewportWidth * densityDpiScaleRatio, webViewHelper.webViewI
mpl()->mainFrameImpl()->frameView()->layoutSize().width(), 1.0f); |
| 2049 EXPECT_NEAR(viewportHeight * densityDpiScaleRatio, webViewHelper.webView
Impl()->mainFrameImpl()->frameView()->layoutSize().height(), 1.0f); | 2003 EXPECT_NEAR(viewportHeight * densityDpiScaleRatio, webViewHelper.webView
Impl()->mainFrameImpl()->frameView()->layoutSize().height(), 1.0f); |
| 2050 EXPECT_NEAR(1.0f / densityDpiScaleRatio, webViewHelper.webView()->pageSc
aleFactor(), 0.01f); | 2004 EXPECT_NEAR(1.0f / densityDpiScaleRatio, webViewHelper.webView()->pageSc
aleFactor(), 0.01f); |
| 2051 } | 2005 } |
| 2052 } | 2006 } |
| 2053 | 2007 |
| 2054 TEST_P(ParameterizedWebFrameTest, targetDensityDpiDevice) | 2008 TEST_P(ParameterizedWebFrameTest, targetDensityDpiDevice) |
| 2055 { | 2009 { |
| 2056 UseMockScrollbarSettings mockScrollbarSettings; | |
| 2057 registerMockedHttpURLLoad("viewport-target-densitydpi-device.html"); | 2010 registerMockedHttpURLLoad("viewport-target-densitydpi-device.html"); |
| 2058 | 2011 |
| 2059 float deviceScaleFactors[] = { 1.0f, 4.0f / 3.0f, 2.0f }; | 2012 float deviceScaleFactors[] = { 1.0f, 4.0f / 3.0f, 2.0f }; |
| 2060 | 2013 |
| 2061 FixedLayoutTestWebViewClient client; | 2014 FixedLayoutTestWebViewClient client; |
| 2062 int viewportWidth = 640; | 2015 int viewportWidth = 640; |
| 2063 int viewportHeight = 480; | 2016 int viewportHeight = 480; |
| 2064 | 2017 |
| 2065 for (size_t i = 0; i < ARRAY_SIZE(deviceScaleFactors); ++i) { | 2018 for (size_t i = 0; i < ARRAY_SIZE(deviceScaleFactors); ++i) { |
| 2066 client.m_screenInfo.deviceScaleFactor = deviceScaleFactors[i]; | 2019 client.m_screenInfo.deviceScaleFactor = deviceScaleFactors[i]; |
| 2067 | 2020 |
| 2068 FrameTestHelpers::WebViewHelper webViewHelper(this); | 2021 FrameTestHelpers::WebViewHelper webViewHelper(this); |
| 2069 webViewHelper.initializeAndLoad(m_baseURL + "viewport-target-densitydpi-
device.html", true, 0, &client, enableViewportSettings); | 2022 webViewHelper.initializeAndLoad(m_baseURL + "viewport-target-densitydpi-
device.html", true, 0, &client, enableViewportSettings); |
| 2070 webViewHelper.webView()->settings()->setWideViewportQuirkEnabled(true); | 2023 webViewHelper.webView()->settings()->setWideViewportQuirkEnabled(true); |
| 2071 webViewHelper.webView()->settings()->setSupportDeprecatedTargetDensityDP
I(true); | 2024 webViewHelper.webView()->settings()->setSupportDeprecatedTargetDensityDP
I(true); |
| 2072 webViewHelper.webView()->resize(WebSize(viewportWidth, viewportHeight)); | 2025 webViewHelper.webView()->resize(WebSize(viewportWidth, viewportHeight)); |
| 2073 | 2026 |
| 2074 EXPECT_NEAR(viewportWidth * client.m_screenInfo.deviceScaleFactor, webVi
ewHelper.webViewImpl()->mainFrameImpl()->frameView()->layoutSize().width(), 1.0f
); | 2027 EXPECT_NEAR(viewportWidth * client.m_screenInfo.deviceScaleFactor, webVi
ewHelper.webViewImpl()->mainFrameImpl()->frameView()->layoutSize().width(), 1.0f
); |
| 2075 EXPECT_NEAR(viewportHeight * client.m_screenInfo.deviceScaleFactor, webV
iewHelper.webViewImpl()->mainFrameImpl()->frameView()->layoutSize().height(), 1.
0f); | 2028 EXPECT_NEAR(viewportHeight * client.m_screenInfo.deviceScaleFactor, webV
iewHelper.webViewImpl()->mainFrameImpl()->frameView()->layoutSize().height(), 1.
0f); |
| 2076 EXPECT_NEAR(1.0f / client.m_screenInfo.deviceScaleFactor, webViewHelper.
webView()->pageScaleFactor(), 0.01f); | 2029 EXPECT_NEAR(1.0f / client.m_screenInfo.deviceScaleFactor, webViewHelper.
webView()->pageScaleFactor(), 0.01f); |
| 2077 } | 2030 } |
| 2078 } | 2031 } |
| 2079 | 2032 |
| 2080 TEST_P(ParameterizedWebFrameTest, targetDensityDpiDeviceAndFixedWidth) | 2033 TEST_P(ParameterizedWebFrameTest, targetDensityDpiDeviceAndFixedWidth) |
| 2081 { | 2034 { |
| 2082 UseMockScrollbarSettings mockScrollbarSettings; | |
| 2083 registerMockedHttpURLLoad("viewport-target-densitydpi-device-and-fixed-width
.html"); | 2035 registerMockedHttpURLLoad("viewport-target-densitydpi-device-and-fixed-width
.html"); |
| 2084 | 2036 |
| 2085 float deviceScaleFactors[] = { 1.0f, 4.0f / 3.0f, 2.0f }; | 2037 float deviceScaleFactors[] = { 1.0f, 4.0f / 3.0f, 2.0f }; |
| 2086 | 2038 |
| 2087 FixedLayoutTestWebViewClient client; | 2039 FixedLayoutTestWebViewClient client; |
| 2088 int viewportWidth = 640; | 2040 int viewportWidth = 640; |
| 2089 int viewportHeight = 480; | 2041 int viewportHeight = 480; |
| 2090 | 2042 |
| 2091 for (size_t i = 0; i < ARRAY_SIZE(deviceScaleFactors); ++i) { | 2043 for (size_t i = 0; i < ARRAY_SIZE(deviceScaleFactors); ++i) { |
| 2092 client.m_screenInfo.deviceScaleFactor = deviceScaleFactors[i]; | 2044 client.m_screenInfo.deviceScaleFactor = deviceScaleFactors[i]; |
| 2093 | 2045 |
| 2094 FrameTestHelpers::WebViewHelper webViewHelper(this); | 2046 FrameTestHelpers::WebViewHelper webViewHelper(this); |
| 2095 webViewHelper.initializeAndLoad(m_baseURL + "viewport-target-densitydpi-
device-and-fixed-width.html", true, 0, &client, enableViewportSettings); | 2047 webViewHelper.initializeAndLoad(m_baseURL + "viewport-target-densitydpi-
device-and-fixed-width.html", true, 0, &client, enableViewportSettings); |
| 2096 webViewHelper.webView()->settings()->setWideViewportQuirkEnabled(true); | 2048 webViewHelper.webView()->settings()->setWideViewportQuirkEnabled(true); |
| 2097 webViewHelper.webView()->settings()->setSupportDeprecatedTargetDensityDP
I(true); | 2049 webViewHelper.webView()->settings()->setSupportDeprecatedTargetDensityDP
I(true); |
| 2098 webViewHelper.webView()->settings()->setUseWideViewport(true); | 2050 webViewHelper.webView()->settings()->setUseWideViewport(true); |
| 2099 webViewHelper.webView()->resize(WebSize(viewportWidth, viewportHeight)); | 2051 webViewHelper.webView()->resize(WebSize(viewportWidth, viewportHeight)); |
| 2100 | 2052 |
| 2101 EXPECT_NEAR(viewportWidth, webViewHelper.webViewImpl()->mainFrameImpl()-
>frameView()->layoutSize().width(), 1.0f); | 2053 EXPECT_NEAR(viewportWidth, webViewHelper.webViewImpl()->mainFrameImpl()-
>frameView()->layoutSize().width(), 1.0f); |
| 2102 EXPECT_NEAR(viewportHeight, webViewHelper.webViewImpl()->mainFrameImpl()
->frameView()->layoutSize().height(), 1.0f); | 2054 EXPECT_NEAR(viewportHeight, webViewHelper.webViewImpl()->mainFrameImpl()
->frameView()->layoutSize().height(), 1.0f); |
| 2103 EXPECT_NEAR(1.0f, webViewHelper.webView()->pageScaleFactor(), 0.01f); | 2055 EXPECT_NEAR(1.0f, webViewHelper.webView()->pageScaleFactor(), 0.01f); |
| 2104 } | 2056 } |
| 2105 } | 2057 } |
| 2106 | 2058 |
| 2107 TEST_P(ParameterizedWebFrameTest, NoWideViewportAndScaleLessThanOne) | 2059 TEST_P(ParameterizedWebFrameTest, NoWideViewportAndScaleLessThanOne) |
| 2108 { | 2060 { |
| 2109 UseMockScrollbarSettings mockScrollbarSettings; | |
| 2110 registerMockedHttpURLLoad("viewport-initial-scale-less-than-1.html"); | 2061 registerMockedHttpURLLoad("viewport-initial-scale-less-than-1.html"); |
| 2111 | 2062 |
| 2112 FixedLayoutTestWebViewClient client; | 2063 FixedLayoutTestWebViewClient client; |
| 2113 client.m_screenInfo.deviceScaleFactor = 1.33f; | 2064 client.m_screenInfo.deviceScaleFactor = 1.33f; |
| 2114 int viewportWidth = 640; | 2065 int viewportWidth = 640; |
| 2115 int viewportHeight = 480; | 2066 int viewportHeight = 480; |
| 2116 | 2067 |
| 2117 FrameTestHelpers::WebViewHelper webViewHelper(this); | 2068 FrameTestHelpers::WebViewHelper webViewHelper(this); |
| 2118 webViewHelper.initializeAndLoad(m_baseURL + "viewport-initial-scale-less-tha
n-1.html", true, 0, &client, enableViewportSettings); | 2069 webViewHelper.initializeAndLoad(m_baseURL + "viewport-initial-scale-less-tha
n-1.html", true, 0, &client, enableViewportSettings); |
| 2119 webViewHelper.webView()->settings()->setSupportDeprecatedTargetDensityDPI(tr
ue); | 2070 webViewHelper.webView()->settings()->setSupportDeprecatedTargetDensityDPI(tr
ue); |
| 2120 webViewHelper.webView()->settings()->setWideViewportQuirkEnabled(true); | 2071 webViewHelper.webView()->settings()->setWideViewportQuirkEnabled(true); |
| 2121 webViewHelper.webView()->settings()->setUseWideViewport(false); | 2072 webViewHelper.webView()->settings()->setUseWideViewport(false); |
| 2122 webViewHelper.webView()->resize(WebSize(viewportWidth, viewportHeight)); | 2073 webViewHelper.webView()->resize(WebSize(viewportWidth, viewportHeight)); |
| 2123 webViewHelper.webView()->layout(); | 2074 webViewHelper.webView()->layout(); |
| 2124 | 2075 |
| 2125 EXPECT_NEAR(viewportWidth * client.m_screenInfo.deviceScaleFactor, webViewHe
lper.webViewImpl()->mainFrameImpl()->frameView()->layoutSize().width(), 1.0f); | 2076 EXPECT_NEAR(viewportWidth * client.m_screenInfo.deviceScaleFactor, webViewHe
lper.webViewImpl()->mainFrameImpl()->frameView()->layoutSize().width(), 1.0f); |
| 2126 EXPECT_NEAR(viewportHeight * client.m_screenInfo.deviceScaleFactor, webViewH
elper.webViewImpl()->mainFrameImpl()->frameView()->layoutSize().height(), 1.0f); | 2077 EXPECT_NEAR(viewportHeight * client.m_screenInfo.deviceScaleFactor, webViewH
elper.webViewImpl()->mainFrameImpl()->frameView()->layoutSize().height(), 1.0f); |
| 2127 EXPECT_NEAR(1.0f / client.m_screenInfo.deviceScaleFactor, webViewHelper.webV
iew()->pageScaleFactor(), 0.01f); | 2078 EXPECT_NEAR(1.0f / client.m_screenInfo.deviceScaleFactor, webViewHelper.webV
iew()->pageScaleFactor(), 0.01f); |
| 2128 } | 2079 } |
| 2129 | 2080 |
| 2130 TEST_P(ParameterizedWebFrameTest, NoWideViewportAndScaleLessThanOneWithDeviceWid
th) | 2081 TEST_P(ParameterizedWebFrameTest, NoWideViewportAndScaleLessThanOneWithDeviceWid
th) |
| 2131 { | 2082 { |
| 2132 UseMockScrollbarSettings mockScrollbarSettings; | |
| 2133 registerMockedHttpURLLoad("viewport-initial-scale-less-than-1-device-width.h
tml"); | 2083 registerMockedHttpURLLoad("viewport-initial-scale-less-than-1-device-width.h
tml"); |
| 2134 | 2084 |
| 2135 FixedLayoutTestWebViewClient client; | 2085 FixedLayoutTestWebViewClient client; |
| 2136 client.m_screenInfo.deviceScaleFactor = 1.33f; | 2086 client.m_screenInfo.deviceScaleFactor = 1.33f; |
| 2137 int viewportWidth = 640; | 2087 int viewportWidth = 640; |
| 2138 int viewportHeight = 480; | 2088 int viewportHeight = 480; |
| 2139 | 2089 |
| 2140 FrameTestHelpers::WebViewHelper webViewHelper(this); | 2090 FrameTestHelpers::WebViewHelper webViewHelper(this); |
| 2141 webViewHelper.initializeAndLoad(m_baseURL + "viewport-initial-scale-less-tha
n-1-device-width.html", true, 0, &client, enableViewportSettings); | 2091 webViewHelper.initializeAndLoad(m_baseURL + "viewport-initial-scale-less-tha
n-1-device-width.html", true, 0, &client, enableViewportSettings); |
| 2142 webViewHelper.webView()->settings()->setSupportDeprecatedTargetDensityDPI(tr
ue); | 2092 webViewHelper.webView()->settings()->setSupportDeprecatedTargetDensityDPI(tr
ue); |
| 2143 webViewHelper.webView()->settings()->setWideViewportQuirkEnabled(true); | 2093 webViewHelper.webView()->settings()->setWideViewportQuirkEnabled(true); |
| 2144 webViewHelper.webView()->settings()->setUseWideViewport(false); | 2094 webViewHelper.webView()->settings()->setUseWideViewport(false); |
| 2145 webViewHelper.webView()->resize(WebSize(viewportWidth, viewportHeight)); | 2095 webViewHelper.webView()->resize(WebSize(viewportWidth, viewportHeight)); |
| 2146 webViewHelper.webView()->layout(); | 2096 webViewHelper.webView()->layout(); |
| 2147 | 2097 |
| 2148 const float pageZoom = 0.25f; | 2098 const float pageZoom = 0.25f; |
| 2149 EXPECT_NEAR(viewportWidth * client.m_screenInfo.deviceScaleFactor / pageZoom
, webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->layoutSize().width(
), 1.0f); | 2099 EXPECT_NEAR(viewportWidth * client.m_screenInfo.deviceScaleFactor / pageZoom
, webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->layoutSize().width(
), 1.0f); |
| 2150 EXPECT_NEAR(viewportHeight * client.m_screenInfo.deviceScaleFactor / pageZoo
m, webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->layoutSize().heigh
t(), 1.0f); | 2100 EXPECT_NEAR(viewportHeight * client.m_screenInfo.deviceScaleFactor / pageZoo
m, webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->layoutSize().heigh
t(), 1.0f); |
| 2151 EXPECT_NEAR(1.0f / client.m_screenInfo.deviceScaleFactor, webViewHelper.webV
iew()->pageScaleFactor(), 0.01f); | 2101 EXPECT_NEAR(1.0f / client.m_screenInfo.deviceScaleFactor, webViewHelper.webV
iew()->pageScaleFactor(), 0.01f); |
| 2152 } | 2102 } |
| 2153 | 2103 |
| 2154 TEST_P(ParameterizedWebFrameTest, NoWideViewportAndNoViewportWithInitialPageScal
eOverride) | 2104 TEST_P(ParameterizedWebFrameTest, NoWideViewportAndNoViewportWithInitialPageScal
eOverride) |
| 2155 { | 2105 { |
| 2156 UseMockScrollbarSettings mockScrollbarSettings; | |
| 2157 registerMockedHttpURLLoad("large-div.html"); | 2106 registerMockedHttpURLLoad("large-div.html"); |
| 2158 | 2107 |
| 2159 FixedLayoutTestWebViewClient client; | 2108 FixedLayoutTestWebViewClient client; |
| 2160 int viewportWidth = 640; | 2109 int viewportWidth = 640; |
| 2161 int viewportHeight = 480; | 2110 int viewportHeight = 480; |
| 2162 float enforcedPageScaleFactor = 5.0f; | 2111 float enforcedPageScaleFactor = 5.0f; |
| 2163 | 2112 |
| 2164 FrameTestHelpers::WebViewHelper webViewHelper(this); | 2113 FrameTestHelpers::WebViewHelper webViewHelper(this); |
| 2165 webViewHelper.initializeAndLoad(m_baseURL + "large-div.html", true, 0, &clie
nt, enableViewportSettings); | 2114 webViewHelper.initializeAndLoad(m_baseURL + "large-div.html", true, 0, &clie
nt, enableViewportSettings); |
| 2166 webViewHelper.webView()->setDefaultPageScaleLimits(0.25f, 5); | 2115 webViewHelper.webView()->setDefaultPageScaleLimits(0.25f, 5); |
| 2167 webViewHelper.webView()->settings()->setWideViewportQuirkEnabled(true); | 2116 webViewHelper.webView()->settings()->setWideViewportQuirkEnabled(true); |
| 2168 webViewHelper.webView()->settings()->setUseWideViewport(false); | 2117 webViewHelper.webView()->settings()->setUseWideViewport(false); |
| 2169 webViewHelper.webView()->setInitialPageScaleOverride(enforcedPageScaleFactor
); | 2118 webViewHelper.webView()->setInitialPageScaleOverride(enforcedPageScaleFactor
); |
| 2170 webViewHelper.webView()->resize(WebSize(viewportWidth, viewportHeight)); | 2119 webViewHelper.webView()->resize(WebSize(viewportWidth, viewportHeight)); |
| 2171 webViewHelper.webView()->layout(); | 2120 webViewHelper.webView()->layout(); |
| 2172 | 2121 |
| 2173 EXPECT_NEAR(viewportWidth / enforcedPageScaleFactor, webViewHelper.webViewIm
pl()->mainFrameImpl()->frameView()->layoutSize().width(), 1.0f); | 2122 EXPECT_NEAR(viewportWidth / enforcedPageScaleFactor, webViewHelper.webViewIm
pl()->mainFrameImpl()->frameView()->layoutSize().width(), 1.0f); |
| 2174 EXPECT_NEAR(viewportHeight / enforcedPageScaleFactor, webViewHelper.webViewI
mpl()->mainFrameImpl()->frameView()->layoutSize().height(), 1.0f); | 2123 EXPECT_NEAR(viewportHeight / enforcedPageScaleFactor, webViewHelper.webViewI
mpl()->mainFrameImpl()->frameView()->layoutSize().height(), 1.0f); |
| 2175 EXPECT_NEAR(enforcedPageScaleFactor, webViewHelper.webView()->pageScaleFacto
r(), 0.01f); | 2124 EXPECT_NEAR(enforcedPageScaleFactor, webViewHelper.webView()->pageScaleFacto
r(), 0.01f); |
| 2176 } | 2125 } |
| 2177 | 2126 |
| 2178 TEST_P(ParameterizedWebFrameTest, NoUserScalableQuirkIgnoresViewportScale) | 2127 TEST_P(ParameterizedWebFrameTest, NoUserScalableQuirkIgnoresViewportScale) |
| 2179 { | 2128 { |
| 2180 UseMockScrollbarSettings mockScrollbarSettings; | |
| 2181 registerMockedHttpURLLoad("viewport-initial-scale-and-user-scalable-no.html"
); | 2129 registerMockedHttpURLLoad("viewport-initial-scale-and-user-scalable-no.html"
); |
| 2182 | 2130 |
| 2183 FixedLayoutTestWebViewClient client; | 2131 FixedLayoutTestWebViewClient client; |
| 2184 int viewportWidth = 640; | 2132 int viewportWidth = 640; |
| 2185 int viewportHeight = 480; | 2133 int viewportHeight = 480; |
| 2186 | 2134 |
| 2187 FrameTestHelpers::WebViewHelper webViewHelper(this); | 2135 FrameTestHelpers::WebViewHelper webViewHelper(this); |
| 2188 webViewHelper.initializeAndLoad(m_baseURL + "viewport-initial-scale-and-user
-scalable-no.html", true, 0, &client, enableViewportSettings); | 2136 webViewHelper.initializeAndLoad(m_baseURL + "viewport-initial-scale-and-user
-scalable-no.html", true, 0, &client, enableViewportSettings); |
| 2189 webViewHelper.webView()->settings()->setViewportMetaNonUserScalableQuirk(tru
e); | 2137 webViewHelper.webView()->settings()->setViewportMetaNonUserScalableQuirk(tru
e); |
| 2190 webViewHelper.webView()->resize(WebSize(viewportWidth, viewportHeight)); | 2138 webViewHelper.webView()->resize(WebSize(viewportWidth, viewportHeight)); |
| 2191 webViewHelper.webView()->layout(); | 2139 webViewHelper.webView()->layout(); |
| 2192 | 2140 |
| 2193 EXPECT_NEAR(viewportWidth, webViewHelper.webViewImpl()->mainFrameImpl()->fra
meView()->layoutSize().width(), 1.0f); | 2141 EXPECT_NEAR(viewportWidth, webViewHelper.webViewImpl()->mainFrameImpl()->fra
meView()->layoutSize().width(), 1.0f); |
| 2194 EXPECT_NEAR(viewportHeight, webViewHelper.webViewImpl()->mainFrameImpl()->fr
ameView()->layoutSize().height(), 1.0f); | 2142 EXPECT_NEAR(viewportHeight, webViewHelper.webViewImpl()->mainFrameImpl()->fr
ameView()->layoutSize().height(), 1.0f); |
| 2195 EXPECT_NEAR(1.0f, webViewHelper.webView()->pageScaleFactor(), 0.01f); | 2143 EXPECT_NEAR(1.0f, webViewHelper.webView()->pageScaleFactor(), 0.01f); |
| 2196 } | 2144 } |
| 2197 | 2145 |
| 2198 TEST_P(ParameterizedWebFrameTest, NoUserScalableQuirkIgnoresViewportScaleForNonW
ideViewport) | 2146 TEST_P(ParameterizedWebFrameTest, NoUserScalableQuirkIgnoresViewportScaleForNonW
ideViewport) |
| 2199 { | 2147 { |
| 2200 UseMockScrollbarSettings mockScrollbarSettings; | |
| 2201 registerMockedHttpURLLoad("viewport-initial-scale-and-user-scalable-no.html"
); | 2148 registerMockedHttpURLLoad("viewport-initial-scale-and-user-scalable-no.html"
); |
| 2202 | 2149 |
| 2203 FixedLayoutTestWebViewClient client; | 2150 FixedLayoutTestWebViewClient client; |
| 2204 client.m_screenInfo.deviceScaleFactor = 1.33f; | 2151 client.m_screenInfo.deviceScaleFactor = 1.33f; |
| 2205 int viewportWidth = 640; | 2152 int viewportWidth = 640; |
| 2206 int viewportHeight = 480; | 2153 int viewportHeight = 480; |
| 2207 | 2154 |
| 2208 FrameTestHelpers::WebViewHelper webViewHelper(this); | 2155 FrameTestHelpers::WebViewHelper webViewHelper(this); |
| 2209 webViewHelper.initializeAndLoad(m_baseURL + "viewport-initial-scale-and-user
-scalable-no.html", true, 0, &client, enableViewportSettings); | 2156 webViewHelper.initializeAndLoad(m_baseURL + "viewport-initial-scale-and-user
-scalable-no.html", true, 0, &client, enableViewportSettings); |
| 2210 webViewHelper.webView()->settings()->setSupportDeprecatedTargetDensityDPI(tr
ue); | 2157 webViewHelper.webView()->settings()->setSupportDeprecatedTargetDensityDPI(tr
ue); |
| 2211 webViewHelper.webView()->settings()->setViewportMetaNonUserScalableQuirk(tru
e); | 2158 webViewHelper.webView()->settings()->setViewportMetaNonUserScalableQuirk(tru
e); |
| 2212 webViewHelper.webView()->settings()->setWideViewportQuirkEnabled(true); | 2159 webViewHelper.webView()->settings()->setWideViewportQuirkEnabled(true); |
| 2213 webViewHelper.webView()->settings()->setUseWideViewport(false); | 2160 webViewHelper.webView()->settings()->setUseWideViewport(false); |
| 2214 webViewHelper.webView()->resize(WebSize(viewportWidth, viewportHeight)); | 2161 webViewHelper.webView()->resize(WebSize(viewportWidth, viewportHeight)); |
| 2215 webViewHelper.webView()->layout(); | 2162 webViewHelper.webView()->layout(); |
| 2216 | 2163 |
| 2217 EXPECT_NEAR(viewportWidth * client.m_screenInfo.deviceScaleFactor, webViewHe
lper.webViewImpl()->mainFrameImpl()->frameView()->layoutSize().width(), 1.0f); | 2164 EXPECT_NEAR(viewportWidth * client.m_screenInfo.deviceScaleFactor, webViewHe
lper.webViewImpl()->mainFrameImpl()->frameView()->layoutSize().width(), 1.0f); |
| 2218 EXPECT_NEAR(viewportHeight * client.m_screenInfo.deviceScaleFactor, webViewH
elper.webViewImpl()->mainFrameImpl()->frameView()->layoutSize().height(), 1.0f); | 2165 EXPECT_NEAR(viewportHeight * client.m_screenInfo.deviceScaleFactor, webViewH
elper.webViewImpl()->mainFrameImpl()->frameView()->layoutSize().height(), 1.0f); |
| 2219 EXPECT_NEAR(1.0f / client.m_screenInfo.deviceScaleFactor, webViewHelper.webV
iew()->pageScaleFactor(), 0.01f); | 2166 EXPECT_NEAR(1.0f / client.m_screenInfo.deviceScaleFactor, webViewHelper.webV
iew()->pageScaleFactor(), 0.01f); |
| 2220 } | 2167 } |
| 2221 | 2168 |
| 2222 TEST_P(ParameterizedWebFrameTest, NoUserScalableQuirkIgnoresViewportScaleForWide
Viewport) | 2169 TEST_P(ParameterizedWebFrameTest, NoUserScalableQuirkIgnoresViewportScaleForWide
Viewport) |
| 2223 { | 2170 { |
| 2224 UseMockScrollbarSettings mockScrollbarSettings; | |
| 2225 registerMockedHttpURLLoad("viewport-2x-initial-scale-non-user-scalable.html"
); | 2171 registerMockedHttpURLLoad("viewport-2x-initial-scale-non-user-scalable.html"
); |
| 2226 | 2172 |
| 2227 FixedLayoutTestWebViewClient client; | 2173 FixedLayoutTestWebViewClient client; |
| 2228 int viewportWidth = 640; | 2174 int viewportWidth = 640; |
| 2229 int viewportHeight = 480; | 2175 int viewportHeight = 480; |
| 2230 | 2176 |
| 2231 FrameTestHelpers::WebViewHelper webViewHelper(this); | 2177 FrameTestHelpers::WebViewHelper webViewHelper(this); |
| 2232 webViewHelper.initializeAndLoad(m_baseURL + "viewport-2x-initial-scale-non-u
ser-scalable.html", true, 0, &client, enableViewportSettings); | 2178 webViewHelper.initializeAndLoad(m_baseURL + "viewport-2x-initial-scale-non-u
ser-scalable.html", true, 0, &client, enableViewportSettings); |
| 2233 webViewHelper.webView()->settings()->setViewportMetaNonUserScalableQuirk(tru
e); | 2179 webViewHelper.webView()->settings()->setViewportMetaNonUserScalableQuirk(tru
e); |
| 2234 webViewHelper.webView()->settings()->setWideViewportQuirkEnabled(true); | 2180 webViewHelper.webView()->settings()->setWideViewportQuirkEnabled(true); |
| 2235 webViewHelper.webView()->settings()->setUseWideViewport(true); | 2181 webViewHelper.webView()->settings()->setUseWideViewport(true); |
| 2236 webViewHelper.webView()->resize(WebSize(viewportWidth, viewportHeight)); | 2182 webViewHelper.webView()->resize(WebSize(viewportWidth, viewportHeight)); |
| 2237 | 2183 |
| 2238 EXPECT_NEAR(viewportWidth, webViewHelper.webViewImpl()->mainFrameImpl()->fra
meView()->layoutSize().width(), 1.0f); | 2184 EXPECT_NEAR(viewportWidth, webViewHelper.webViewImpl()->mainFrameImpl()->fra
meView()->layoutSize().width(), 1.0f); |
| 2239 EXPECT_NEAR(viewportHeight, webViewHelper.webViewImpl()->mainFrameImpl()->fr
ameView()->layoutSize().height(), 1.0f); | 2185 EXPECT_NEAR(viewportHeight, webViewHelper.webViewImpl()->mainFrameImpl()->fr
ameView()->layoutSize().height(), 1.0f); |
| 2240 EXPECT_NEAR(1.0f, webViewHelper.webView()->pageScaleFactor(), 0.01f); | 2186 EXPECT_NEAR(1.0f, webViewHelper.webView()->pageScaleFactor(), 0.01f); |
| 2241 } | 2187 } |
| 2242 | 2188 |
| 2243 TEST_P(ParameterizedWebFrameTest, DesktopPageCanBeZoomedInWhenWideViewportIsTurn
edOff) | 2189 TEST_P(ParameterizedWebFrameTest, DesktopPageCanBeZoomedInWhenWideViewportIsTurn
edOff) |
| 2244 { | 2190 { |
| 2245 UseMockScrollbarSettings mockScrollbarSettings; | |
| 2246 registerMockedHttpURLLoad("no_viewport_tag.html"); | 2191 registerMockedHttpURLLoad("no_viewport_tag.html"); |
| 2247 | 2192 |
| 2248 FixedLayoutTestWebViewClient client; | 2193 FixedLayoutTestWebViewClient client; |
| 2249 int viewportWidth = 640; | 2194 int viewportWidth = 640; |
| 2250 int viewportHeight = 480; | 2195 int viewportHeight = 480; |
| 2251 | 2196 |
| 2252 FrameTestHelpers::WebViewHelper webViewHelper(this); | 2197 FrameTestHelpers::WebViewHelper webViewHelper(this); |
| 2253 webViewHelper.initializeAndLoad(m_baseURL + "no_viewport_tag.html", true, 0,
&client, enableViewportSettings); | 2198 webViewHelper.initializeAndLoad(m_baseURL + "no_viewport_tag.html", true, 0,
&client, enableViewportSettings); |
| 2254 webViewHelper.webView()->setDefaultPageScaleLimits(0.25f, 5); | 2199 webViewHelper.webView()->setDefaultPageScaleLimits(0.25f, 5); |
| 2255 webViewHelper.webView()->settings()->setWideViewportQuirkEnabled(true); | 2200 webViewHelper.webView()->settings()->setWideViewportQuirkEnabled(true); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 2269 FloatSize relativeOffset = FloatPoint(absoluteOffset) - FloatPoint(rect.
location()); | 2214 FloatSize relativeOffset = FloatPoint(absoluteOffset) - FloatPoint(rect.
location()); |
| 2270 relativeOffset.scale(1.f / rect.width(), 1.f / rect.height()); | 2215 relativeOffset.scale(1.f / rect.width(), 1.f / rect.height()); |
| 2271 return relativeOffset; | 2216 return relativeOffset; |
| 2272 } | 2217 } |
| 2273 | 2218 |
| 2274 void testResizeYieldsCorrectScrollAndScale(const char* url, | 2219 void testResizeYieldsCorrectScrollAndScale(const char* url, |
| 2275 const float initialPageScaleFacto
r, | 2220 const float initialPageScaleFacto
r, |
| 2276 const WebSize scrollOffset, | 2221 const WebSize scrollOffset, |
| 2277 const WebSize viewportSize, | 2222 const WebSize viewportSize, |
| 2278 const bool shouldScaleRelativeToV
iewportWidth) { | 2223 const bool shouldScaleRelativeToV
iewportWidth) { |
| 2279 UseMockScrollbarSettings mockScrollbarSettings; | |
| 2280 registerMockedHttpURLLoad(url); | 2224 registerMockedHttpURLLoad(url); |
| 2281 | 2225 |
| 2282 const float aspectRatio = static_cast<float>(viewportSize.width) / viewp
ortSize.height; | 2226 const float aspectRatio = static_cast<float>(viewportSize.width) / viewp
ortSize.height; |
| 2283 | 2227 |
| 2284 FrameTestHelpers::WebViewHelper webViewHelper(this); | 2228 FrameTestHelpers::WebViewHelper webViewHelper(this); |
| 2285 webViewHelper.initializeAndLoad(m_baseURL + url, true, 0, 0, enableViewp
ortSettings); | 2229 webViewHelper.initializeAndLoad(m_baseURL + url, true, 0, 0, enableViewp
ortSettings); |
| 2286 webViewHelper.webViewImpl()->setDefaultPageScaleLimits(0.25f, 5); | 2230 webViewHelper.webViewImpl()->setDefaultPageScaleLimits(0.25f, 5); |
| 2287 | 2231 |
| 2288 // Origin scrollOffsets preserved under resize. | 2232 // Origin scrollOffsets preserved under resize. |
| 2289 { | 2233 { |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2369 const WebSize scrollOffset(200, 400); | 2313 const WebSize scrollOffset(200, 400); |
| 2370 const WebSize viewportSize(320, 240); | 2314 const WebSize viewportSize(320, 240); |
| 2371 const bool shouldScaleRelativeToViewportWidth = true; | 2315 const bool shouldScaleRelativeToViewportWidth = true; |
| 2372 | 2316 |
| 2373 testResizeYieldsCorrectScrollAndScale( | 2317 testResizeYieldsCorrectScrollAndScale( |
| 2374 url, initialPageScaleFactor, scrollOffset, viewportSize, shouldScaleRela
tiveToViewportWidth); | 2318 url, initialPageScaleFactor, scrollOffset, viewportSize, shouldScaleRela
tiveToViewportWidth); |
| 2375 } | 2319 } |
| 2376 | 2320 |
| 2377 TEST_P(ParameterizedWebFrameTest, pageScaleFactorUpdatesScrollbars) | 2321 TEST_P(ParameterizedWebFrameTest, pageScaleFactorUpdatesScrollbars) |
| 2378 { | 2322 { |
| 2379 UseMockScrollbarSettings mockScrollbarSettings; | |
| 2380 registerMockedHttpURLLoad("fixed_layout.html"); | 2323 registerMockedHttpURLLoad("fixed_layout.html"); |
| 2381 | 2324 |
| 2382 FixedLayoutTestWebViewClient client; | 2325 FixedLayoutTestWebViewClient client; |
| 2383 client.m_screenInfo.deviceScaleFactor = 1; | 2326 client.m_screenInfo.deviceScaleFactor = 1; |
| 2384 int viewportWidth = 640; | 2327 int viewportWidth = 640; |
| 2385 int viewportHeight = 480; | 2328 int viewportHeight = 480; |
| 2386 | 2329 |
| 2387 FrameTestHelpers::WebViewHelper webViewHelper(this); | 2330 FrameTestHelpers::WebViewHelper webViewHelper(this); |
| 2388 webViewHelper.initializeAndLoad(m_baseURL + "fixed_layout.html", true, 0, &c
lient, enableViewportSettings); | 2331 webViewHelper.initializeAndLoad(m_baseURL + "fixed_layout.html", true, 0, &c
lient, enableViewportSettings); |
| 2389 webViewHelper.webView()->resize(WebSize(viewportWidth, viewportHeight)); | 2332 webViewHelper.webView()->resize(WebSize(viewportWidth, viewportHeight)); |
| 2390 webViewHelper.webView()->layout(); | 2333 webViewHelper.webView()->layout(); |
| 2391 | 2334 |
| 2392 FrameView* view = webViewHelper.webViewImpl()->mainFrameImpl()->frameView(); | 2335 FrameView* view = webViewHelper.webViewImpl()->mainFrameImpl()->frameView(); |
| 2393 EXPECT_EQ(view->scrollSize(HorizontalScrollbar), view->contentsSize().width(
) - view->visibleContentRect().width()); | 2336 EXPECT_EQ(view->scrollSize(HorizontalScrollbar), view->contentsSize().width(
) - view->visibleContentRect().width()); |
| 2394 EXPECT_EQ(view->scrollSize(VerticalScrollbar), view->contentsSize().height()
- view->visibleContentRect().height()); | 2337 EXPECT_EQ(view->scrollSize(VerticalScrollbar), view->contentsSize().height()
- view->visibleContentRect().height()); |
| 2395 | 2338 |
| 2396 webViewHelper.webView()->setPageScaleFactor(10); | 2339 webViewHelper.webView()->setPageScaleFactor(10); |
| 2397 | 2340 |
| 2398 EXPECT_EQ(view->scrollSize(HorizontalScrollbar), view->contentsSize().width(
) - view->visibleContentRect().width()); | 2341 EXPECT_EQ(view->scrollSize(HorizontalScrollbar), view->contentsSize().width(
) - view->visibleContentRect().width()); |
| 2399 EXPECT_EQ(view->scrollSize(VerticalScrollbar), view->contentsSize().height()
- view->visibleContentRect().height()); | 2342 EXPECT_EQ(view->scrollSize(VerticalScrollbar), view->contentsSize().height()
- view->visibleContentRect().height()); |
| 2400 } | 2343 } |
| 2401 | 2344 |
| 2402 TEST_P(ParameterizedWebFrameTest, CanOverrideScaleLimits) | 2345 TEST_P(ParameterizedWebFrameTest, CanOverrideScaleLimits) |
| 2403 { | 2346 { |
| 2404 UseMockScrollbarSettings mockScrollbarSettings; | |
| 2405 | |
| 2406 registerMockedHttpURLLoad("no_scale_for_you.html"); | 2347 registerMockedHttpURLLoad("no_scale_for_you.html"); |
| 2407 | 2348 |
| 2408 FixedLayoutTestWebViewClient client; | 2349 FixedLayoutTestWebViewClient client; |
| 2409 client.m_screenInfo.deviceScaleFactor = 1; | 2350 client.m_screenInfo.deviceScaleFactor = 1; |
| 2410 int viewportWidth = 640; | 2351 int viewportWidth = 640; |
| 2411 int viewportHeight = 480; | 2352 int viewportHeight = 480; |
| 2412 | 2353 |
| 2413 FrameTestHelpers::WebViewHelper webViewHelper(this); | 2354 FrameTestHelpers::WebViewHelper webViewHelper(this); |
| 2414 webViewHelper.initializeAndLoad(m_baseURL + "no_scale_for_you.html", true, 0
, &client, enableViewportSettings); | 2355 webViewHelper.initializeAndLoad(m_baseURL + "no_scale_for_you.html", true, 0
, &client, enableViewportSettings); |
| 2415 webViewHelper.webView()->setDefaultPageScaleLimits(0.25f, 5); | 2356 webViewHelper.webView()->setDefaultPageScaleLimits(0.25f, 5); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 2431 EXPECT_EQ(2.0f, webViewHelper.webViewImpl()->maximumPageScaleFactor()); | 2372 EXPECT_EQ(2.0f, webViewHelper.webViewImpl()->maximumPageScaleFactor()); |
| 2432 } | 2373 } |
| 2433 | 2374 |
| 2434 // Android doesn't have scrollbars on the main FrameView | 2375 // Android doesn't have scrollbars on the main FrameView |
| 2435 #if OS(ANDROID) | 2376 #if OS(ANDROID) |
| 2436 TEST_F(WebFrameTest, DISABLED_updateOverlayScrollbarLayers) | 2377 TEST_F(WebFrameTest, DISABLED_updateOverlayScrollbarLayers) |
| 2437 #else | 2378 #else |
| 2438 TEST_F(WebFrameTest, updateOverlayScrollbarLayers) | 2379 TEST_F(WebFrameTest, updateOverlayScrollbarLayers) |
| 2439 #endif | 2380 #endif |
| 2440 { | 2381 { |
| 2441 UseMockScrollbarSettings mockScrollbarSettings; | |
| 2442 | |
| 2443 registerMockedHttpURLLoad("large-div.html"); | 2382 registerMockedHttpURLLoad("large-div.html"); |
| 2444 | 2383 |
| 2445 int viewWidth = 500; | 2384 int viewWidth = 500; |
| 2446 int viewHeight = 500; | 2385 int viewHeight = 500; |
| 2447 | 2386 |
| 2448 OwnPtr<FakeCompositingWebViewClient> fakeCompositingWebViewClient = adoptPtr
(new FakeCompositingWebViewClient()); | 2387 OwnPtr<FakeCompositingWebViewClient> fakeCompositingWebViewClient = adoptPtr
(new FakeCompositingWebViewClient()); |
| 2449 FrameTestHelpers::WebViewHelper webViewHelper; | 2388 FrameTestHelpers::WebViewHelper webViewHelper; |
| 2450 webViewHelper.initialize(true, 0, fakeCompositingWebViewClient.get(), &confi
gueCompositingWebView); | 2389 webViewHelper.initialize(true, 0, fakeCompositingWebViewClient.get(), &confi
gueCompositingWebView); |
| 2451 | 2390 |
| 2452 webViewHelper.webView()->resize(WebSize(viewWidth, viewHeight)); | 2391 webViewHelper.webView()->resize(WebSize(viewWidth, viewHeight)); |
| (...skipping 2392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4845 webViewHelper.webView()->resize(WebSize(1000, 1000)); | 4784 webViewHelper.webView()->resize(WebSize(1000, 1000)); |
| 4846 webViewHelper.webView()->layout(); | 4785 webViewHelper.webView()->layout(); |
| 4847 | 4786 |
| 4848 client.resetTriggered(); | 4787 client.resetTriggered(); |
| 4849 webViewHelper.webView()->handleInputEvent(fatTap(50, 50)); | 4788 webViewHelper.webView()->handleInputEvent(fatTap(50, 50)); |
| 4850 EXPECT_FALSE(client.triggered()); | 4789 EXPECT_FALSE(client.triggered()); |
| 4851 } | 4790 } |
| 4852 | 4791 |
| 4853 TEST_P(ParameterizedWebFrameTest, DisambiguationPopupMobileSite) | 4792 TEST_P(ParameterizedWebFrameTest, DisambiguationPopupMobileSite) |
| 4854 { | 4793 { |
| 4855 UseMockScrollbarSettings mockScrollbarSettings; | |
| 4856 const std::string htmlFile = "disambiguation_popup_mobile_site.html"; | 4794 const std::string htmlFile = "disambiguation_popup_mobile_site.html"; |
| 4857 registerMockedHttpURLLoad(htmlFile); | 4795 registerMockedHttpURLLoad(htmlFile); |
| 4858 | 4796 |
| 4859 DisambiguationPopupTestWebViewClient client; | 4797 DisambiguationPopupTestWebViewClient client; |
| 4860 | 4798 |
| 4861 // Make sure we initialize to minimum scale, even if the window size | 4799 // Make sure we initialize to minimum scale, even if the window size |
| 4862 // only becomes available after the load begins. | 4800 // only becomes available after the load begins. |
| 4863 FrameTestHelpers::WebViewHelper webViewHelper(this); | 4801 FrameTestHelpers::WebViewHelper webViewHelper(this); |
| 4864 webViewHelper.initializeAndLoad(m_baseURL + htmlFile, true, 0, &client, enab
leViewportSettings); | 4802 webViewHelper.initializeAndLoad(m_baseURL + htmlFile, true, 0, &client, enab
leViewportSettings); |
| 4865 webViewHelper.webView()->resize(WebSize(1000, 1000)); | 4803 webViewHelper.webView()->resize(WebSize(1000, 1000)); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 4881 | 4819 |
| 4882 for (int i = 0; i <= 46; i++) { | 4820 for (int i = 0; i <= 46; i++) { |
| 4883 client.resetTriggered(); | 4821 client.resetTriggered(); |
| 4884 webViewHelper.webView()->handleInputEvent(fatTap(10 + i * 5, 590)); | 4822 webViewHelper.webView()->handleInputEvent(fatTap(10 + i * 5, 590)); |
| 4885 EXPECT_FALSE(client.triggered()); | 4823 EXPECT_FALSE(client.triggered()); |
| 4886 } | 4824 } |
| 4887 } | 4825 } |
| 4888 | 4826 |
| 4889 TEST_P(ParameterizedWebFrameTest, DisambiguationPopupViewportSite) | 4827 TEST_P(ParameterizedWebFrameTest, DisambiguationPopupViewportSite) |
| 4890 { | 4828 { |
| 4891 UseMockScrollbarSettings mockScrollbarSettings; | |
| 4892 const std::string htmlFile = "disambiguation_popup_viewport_site.html"; | 4829 const std::string htmlFile = "disambiguation_popup_viewport_site.html"; |
| 4893 registerMockedHttpURLLoad(htmlFile); | 4830 registerMockedHttpURLLoad(htmlFile); |
| 4894 | 4831 |
| 4895 DisambiguationPopupTestWebViewClient client; | 4832 DisambiguationPopupTestWebViewClient client; |
| 4896 | 4833 |
| 4897 // Make sure we initialize to minimum scale, even if the window size | 4834 // Make sure we initialize to minimum scale, even if the window size |
| 4898 // only becomes available after the load begins. | 4835 // only becomes available after the load begins. |
| 4899 FrameTestHelpers::WebViewHelper webViewHelper(this); | 4836 FrameTestHelpers::WebViewHelper webViewHelper(this); |
| 4900 webViewHelper.initializeAndLoad(m_baseURL + htmlFile, true, 0, &client, enab
leViewportSettings); | 4837 webViewHelper.initializeAndLoad(m_baseURL + htmlFile, true, 0, &client, enab
leViewportSettings); |
| 4901 webViewHelper.webView()->resize(WebSize(1000, 1000)); | 4838 webViewHelper.webView()->resize(WebSize(1000, 1000)); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 4917 | 4854 |
| 4918 for (int i = 0; i <= 46; i++) { | 4855 for (int i = 0; i <= 46; i++) { |
| 4919 client.resetTriggered(); | 4856 client.resetTriggered(); |
| 4920 webViewHelper.webView()->handleInputEvent(fatTap(10 + i * 5, 590)); | 4857 webViewHelper.webView()->handleInputEvent(fatTap(10 + i * 5, 590)); |
| 4921 EXPECT_FALSE(client.triggered()); | 4858 EXPECT_FALSE(client.triggered()); |
| 4922 } | 4859 } |
| 4923 } | 4860 } |
| 4924 | 4861 |
| 4925 TEST_F(WebFrameTest, DisambiguationPopupVisualViewport) | 4862 TEST_F(WebFrameTest, DisambiguationPopupVisualViewport) |
| 4926 { | 4863 { |
| 4927 UseMockScrollbarSettings mockScrollbarSettings; | |
| 4928 const std::string htmlFile = "disambiguation_popup_200_by_800.html"; | 4864 const std::string htmlFile = "disambiguation_popup_200_by_800.html"; |
| 4929 registerMockedHttpURLLoad(htmlFile); | 4865 registerMockedHttpURLLoad(htmlFile); |
| 4930 | 4866 |
| 4931 DisambiguationPopupTestWebViewClient client; | 4867 DisambiguationPopupTestWebViewClient client; |
| 4932 | 4868 |
| 4933 FrameTestHelpers::WebViewHelper webViewHelper; | 4869 FrameTestHelpers::WebViewHelper webViewHelper; |
| 4934 webViewHelper.initializeAndLoad(m_baseURL + htmlFile, true, 0, &client, conf
igureAndroid); | 4870 webViewHelper.initializeAndLoad(m_baseURL + htmlFile, true, 0, &client, conf
igureAndroid); |
| 4935 | 4871 |
| 4936 WebViewImpl* webViewImpl = webViewHelper.webViewImpl(); | 4872 WebViewImpl* webViewImpl = webViewHelper.webViewImpl(); |
| 4937 ASSERT_TRUE(webViewImpl); | 4873 ASSERT_TRUE(webViewImpl); |
| (...skipping 1408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6346 registerMockedHttpURLLoad("create_child_frame_fail.html"); | 6282 registerMockedHttpURLLoad("create_child_frame_fail.html"); |
| 6347 FailCreateChildFrame client; | 6283 FailCreateChildFrame client; |
| 6348 FrameTestHelpers::WebViewHelper webViewHelper(this); | 6284 FrameTestHelpers::WebViewHelper webViewHelper(this); |
| 6349 webViewHelper.initializeAndLoad(m_baseURL + "create_child_frame_fail.html",
true, &client); | 6285 webViewHelper.initializeAndLoad(m_baseURL + "create_child_frame_fail.html",
true, &client); |
| 6350 | 6286 |
| 6351 EXPECT_EQ(1, client.callCount()); | 6287 EXPECT_EQ(1, client.callCount()); |
| 6352 } | 6288 } |
| 6353 | 6289 |
| 6354 TEST_P(ParameterizedWebFrameTest, fixedPositionInFixedViewport) | 6290 TEST_P(ParameterizedWebFrameTest, fixedPositionInFixedViewport) |
| 6355 { | 6291 { |
| 6356 UseMockScrollbarSettings mockScrollbarSettings; | |
| 6357 registerMockedHttpURLLoad("fixed-position-in-fixed-viewport.html"); | 6292 registerMockedHttpURLLoad("fixed-position-in-fixed-viewport.html"); |
| 6358 FrameTestHelpers::WebViewHelper webViewHelper(this); | 6293 FrameTestHelpers::WebViewHelper webViewHelper(this); |
| 6359 webViewHelper.initializeAndLoad(m_baseURL + "fixed-position-in-fixed-viewpor
t.html", true, 0, 0, enableViewportSettings); | 6294 webViewHelper.initializeAndLoad(m_baseURL + "fixed-position-in-fixed-viewpor
t.html", true, 0, 0, enableViewportSettings); |
| 6360 | 6295 |
| 6361 WebView* webView = webViewHelper.webView(); | 6296 WebView* webView = webViewHelper.webView(); |
| 6362 webView->resize(WebSize(100, 100)); | 6297 webView->resize(WebSize(100, 100)); |
| 6363 | 6298 |
| 6364 Document* document = toWebLocalFrameImpl(webView->mainFrame())->frame()->doc
ument(); | 6299 Document* document = toWebLocalFrameImpl(webView->mainFrame())->frame()->doc
ument(); |
| 6365 Element* bottomFixed = document->getElementById("bottom-fixed"); | 6300 Element* bottomFixed = document->getElementById("bottom-fixed"); |
| 6366 Element* topBottomFixed = document->getElementById("top-bottom-fixed"); | 6301 Element* topBottomFixed = document->getElementById("top-bottom-fixed"); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 6388 FrameView* frameView = webViewHelper.webViewImpl()->mainFrameImpl()->frameVi
ew(); | 6323 FrameView* frameView = webViewHelper.webViewImpl()->mainFrameImpl()->frameVi
ew(); |
| 6389 EXPECT_RECT_EQ(IntRect(0, 0, 200, 200), frameView->frameRect()); | 6324 EXPECT_RECT_EQ(IntRect(0, 0, 200, 200), frameView->frameRect()); |
| 6390 frameView->setFrameRect(IntRect(100, 100, 200, 200)); | 6325 frameView->setFrameRect(IntRect(100, 100, 200, 200)); |
| 6391 EXPECT_RECT_EQ(IntRect(100, 100, 200, 200), frameView->frameRect()); | 6326 EXPECT_RECT_EQ(IntRect(100, 100, 200, 200), frameView->frameRect()); |
| 6392 } | 6327 } |
| 6393 | 6328 |
| 6394 TEST_F(WebFrameTest, FrameViewScrollAccountsForTopControls) | 6329 TEST_F(WebFrameTest, FrameViewScrollAccountsForTopControls) |
| 6395 { | 6330 { |
| 6396 FakeCompositingWebViewClient client; | 6331 FakeCompositingWebViewClient client; |
| 6397 registerMockedHttpURLLoad("long_scroll.html"); | 6332 registerMockedHttpURLLoad("long_scroll.html"); |
| 6398 UseMockScrollbarSettings mockScrollbarSettings; | |
| 6399 FrameTestHelpers::WebViewHelper webViewHelper; | 6333 FrameTestHelpers::WebViewHelper webViewHelper; |
| 6400 webViewHelper.initializeAndLoad(m_baseURL + "long_scroll.html", true, 0, &cl
ient, configureAndroid); | 6334 webViewHelper.initializeAndLoad(m_baseURL + "long_scroll.html", true, 0, &cl
ient, configureAndroid); |
| 6401 | 6335 |
| 6402 WebViewImpl* webView = webViewHelper.webViewImpl(); | 6336 WebViewImpl* webView = webViewHelper.webViewImpl(); |
| 6403 FrameView* frameView = webViewHelper.webViewImpl()->mainFrameImpl()->frameVi
ew(); | 6337 FrameView* frameView = webViewHelper.webViewImpl()->mainFrameImpl()->frameVi
ew(); |
| 6404 | 6338 |
| 6405 float topControlsHeight = 40; | 6339 float topControlsHeight = 40; |
| 6406 webView->setTopControlsHeight(topControlsHeight, false); | 6340 webView->setTopControlsHeight(topControlsHeight, false); |
| 6407 webView->resize(WebSize(100, 100)); | 6341 webView->resize(WebSize(100, 100)); |
| 6408 webView->setPageScaleFactor(2.0f); | 6342 webView->setPageScaleFactor(2.0f); |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6451 // main frame. | 6385 // main frame. |
| 6452 webView->applyViewportDeltas(WebFloatSize(), WebFloatSize(), WebFloatSize(),
1.0f, 1.0f / topControlsHeight); | 6386 webView->applyViewportDeltas(WebFloatSize(), WebFloatSize(), WebFloatSize(),
1.0f, 1.0f / topControlsHeight); |
| 6453 EXPECT_POINT_EQ(IntPoint(0, 1901), frameView->maximumScrollPosition()); | 6387 EXPECT_POINT_EQ(IntPoint(0, 1901), frameView->maximumScrollPosition()); |
| 6454 | 6388 |
| 6455 webView->applyViewportDeltas(WebFloatSize(), WebFloatSize(), WebFloatSize(),
1.0f, 2.0f / topControlsHeight); | 6389 webView->applyViewportDeltas(WebFloatSize(), WebFloatSize(), WebFloatSize(),
1.0f, 2.0f / topControlsHeight); |
| 6456 EXPECT_POINT_EQ(IntPoint(0, 1903), frameView->maximumScrollPosition()); | 6390 EXPECT_POINT_EQ(IntPoint(0, 1903), frameView->maximumScrollPosition()); |
| 6457 } | 6391 } |
| 6458 | 6392 |
| 6459 TEST_F(WebFrameTest, MaximumScrollPositionCanBeNegative) | 6393 TEST_F(WebFrameTest, MaximumScrollPositionCanBeNegative) |
| 6460 { | 6394 { |
| 6461 UseMockScrollbarSettings mockScrollbarSettings; | |
| 6462 registerMockedHttpURLLoad("rtl-overview-mode.html"); | 6395 registerMockedHttpURLLoad("rtl-overview-mode.html"); |
| 6463 | 6396 |
| 6464 FixedLayoutTestWebViewClient client; | 6397 FixedLayoutTestWebViewClient client; |
| 6465 client.m_screenInfo.deviceScaleFactor = 1; | 6398 client.m_screenInfo.deviceScaleFactor = 1; |
| 6466 int viewportWidth = 640; | 6399 int viewportWidth = 640; |
| 6467 int viewportHeight = 480; | 6400 int viewportHeight = 480; |
| 6468 | 6401 |
| 6469 FrameTestHelpers::WebViewHelper webViewHelper; | 6402 FrameTestHelpers::WebViewHelper webViewHelper; |
| 6470 webViewHelper.initializeAndLoad(m_baseURL + "rtl-overview-mode.html", true,
0, &client, enableViewportSettings); | 6403 webViewHelper.initializeAndLoad(m_baseURL + "rtl-overview-mode.html", true,
0, &client, enableViewportSettings); |
| 6471 webViewHelper.webView()->setInitialPageScaleOverride(-1); | 6404 webViewHelper.webView()->setInitialPageScaleOverride(-1); |
| (...skipping 1804 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8276 EXPECT_TRUE(resource); | 8209 EXPECT_TRUE(resource); |
| 8277 EXPECT_NE(0, resource->loadFinishTime()); | 8210 EXPECT_NE(0, resource->loadFinishTime()); |
| 8278 | 8211 |
| 8279 DocumentLoader* loader = document->loader(); | 8212 DocumentLoader* loader = document->loader(); |
| 8280 | 8213 |
| 8281 EXPECT_TRUE(loader); | 8214 EXPECT_TRUE(loader); |
| 8282 EXPECT_EQ(loader->timing().responseEnd(), resource->loadFinishTime()); | 8215 EXPECT_EQ(loader->timing().responseEnd(), resource->loadFinishTime()); |
| 8283 } | 8216 } |
| 8284 | 8217 |
| 8285 } // namespace blink | 8218 } // namespace blink |
| OLD | NEW |