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 894 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
905 | 905 |
906 TEST_P(ParameterizedWebFrameTest, ChangeInFixedLayoutResetsTextAutosizingMultipl
iers) | 906 TEST_P(ParameterizedWebFrameTest, ChangeInFixedLayoutResetsTextAutosizingMultipl
iers) |
907 { | 907 { |
908 registerMockedHttpURLLoad("fixed_layout.html"); | 908 registerMockedHttpURLLoad("fixed_layout.html"); |
909 | 909 |
910 FixedLayoutTestWebViewClient client; | 910 FixedLayoutTestWebViewClient client; |
911 int viewportWidth = 640; | 911 int viewportWidth = 640; |
912 int viewportHeight = 480; | 912 int viewportHeight = 480; |
913 | 913 |
914 FrameTestHelpers::WebViewHelper webViewHelper(this); | 914 FrameTestHelpers::WebViewHelper webViewHelper(this); |
915 webViewHelper.initializeAndLoad(m_baseURL + "fixed_layout.html", true, 0, &c
lient, enableViewportSettings); | 915 webViewHelper.initializeAndLoad(m_baseURL + "fixed_layout.html", true, nullp
tr, &client, nullptr, enableViewportSettings); |
916 | 916 |
917 Document* document = toLocalFrame(webViewHelper.webViewImpl()->page()->mainF
rame())->document(); | 917 Document* document = toLocalFrame(webViewHelper.webViewImpl()->page()->mainF
rame())->document(); |
918 document->settings()->setTextAutosizingEnabled(true); | 918 document->settings()->setTextAutosizingEnabled(true); |
919 EXPECT_TRUE(document->settings()->textAutosizingEnabled()); | 919 EXPECT_TRUE(document->settings()->textAutosizingEnabled()); |
920 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); | 920 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); |
921 | 921 |
922 EXPECT_TRUE(setTextAutosizingMultiplier(document, 2)); | 922 EXPECT_TRUE(setTextAutosizingMultiplier(document, 2)); |
923 | 923 |
924 ViewportDescription description = document->viewportDescription(); | 924 ViewportDescription description = document->viewportDescription(); |
925 // Choose a width that's not going match the viewport width of the loaded do
cument. | 925 // Choose a width that's not going match the viewport width of the loaded do
cument. |
926 description.minWidth = Length(100, blink::Fixed); | 926 description.minWidth = Length(100, blink::Fixed); |
927 description.maxWidth = Length(100, blink::Fixed); | 927 description.maxWidth = Length(100, blink::Fixed); |
928 webViewHelper.webViewImpl()->updatePageDefinedViewportConstraints(descriptio
n); | 928 webViewHelper.webViewImpl()->updatePageDefinedViewportConstraints(descriptio
n); |
929 | 929 |
930 EXPECT_TRUE(checkTextAutosizingMultiplier(document, 1)); | 930 EXPECT_TRUE(checkTextAutosizingMultiplier(document, 1)); |
931 } | 931 } |
932 | 932 |
933 TEST_P(ParameterizedWebFrameTest, WorkingTextAutosizingMultipliers_VirtualViewpo
rt) | 933 TEST_P(ParameterizedWebFrameTest, WorkingTextAutosizingMultipliers_VirtualViewpo
rt) |
934 { | 934 { |
935 const std::string htmlFile = "fixed_layout.html"; | 935 const std::string htmlFile = "fixed_layout.html"; |
936 registerMockedHttpURLLoad(htmlFile); | 936 registerMockedHttpURLLoad(htmlFile); |
937 | 937 |
938 FixedLayoutTestWebViewClient client; | 938 FixedLayoutTestWebViewClient client; |
939 | 939 |
940 FrameTestHelpers::WebViewHelper webViewHelper(this); | 940 FrameTestHelpers::WebViewHelper webViewHelper(this); |
941 webViewHelper.initializeAndLoad(m_baseURL + htmlFile, true, 0, &client, conf
igureAndroid); | 941 webViewHelper.initializeAndLoad(m_baseURL + htmlFile, true, nullptr, &client
, nullptr, configureAndroid); |
942 | 942 |
943 Document* document = toLocalFrame(webViewHelper.webViewImpl()->page()->mainF
rame())->document(); | 943 Document* document = toLocalFrame(webViewHelper.webViewImpl()->page()->mainF
rame())->document(); |
944 document->settings()->setTextAutosizingEnabled(true); | 944 document->settings()->setTextAutosizingEnabled(true); |
945 EXPECT_TRUE(document->settings()->textAutosizingEnabled()); | 945 EXPECT_TRUE(document->settings()->textAutosizingEnabled()); |
946 | 946 |
947 webViewHelper.resize(WebSize(490, 800)); | 947 webViewHelper.resize(WebSize(490, 800)); |
948 | 948 |
949 // Multiplier: 980 / 490 = 2.0 | 949 // Multiplier: 980 / 490 = 2.0 |
950 EXPECT_TRUE(checkTextAutosizingMultiplier(document, 2.0)); | 950 EXPECT_TRUE(checkTextAutosizingMultiplier(document, 2.0)); |
951 } | 951 } |
952 | 952 |
953 TEST_P(ParameterizedWebFrameTest, VisualViewportSetSizeInvalidatesTextAutosizing
Multipliers) | 953 TEST_P(ParameterizedWebFrameTest, VisualViewportSetSizeInvalidatesTextAutosizing
Multipliers) |
954 { | 954 { |
955 registerMockedHttpURLLoad("iframe_reload.html"); | 955 registerMockedHttpURLLoad("iframe_reload.html"); |
956 registerMockedHttpURLLoad("visible_iframe.html"); | 956 registerMockedHttpURLLoad("visible_iframe.html"); |
957 | 957 |
958 FixedLayoutTestWebViewClient client; | 958 FixedLayoutTestWebViewClient client; |
959 int viewportWidth = 640; | 959 int viewportWidth = 640; |
960 int viewportHeight = 480; | 960 int viewportHeight = 480; |
961 | 961 |
962 FrameTestHelpers::WebViewHelper webViewHelper(this); | 962 FrameTestHelpers::WebViewHelper webViewHelper(this); |
963 webViewHelper.initializeAndLoad(m_baseURL + "iframe_reload.html", true, 0, &
client, enableViewportSettings); | 963 webViewHelper.initializeAndLoad(m_baseURL + "iframe_reload.html", true, null
ptr, &client, nullptr, enableViewportSettings); |
964 | 964 |
965 LocalFrame* mainFrame = toLocalFrame(webViewHelper.webViewImpl()->page()->ma
inFrame()); | 965 LocalFrame* mainFrame = toLocalFrame(webViewHelper.webViewImpl()->page()->ma
inFrame()); |
966 Document* document = mainFrame->document(); | 966 Document* document = mainFrame->document(); |
967 FrameView* frameView = webViewHelper.webViewImpl()->mainFrameImpl()->frameVi
ew(); | 967 FrameView* frameView = webViewHelper.webViewImpl()->mainFrameImpl()->frameVi
ew(); |
968 document->settings()->setTextAutosizingEnabled(true); | 968 document->settings()->setTextAutosizingEnabled(true); |
969 EXPECT_TRUE(document->settings()->textAutosizingEnabled()); | 969 EXPECT_TRUE(document->settings()->textAutosizingEnabled()); |
970 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); | 970 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); |
971 | 971 |
972 for (Frame* frame = mainFrame; frame; frame = frame->tree().traverseNext())
{ | 972 for (Frame* frame = mainFrame; frame; frame = frame->tree().traverseNext())
{ |
973 if (!frame->isLocalFrame()) | 973 if (!frame->isLocalFrame()) |
(...skipping 18 matching lines...) Expand all Loading... |
992 } | 992 } |
993 | 993 |
994 TEST_P(ParameterizedWebFrameTest, ZeroHeightPositiveWidthNotIgnored) | 994 TEST_P(ParameterizedWebFrameTest, ZeroHeightPositiveWidthNotIgnored) |
995 { | 995 { |
996 FixedLayoutTestWebViewClient client; | 996 FixedLayoutTestWebViewClient client; |
997 client.m_screenInfo.deviceScaleFactor = 1; | 997 client.m_screenInfo.deviceScaleFactor = 1; |
998 int viewportWidth = 1280; | 998 int viewportWidth = 1280; |
999 int viewportHeight = 0; | 999 int viewportHeight = 0; |
1000 | 1000 |
1001 FrameTestHelpers::WebViewHelper webViewHelper(this); | 1001 FrameTestHelpers::WebViewHelper webViewHelper(this); |
1002 webViewHelper.initialize(true, 0, &client, enableViewportSettings); | 1002 webViewHelper.initialize(true, nullptr, &client, nullptr, enableViewportSett
ings); |
1003 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); | 1003 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); |
1004 | 1004 |
1005 EXPECT_EQ(viewportWidth, webViewHelper.webViewImpl()->mainFrameImpl()->frame
View()->layoutSize().width()); | 1005 EXPECT_EQ(viewportWidth, webViewHelper.webViewImpl()->mainFrameImpl()->frame
View()->layoutSize().width()); |
1006 EXPECT_EQ(viewportHeight, webViewHelper.webViewImpl()->mainFrameImpl()->fram
eView()->layoutSize().height()); | 1006 EXPECT_EQ(viewportHeight, webViewHelper.webViewImpl()->mainFrameImpl()->fram
eView()->layoutSize().height()); |
1007 } | 1007 } |
1008 | 1008 |
1009 TEST_P(ParameterizedWebFrameTest, DeviceScaleFactorUsesDefaultWithoutViewportTag
) | 1009 TEST_P(ParameterizedWebFrameTest, DeviceScaleFactorUsesDefaultWithoutViewportTag
) |
1010 { | 1010 { |
1011 registerMockedHttpURLLoad("no_viewport_tag.html"); | 1011 registerMockedHttpURLLoad("no_viewport_tag.html"); |
1012 | 1012 |
1013 int viewportWidth = 640; | 1013 int viewportWidth = 640; |
1014 int viewportHeight = 480; | 1014 int viewportHeight = 480; |
1015 | 1015 |
1016 FixedLayoutTestWebViewClient client; | 1016 FixedLayoutTestWebViewClient client; |
1017 client.m_screenInfo.deviceScaleFactor = 2; | 1017 client.m_screenInfo.deviceScaleFactor = 2; |
1018 | 1018 |
1019 FrameTestHelpers::WebViewHelper webViewHelper(this); | 1019 FrameTestHelpers::WebViewHelper webViewHelper(this); |
1020 webViewHelper.initializeAndLoad(m_baseURL + "no_viewport_tag.html", true, 0,
&client, enableViewportSettings); | 1020 webViewHelper.initializeAndLoad(m_baseURL + "no_viewport_tag.html", true, nu
llptr, &client, nullptr, enableViewportSettings); |
1021 | 1021 |
1022 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); | 1022 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); |
1023 | 1023 |
1024 EXPECT_EQ(2, webViewHelper.webViewImpl()->page()->deviceScaleFactor()); | 1024 EXPECT_EQ(2, webViewHelper.webViewImpl()->page()->deviceScaleFactor()); |
1025 | 1025 |
1026 // Device scale factor should be independent of page scale. | 1026 // Device scale factor should be independent of page scale. |
1027 webViewHelper.webView()->setDefaultPageScaleLimits(1, 2); | 1027 webViewHelper.webView()->setDefaultPageScaleLimits(1, 2); |
1028 webViewHelper.webView()->setPageScaleFactor(0.5); | 1028 webViewHelper.webView()->setPageScaleFactor(0.5); |
1029 webViewHelper.webView()->updateAllLifecyclePhases(); | 1029 webViewHelper.webView()->updateAllLifecyclePhases(); |
1030 EXPECT_EQ(1, webViewHelper.webView()->pageScaleFactor()); | 1030 EXPECT_EQ(1, webViewHelper.webView()->pageScaleFactor()); |
1031 | 1031 |
1032 // Force the layout to happen before leaving the test. | 1032 // Force the layout to happen before leaving the test. |
1033 webViewHelper.webView()->updateAllLifecyclePhases(); | 1033 webViewHelper.webView()->updateAllLifecyclePhases(); |
1034 } | 1034 } |
1035 | 1035 |
1036 TEST_P(ParameterizedWebFrameTest, FixedLayoutInitializeAtMinimumScale) | 1036 TEST_P(ParameterizedWebFrameTest, FixedLayoutInitializeAtMinimumScale) |
1037 { | 1037 { |
1038 registerMockedHttpURLLoad("fixed_layout.html"); | 1038 registerMockedHttpURLLoad("fixed_layout.html"); |
1039 | 1039 |
1040 FixedLayoutTestWebViewClient client; | 1040 FixedLayoutTestWebViewClient client; |
1041 client.m_screenInfo.deviceScaleFactor = 1; | 1041 client.m_screenInfo.deviceScaleFactor = 1; |
1042 int viewportWidth = 640; | 1042 int viewportWidth = 640; |
1043 int viewportHeight = 480; | 1043 int viewportHeight = 480; |
1044 | 1044 |
1045 // Make sure we initialize to minimum scale, even if the window size | 1045 // Make sure we initialize to minimum scale, even if the window size |
1046 // only becomes available after the load begins. | 1046 // only becomes available after the load begins. |
1047 FrameTestHelpers::WebViewHelper webViewHelper(this); | 1047 FrameTestHelpers::WebViewHelper webViewHelper(this); |
1048 webViewHelper.initialize(true, 0, &client, enableViewportSettings); | 1048 webViewHelper.initialize(true, nullptr, &client, nullptr, enableViewportSett
ings); |
1049 webViewHelper.webView()->setDefaultPageScaleLimits(0.25f, 5); | 1049 webViewHelper.webView()->setDefaultPageScaleLimits(0.25f, 5); |
1050 FrameTestHelpers::loadFrame(webViewHelper.webView()->mainFrame(), m_baseURL
+ "fixed_layout.html"); | 1050 FrameTestHelpers::loadFrame(webViewHelper.webView()->mainFrame(), m_baseURL
+ "fixed_layout.html"); |
1051 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); | 1051 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); |
1052 | 1052 |
1053 int defaultFixedLayoutWidth = 980; | 1053 int defaultFixedLayoutWidth = 980; |
1054 float minimumPageScaleFactor = viewportWidth / (float) defaultFixedLayoutWid
th; | 1054 float minimumPageScaleFactor = viewportWidth / (float) defaultFixedLayoutWid
th; |
1055 EXPECT_EQ(minimumPageScaleFactor, webViewHelper.webViewImpl()->pageScaleFact
or()); | 1055 EXPECT_EQ(minimumPageScaleFactor, webViewHelper.webViewImpl()->pageScaleFact
or()); |
1056 EXPECT_EQ(minimumPageScaleFactor, webViewHelper.webViewImpl()->minimumPageSc
aleFactor()); | 1056 EXPECT_EQ(minimumPageScaleFactor, webViewHelper.webViewImpl()->minimumPageSc
aleFactor()); |
1057 | 1057 |
1058 // Assume the user has pinch zoomed to page scale factor 2. | 1058 // Assume the user has pinch zoomed to page scale factor 2. |
(...skipping 16 matching lines...) Expand all Loading... |
1075 registerMockedHttpURLLoad("wide_document.html"); | 1075 registerMockedHttpURLLoad("wide_document.html"); |
1076 | 1076 |
1077 FixedLayoutTestWebViewClient client; | 1077 FixedLayoutTestWebViewClient client; |
1078 client.m_screenInfo.deviceScaleFactor = 1; | 1078 client.m_screenInfo.deviceScaleFactor = 1; |
1079 int viewportWidth = 640; | 1079 int viewportWidth = 640; |
1080 int viewportHeight = 480; | 1080 int viewportHeight = 480; |
1081 | 1081 |
1082 // Make sure we initialize to minimum scale, even if the window size | 1082 // Make sure we initialize to minimum scale, even if the window size |
1083 // only becomes available after the load begins. | 1083 // only becomes available after the load begins. |
1084 FrameTestHelpers::WebViewHelper webViewHelper(this); | 1084 FrameTestHelpers::WebViewHelper webViewHelper(this); |
1085 webViewHelper.initialize(true, 0, &client, enableViewportSettings); | 1085 webViewHelper.initialize(true, nullptr, &client, nullptr, enableViewportSett
ings); |
1086 webViewHelper.webView()->setDefaultPageScaleLimits(0.25f, 5); | 1086 webViewHelper.webView()->setDefaultPageScaleLimits(0.25f, 5); |
1087 FrameTestHelpers::loadFrame(webViewHelper.webView()->mainFrame(), m_baseURL
+ "wide_document.html"); | 1087 FrameTestHelpers::loadFrame(webViewHelper.webView()->mainFrame(), m_baseURL
+ "wide_document.html"); |
1088 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); | 1088 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); |
1089 | 1089 |
1090 int wideDocumentWidth = 1500; | 1090 int wideDocumentWidth = 1500; |
1091 float minimumPageScaleFactor = viewportWidth / (float) wideDocumentWidth; | 1091 float minimumPageScaleFactor = viewportWidth / (float) wideDocumentWidth; |
1092 EXPECT_EQ(minimumPageScaleFactor, webViewHelper.webViewImpl()->pageScaleFact
or()); | 1092 EXPECT_EQ(minimumPageScaleFactor, webViewHelper.webViewImpl()->pageScaleFact
or()); |
1093 EXPECT_EQ(minimumPageScaleFactor, webViewHelper.webViewImpl()->minimumPageSc
aleFactor()); | 1093 EXPECT_EQ(minimumPageScaleFactor, webViewHelper.webViewImpl()->minimumPageSc
aleFactor()); |
1094 | 1094 |
1095 // Assume the user has pinch zoomed to page scale factor 2. | 1095 // Assume the user has pinch zoomed to page scale factor 2. |
(...skipping 14 matching lines...) Expand all Loading... |
1110 TEST_P(ParameterizedWebFrameTest, DelayedViewportInitialScale) | 1110 TEST_P(ParameterizedWebFrameTest, DelayedViewportInitialScale) |
1111 { | 1111 { |
1112 registerMockedHttpURLLoad("viewport-auto-initial-scale.html"); | 1112 registerMockedHttpURLLoad("viewport-auto-initial-scale.html"); |
1113 | 1113 |
1114 FixedLayoutTestWebViewClient client; | 1114 FixedLayoutTestWebViewClient client; |
1115 client.m_screenInfo.deviceScaleFactor = 1; | 1115 client.m_screenInfo.deviceScaleFactor = 1; |
1116 int viewportWidth = 640; | 1116 int viewportWidth = 640; |
1117 int viewportHeight = 480; | 1117 int viewportHeight = 480; |
1118 | 1118 |
1119 FrameTestHelpers::WebViewHelper webViewHelper(this); | 1119 FrameTestHelpers::WebViewHelper webViewHelper(this); |
1120 webViewHelper.initializeAndLoad(m_baseURL + "viewport-auto-initial-scale.htm
l", true, 0, &client, enableViewportSettings); | 1120 webViewHelper.initializeAndLoad(m_baseURL + "viewport-auto-initial-scale.htm
l", true, nullptr, &client, nullptr, enableViewportSettings); |
1121 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); | 1121 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); |
1122 | 1122 |
1123 EXPECT_EQ(0.25f, webViewHelper.webView()->pageScaleFactor()); | 1123 EXPECT_EQ(0.25f, webViewHelper.webView()->pageScaleFactor()); |
1124 | 1124 |
1125 Document* document = toLocalFrame(webViewHelper.webViewImpl()->page()->mainF
rame())->document(); | 1125 Document* document = toLocalFrame(webViewHelper.webViewImpl()->page()->mainF
rame())->document(); |
1126 ViewportDescription description = document->viewportDescription(); | 1126 ViewportDescription description = document->viewportDescription(); |
1127 description.zoom = 2; | 1127 description.zoom = 2; |
1128 document->setViewportDescription(description); | 1128 document->setViewportDescription(description); |
1129 webViewHelper.webView()->updateAllLifecyclePhases(); | 1129 webViewHelper.webView()->updateAllLifecyclePhases(); |
1130 EXPECT_EQ(2, webViewHelper.webView()->pageScaleFactor()); | 1130 EXPECT_EQ(2, webViewHelper.webView()->pageScaleFactor()); |
1131 } | 1131 } |
1132 | 1132 |
1133 TEST_P(ParameterizedWebFrameTest, setLoadWithOverviewModeToFalse) | 1133 TEST_P(ParameterizedWebFrameTest, setLoadWithOverviewModeToFalse) |
1134 { | 1134 { |
1135 registerMockedHttpURLLoad("viewport-auto-initial-scale.html"); | 1135 registerMockedHttpURLLoad("viewport-auto-initial-scale.html"); |
1136 | 1136 |
1137 FixedLayoutTestWebViewClient client; | 1137 FixedLayoutTestWebViewClient client; |
1138 client.m_screenInfo.deviceScaleFactor = 1; | 1138 client.m_screenInfo.deviceScaleFactor = 1; |
1139 int viewportWidth = 640; | 1139 int viewportWidth = 640; |
1140 int viewportHeight = 480; | 1140 int viewportHeight = 480; |
1141 | 1141 |
1142 FrameTestHelpers::WebViewHelper webViewHelper(this); | 1142 FrameTestHelpers::WebViewHelper webViewHelper(this); |
1143 webViewHelper.initializeAndLoad(m_baseURL + "viewport-auto-initial-scale.htm
l", true, 0, &client, enableViewportSettings); | 1143 webViewHelper.initializeAndLoad(m_baseURL + "viewport-auto-initial-scale.htm
l", true, nullptr, &client, nullptr, enableViewportSettings); |
1144 webViewHelper.webView()->settings()->setWideViewportQuirkEnabled(true); | 1144 webViewHelper.webView()->settings()->setWideViewportQuirkEnabled(true); |
1145 webViewHelper.webView()->settings()->setLoadWithOverviewMode(false); | 1145 webViewHelper.webView()->settings()->setLoadWithOverviewMode(false); |
1146 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); | 1146 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); |
1147 | 1147 |
1148 // The page must be displayed at 100% zoom. | 1148 // The page must be displayed at 100% zoom. |
1149 EXPECT_EQ(1.0f, webViewHelper.webView()->pageScaleFactor()); | 1149 EXPECT_EQ(1.0f, webViewHelper.webView()->pageScaleFactor()); |
1150 } | 1150 } |
1151 | 1151 |
1152 TEST_P(ParameterizedWebFrameTest, SetLoadWithOverviewModeToFalseAndNoWideViewpor
t) | 1152 TEST_P(ParameterizedWebFrameTest, SetLoadWithOverviewModeToFalseAndNoWideViewpor
t) |
1153 { | 1153 { |
1154 registerMockedHttpURLLoad("large-div.html"); | 1154 registerMockedHttpURLLoad("large-div.html"); |
1155 | 1155 |
1156 FixedLayoutTestWebViewClient client; | 1156 FixedLayoutTestWebViewClient client; |
1157 client.m_screenInfo.deviceScaleFactor = 1; | 1157 client.m_screenInfo.deviceScaleFactor = 1; |
1158 int viewportWidth = 640; | 1158 int viewportWidth = 640; |
1159 int viewportHeight = 480; | 1159 int viewportHeight = 480; |
1160 | 1160 |
1161 FrameTestHelpers::WebViewHelper webViewHelper(this); | 1161 FrameTestHelpers::WebViewHelper webViewHelper(this); |
1162 webViewHelper.initializeAndLoad(m_baseURL + "large-div.html", true, 0, &clie
nt, enableViewportSettings); | 1162 webViewHelper.initializeAndLoad(m_baseURL + "large-div.html", true, nullptr,
&client, nullptr, enableViewportSettings); |
1163 webViewHelper.webView()->settings()->setLoadWithOverviewMode(false); | 1163 webViewHelper.webView()->settings()->setLoadWithOverviewMode(false); |
1164 webViewHelper.webView()->settings()->setWideViewportQuirkEnabled(true); | 1164 webViewHelper.webView()->settings()->setWideViewportQuirkEnabled(true); |
1165 webViewHelper.webView()->settings()->setUseWideViewport(false); | 1165 webViewHelper.webView()->settings()->setUseWideViewport(false); |
1166 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); | 1166 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); |
1167 | 1167 |
1168 // The page must be displayed at 100% zoom, despite that it hosts a wide div
element. | 1168 // The page must be displayed at 100% zoom, despite that it hosts a wide div
element. |
1169 EXPECT_EQ(1.0f, webViewHelper.webView()->pageScaleFactor()); | 1169 EXPECT_EQ(1.0f, webViewHelper.webView()->pageScaleFactor()); |
1170 } | 1170 } |
1171 | 1171 |
1172 TEST_P(ParameterizedWebFrameTest, NoWideViewportIgnoresPageViewportWidth) | 1172 TEST_P(ParameterizedWebFrameTest, NoWideViewportIgnoresPageViewportWidth) |
1173 { | 1173 { |
1174 registerMockedHttpURLLoad("viewport-auto-initial-scale.html"); | 1174 registerMockedHttpURLLoad("viewport-auto-initial-scale.html"); |
1175 | 1175 |
1176 FixedLayoutTestWebViewClient client; | 1176 FixedLayoutTestWebViewClient client; |
1177 client.m_screenInfo.deviceScaleFactor = 1; | 1177 client.m_screenInfo.deviceScaleFactor = 1; |
1178 int viewportWidth = 640; | 1178 int viewportWidth = 640; |
1179 int viewportHeight = 480; | 1179 int viewportHeight = 480; |
1180 | 1180 |
1181 FrameTestHelpers::WebViewHelper webViewHelper(this); | 1181 FrameTestHelpers::WebViewHelper webViewHelper(this); |
1182 webViewHelper.initializeAndLoad(m_baseURL + "viewport-auto-initial-scale.htm
l", true, 0, &client, enableViewportSettings); | 1182 webViewHelper.initializeAndLoad(m_baseURL + "viewport-auto-initial-scale.htm
l", true, nullptr, &client, nullptr, enableViewportSettings); |
1183 webViewHelper.webView()->settings()->setWideViewportQuirkEnabled(true); | 1183 webViewHelper.webView()->settings()->setWideViewportQuirkEnabled(true); |
1184 webViewHelper.webView()->settings()->setUseWideViewport(false); | 1184 webViewHelper.webView()->settings()->setUseWideViewport(false); |
1185 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); | 1185 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); |
1186 | 1186 |
1187 // The page sets viewport width to 3000, but with UseWideViewport == false i
s must be ignored. | 1187 // The page sets viewport width to 3000, but with UseWideViewport == false i
s must be ignored. |
1188 EXPECT_EQ(viewportWidth, webViewHelper.webViewImpl()->mainFrameImpl()->frame
View()->contentsSize().width()); | 1188 EXPECT_EQ(viewportWidth, webViewHelper.webViewImpl()->mainFrameImpl()->frame
View()->contentsSize().width()); |
1189 EXPECT_EQ(viewportHeight, webViewHelper.webViewImpl()->mainFrameImpl()->fram
eView()->contentsSize().height()); | 1189 EXPECT_EQ(viewportHeight, webViewHelper.webViewImpl()->mainFrameImpl()->fram
eView()->contentsSize().height()); |
1190 } | 1190 } |
1191 | 1191 |
1192 TEST_P(ParameterizedWebFrameTest, NoWideViewportIgnoresPageViewportWidthButAccou
ntsScale) | 1192 TEST_P(ParameterizedWebFrameTest, NoWideViewportIgnoresPageViewportWidthButAccou
ntsScale) |
1193 { | 1193 { |
1194 registerMockedHttpURLLoad("viewport-wide-2x-initial-scale.html"); | 1194 registerMockedHttpURLLoad("viewport-wide-2x-initial-scale.html"); |
1195 | 1195 |
1196 FixedLayoutTestWebViewClient client; | 1196 FixedLayoutTestWebViewClient client; |
1197 client.m_screenInfo.deviceScaleFactor = 1; | 1197 client.m_screenInfo.deviceScaleFactor = 1; |
1198 int viewportWidth = 640; | 1198 int viewportWidth = 640; |
1199 int viewportHeight = 480; | 1199 int viewportHeight = 480; |
1200 | 1200 |
1201 FrameTestHelpers::WebViewHelper webViewHelper(this); | 1201 FrameTestHelpers::WebViewHelper webViewHelper(this); |
1202 webViewHelper.initializeAndLoad(m_baseURL + "viewport-wide-2x-initial-scale.
html", true, 0, &client, enableViewportSettings); | 1202 webViewHelper.initializeAndLoad(m_baseURL + "viewport-wide-2x-initial-scale.
html", true, nullptr, &client, nullptr, enableViewportSettings); |
1203 webViewHelper.webView()->settings()->setWideViewportQuirkEnabled(true); | 1203 webViewHelper.webView()->settings()->setWideViewportQuirkEnabled(true); |
1204 webViewHelper.webView()->settings()->setUseWideViewport(false); | 1204 webViewHelper.webView()->settings()->setUseWideViewport(false); |
1205 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); | 1205 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); |
1206 | 1206 |
1207 // The page sets viewport width to 3000, but with UseWideViewport == false i
t must be ignored. | 1207 // The page sets viewport width to 3000, but with UseWideViewport == false i
t must be ignored. |
1208 // While the initial scale specified by the page must be accounted. | 1208 // While the initial scale specified by the page must be accounted. |
1209 EXPECT_EQ(viewportWidth / 2, webViewHelper.webViewImpl()->mainFrameImpl()->f
rameView()->contentsSize().width()); | 1209 EXPECT_EQ(viewportWidth / 2, webViewHelper.webViewImpl()->mainFrameImpl()->f
rameView()->contentsSize().width()); |
1210 EXPECT_EQ(viewportHeight / 2, webViewHelper.webViewImpl()->mainFrameImpl()->
frameView()->contentsSize().height()); | 1210 EXPECT_EQ(viewportHeight / 2, webViewHelper.webViewImpl()->mainFrameImpl()->
frameView()->contentsSize().height()); |
1211 } | 1211 } |
1212 | 1212 |
1213 TEST_P(ParameterizedWebFrameTest, WideViewportSetsTo980WithoutViewportTag) | 1213 TEST_P(ParameterizedWebFrameTest, WideViewportSetsTo980WithoutViewportTag) |
1214 { | 1214 { |
1215 registerMockedHttpURLLoad("no_viewport_tag.html"); | 1215 registerMockedHttpURLLoad("no_viewport_tag.html"); |
1216 | 1216 |
1217 FixedLayoutTestWebViewClient client; | 1217 FixedLayoutTestWebViewClient client; |
1218 client.m_screenInfo.deviceScaleFactor = 1; | 1218 client.m_screenInfo.deviceScaleFactor = 1; |
1219 int viewportWidth = 640; | 1219 int viewportWidth = 640; |
1220 int viewportHeight = 480; | 1220 int viewportHeight = 480; |
1221 | 1221 |
1222 FrameTestHelpers::WebViewHelper webViewHelper(this); | 1222 FrameTestHelpers::WebViewHelper webViewHelper(this); |
1223 webViewHelper.initializeAndLoad(m_baseURL + "no_viewport_tag.html", true, 0,
&client, enableViewportSettings); | 1223 webViewHelper.initializeAndLoad(m_baseURL + "no_viewport_tag.html", true, nu
llptr, &client, nullptr, enableViewportSettings); |
1224 applyViewportStyleOverride(&webViewHelper); | 1224 applyViewportStyleOverride(&webViewHelper); |
1225 webViewHelper.webView()->settings()->setWideViewportQuirkEnabled(true); | 1225 webViewHelper.webView()->settings()->setWideViewportQuirkEnabled(true); |
1226 webViewHelper.webView()->settings()->setUseWideViewport(true); | 1226 webViewHelper.webView()->settings()->setUseWideViewport(true); |
1227 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); | 1227 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); |
1228 | 1228 |
1229 EXPECT_EQ(980, webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->co
ntentsSize().width()); | 1229 EXPECT_EQ(980, webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->co
ntentsSize().width()); |
1230 EXPECT_EQ(980.0 / viewportWidth * viewportHeight, webViewHelper.webViewImpl(
)->mainFrameImpl()->frameView()->contentsSize().height()); | 1230 EXPECT_EQ(980.0 / viewportWidth * viewportHeight, webViewHelper.webViewImpl(
)->mainFrameImpl()->frameView()->contentsSize().height()); |
1231 } | 1231 } |
1232 | 1232 |
1233 TEST_P(ParameterizedWebFrameTest, WideViewportSetsTo980WithXhtmlMp) | 1233 TEST_P(ParameterizedWebFrameTest, WideViewportSetsTo980WithXhtmlMp) |
1234 { | 1234 { |
1235 registerMockedHttpURLLoad("viewport/viewport-legacy-xhtmlmp.html"); | 1235 registerMockedHttpURLLoad("viewport/viewport-legacy-xhtmlmp.html"); |
1236 | 1236 |
1237 FixedLayoutTestWebViewClient client; | 1237 FixedLayoutTestWebViewClient client; |
1238 client.m_screenInfo.deviceScaleFactor = 1; | 1238 client.m_screenInfo.deviceScaleFactor = 1; |
1239 int viewportWidth = 640; | 1239 int viewportWidth = 640; |
1240 int viewportHeight = 480; | 1240 int viewportHeight = 480; |
1241 | 1241 |
1242 FrameTestHelpers::WebViewHelper webViewHelper(this); | 1242 FrameTestHelpers::WebViewHelper webViewHelper(this); |
1243 webViewHelper.initialize(true, 0, &client, enableViewportSettings); | 1243 webViewHelper.initialize(true, nullptr, &client, nullptr, enableViewportSett
ings); |
1244 applyViewportStyleOverride(&webViewHelper); | 1244 applyViewportStyleOverride(&webViewHelper); |
1245 webViewHelper.webView()->settings()->setWideViewportQuirkEnabled(true); | 1245 webViewHelper.webView()->settings()->setWideViewportQuirkEnabled(true); |
1246 webViewHelper.webView()->settings()->setUseWideViewport(true); | 1246 webViewHelper.webView()->settings()->setUseWideViewport(true); |
1247 FrameTestHelpers::loadFrame(webViewHelper.webView()->mainFrame(), m_baseURL
+ "viewport/viewport-legacy-xhtmlmp.html"); | 1247 FrameTestHelpers::loadFrame(webViewHelper.webView()->mainFrame(), m_baseURL
+ "viewport/viewport-legacy-xhtmlmp.html"); |
1248 | 1248 |
1249 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); | 1249 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); |
1250 EXPECT_EQ(viewportWidth, webViewHelper.webViewImpl()->mainFrameImpl()->frame
View()->contentsSize().width()); | 1250 EXPECT_EQ(viewportWidth, webViewHelper.webViewImpl()->mainFrameImpl()->frame
View()->contentsSize().width()); |
1251 EXPECT_EQ(viewportHeight, webViewHelper.webViewImpl()->mainFrameImpl()->fram
eView()->contentsSize().height()); | 1251 EXPECT_EQ(viewportHeight, webViewHelper.webViewImpl()->mainFrameImpl()->fram
eView()->contentsSize().height()); |
1252 } | 1252 } |
1253 | 1253 |
1254 TEST_P(ParameterizedWebFrameTest, NoWideViewportAndHeightInMeta) | 1254 TEST_P(ParameterizedWebFrameTest, NoWideViewportAndHeightInMeta) |
1255 { | 1255 { |
1256 registerMockedHttpURLLoad("viewport-height-1000.html"); | 1256 registerMockedHttpURLLoad("viewport-height-1000.html"); |
1257 | 1257 |
1258 FixedLayoutTestWebViewClient client; | 1258 FixedLayoutTestWebViewClient client; |
1259 client.m_screenInfo.deviceScaleFactor = 1; | 1259 client.m_screenInfo.deviceScaleFactor = 1; |
1260 int viewportWidth = 640; | 1260 int viewportWidth = 640; |
1261 int viewportHeight = 480; | 1261 int viewportHeight = 480; |
1262 | 1262 |
1263 FrameTestHelpers::WebViewHelper webViewHelper(this); | 1263 FrameTestHelpers::WebViewHelper webViewHelper(this); |
1264 webViewHelper.initializeAndLoad(m_baseURL + "viewport-height-1000.html", tru
e, 0, &client, enableViewportSettings); | 1264 webViewHelper.initializeAndLoad(m_baseURL + "viewport-height-1000.html", tru
e, nullptr, &client, nullptr, enableViewportSettings); |
1265 webViewHelper.webView()->settings()->setWideViewportQuirkEnabled(true); | 1265 webViewHelper.webView()->settings()->setWideViewportQuirkEnabled(true); |
1266 webViewHelper.webView()->settings()->setUseWideViewport(false); | 1266 webViewHelper.webView()->settings()->setUseWideViewport(false); |
1267 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); | 1267 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); |
1268 | 1268 |
1269 EXPECT_EQ(viewportWidth, webViewHelper.webViewImpl()->mainFrameImpl()->frame
View()->contentsSize().width()); | 1269 EXPECT_EQ(viewportWidth, webViewHelper.webViewImpl()->mainFrameImpl()->frame
View()->contentsSize().width()); |
1270 } | 1270 } |
1271 | 1271 |
1272 TEST_P(ParameterizedWebFrameTest, WideViewportSetsTo980WithAutoWidth) | 1272 TEST_P(ParameterizedWebFrameTest, WideViewportSetsTo980WithAutoWidth) |
1273 { | 1273 { |
1274 registerMockedHttpURLLoad("viewport-2x-initial-scale.html"); | 1274 registerMockedHttpURLLoad("viewport-2x-initial-scale.html"); |
1275 | 1275 |
1276 FixedLayoutTestWebViewClient client; | 1276 FixedLayoutTestWebViewClient client; |
1277 client.m_screenInfo.deviceScaleFactor = 1; | 1277 client.m_screenInfo.deviceScaleFactor = 1; |
1278 int viewportWidth = 640; | 1278 int viewportWidth = 640; |
1279 int viewportHeight = 480; | 1279 int viewportHeight = 480; |
1280 | 1280 |
1281 FrameTestHelpers::WebViewHelper webViewHelper(this); | 1281 FrameTestHelpers::WebViewHelper webViewHelper(this); |
1282 webViewHelper.initializeAndLoad(m_baseURL + "viewport-2x-initial-scale.html"
, true, 0, &client, enableViewportSettings); | 1282 webViewHelper.initializeAndLoad(m_baseURL + "viewport-2x-initial-scale.html"
, true, nullptr, &client, nullptr, enableViewportSettings); |
1283 applyViewportStyleOverride(&webViewHelper); | 1283 applyViewportStyleOverride(&webViewHelper); |
1284 webViewHelper.webView()->settings()->setWideViewportQuirkEnabled(true); | 1284 webViewHelper.webView()->settings()->setWideViewportQuirkEnabled(true); |
1285 webViewHelper.webView()->settings()->setUseWideViewport(true); | 1285 webViewHelper.webView()->settings()->setUseWideViewport(true); |
1286 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); | 1286 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); |
1287 | 1287 |
1288 EXPECT_EQ(980, webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->co
ntentsSize().width()); | 1288 EXPECT_EQ(980, webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->co
ntentsSize().width()); |
1289 EXPECT_EQ(980.0 / viewportWidth * viewportHeight, webViewHelper.webViewImpl(
)->mainFrameImpl()->frameView()->contentsSize().height()); | 1289 EXPECT_EQ(980.0 / viewportWidth * viewportHeight, webViewHelper.webViewImpl(
)->mainFrameImpl()->frameView()->contentsSize().height()); |
1290 } | 1290 } |
1291 | 1291 |
1292 TEST_P(ParameterizedWebFrameTest, PageViewportInitialScaleOverridesLoadWithOverv
iewMode) | 1292 TEST_P(ParameterizedWebFrameTest, PageViewportInitialScaleOverridesLoadWithOverv
iewMode) |
1293 { | 1293 { |
1294 registerMockedHttpURLLoad("viewport-wide-2x-initial-scale.html"); | 1294 registerMockedHttpURLLoad("viewport-wide-2x-initial-scale.html"); |
1295 | 1295 |
1296 FixedLayoutTestWebViewClient client; | 1296 FixedLayoutTestWebViewClient client; |
1297 client.m_screenInfo.deviceScaleFactor = 1; | 1297 client.m_screenInfo.deviceScaleFactor = 1; |
1298 int viewportWidth = 640; | 1298 int viewportWidth = 640; |
1299 int viewportHeight = 480; | 1299 int viewportHeight = 480; |
1300 | 1300 |
1301 FrameTestHelpers::WebViewHelper webViewHelper(this); | 1301 FrameTestHelpers::WebViewHelper webViewHelper(this); |
1302 webViewHelper.initializeAndLoad(m_baseURL + "viewport-wide-2x-initial-scale.
html", true, 0, &client, enableViewportSettings); | 1302 webViewHelper.initializeAndLoad(m_baseURL + "viewport-wide-2x-initial-scale.
html", true, nullptr, &client, nullptr, enableViewportSettings); |
1303 webViewHelper.webView()->settings()->setLoadWithOverviewMode(false); | 1303 webViewHelper.webView()->settings()->setLoadWithOverviewMode(false); |
1304 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); | 1304 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); |
1305 | 1305 |
1306 // The page must be displayed at 200% zoom, as specified in its viewport met
a tag. | 1306 // The page must be displayed at 200% zoom, as specified in its viewport met
a tag. |
1307 EXPECT_EQ(2.0f, webViewHelper.webView()->pageScaleFactor()); | 1307 EXPECT_EQ(2.0f, webViewHelper.webView()->pageScaleFactor()); |
1308 } | 1308 } |
1309 | 1309 |
1310 TEST_P(ParameterizedWebFrameTest, setInitialPageScaleFactorPermanently) | 1310 TEST_P(ParameterizedWebFrameTest, setInitialPageScaleFactorPermanently) |
1311 { | 1311 { |
1312 registerMockedHttpURLLoad("fixed_layout.html"); | 1312 registerMockedHttpURLLoad("fixed_layout.html"); |
1313 | 1313 |
1314 FixedLayoutTestWebViewClient client; | 1314 FixedLayoutTestWebViewClient client; |
1315 client.m_screenInfo.deviceScaleFactor = 1; | 1315 client.m_screenInfo.deviceScaleFactor = 1; |
1316 float enforcedPageScaleFactor = 2.0f; | 1316 float enforcedPageScaleFactor = 2.0f; |
1317 | 1317 |
1318 FrameTestHelpers::WebViewHelper webViewHelper(this); | 1318 FrameTestHelpers::WebViewHelper webViewHelper(this); |
1319 webViewHelper.initializeAndLoad(m_baseURL + "fixed_layout.html", true, 0, &c
lient, enableViewportSettings); | 1319 webViewHelper.initializeAndLoad(m_baseURL + "fixed_layout.html", true, nullp
tr, &client, nullptr, enableViewportSettings); |
1320 applyViewportStyleOverride(&webViewHelper); | 1320 applyViewportStyleOverride(&webViewHelper); |
1321 webViewHelper.webView()->settings()->setWideViewportQuirkEnabled(true); | 1321 webViewHelper.webView()->settings()->setWideViewportQuirkEnabled(true); |
1322 webViewHelper.webView()->settings()->setLoadWithOverviewMode(false); | 1322 webViewHelper.webView()->settings()->setLoadWithOverviewMode(false); |
1323 webViewHelper.webView()->setInitialPageScaleOverride(enforcedPageScaleFactor
); | 1323 webViewHelper.webView()->setInitialPageScaleOverride(enforcedPageScaleFactor
); |
1324 webViewHelper.webView()->updateAllLifecyclePhases(); | 1324 webViewHelper.webView()->updateAllLifecyclePhases(); |
1325 | 1325 |
1326 EXPECT_EQ(enforcedPageScaleFactor, webViewHelper.webView()->pageScaleFactor(
)); | 1326 EXPECT_EQ(enforcedPageScaleFactor, webViewHelper.webView()->pageScaleFactor(
)); |
1327 | 1327 |
1328 int viewportWidth = 640; | 1328 int viewportWidth = 640; |
1329 int viewportHeight = 480; | 1329 int viewportHeight = 480; |
(...skipping 10 matching lines...) Expand all Loading... |
1340 { | 1340 { |
1341 registerMockedHttpURLLoad("viewport-auto-initial-scale.html"); | 1341 registerMockedHttpURLLoad("viewport-auto-initial-scale.html"); |
1342 | 1342 |
1343 FixedLayoutTestWebViewClient client; | 1343 FixedLayoutTestWebViewClient client; |
1344 client.m_screenInfo.deviceScaleFactor = 1; | 1344 client.m_screenInfo.deviceScaleFactor = 1; |
1345 int viewportWidth = 640; | 1345 int viewportWidth = 640; |
1346 int viewportHeight = 480; | 1346 int viewportHeight = 480; |
1347 float enforcedPageScaleFactor = 0.5f; | 1347 float enforcedPageScaleFactor = 0.5f; |
1348 | 1348 |
1349 FrameTestHelpers::WebViewHelper webViewHelper(this); | 1349 FrameTestHelpers::WebViewHelper webViewHelper(this); |
1350 webViewHelper.initializeAndLoad(m_baseURL + "viewport-auto-initial-scale.htm
l", true, 0, &client, enableViewportSettings); | 1350 webViewHelper.initializeAndLoad(m_baseURL + "viewport-auto-initial-scale.htm
l", true, nullptr, &client, nullptr, enableViewportSettings); |
1351 webViewHelper.webView()->settings()->setLoadWithOverviewMode(false); | 1351 webViewHelper.webView()->settings()->setLoadWithOverviewMode(false); |
1352 webViewHelper.webView()->setInitialPageScaleOverride(enforcedPageScaleFactor
); | 1352 webViewHelper.webView()->setInitialPageScaleOverride(enforcedPageScaleFactor
); |
1353 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); | 1353 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); |
1354 | 1354 |
1355 EXPECT_EQ(enforcedPageScaleFactor, webViewHelper.webView()->pageScaleFactor(
)); | 1355 EXPECT_EQ(enforcedPageScaleFactor, webViewHelper.webView()->pageScaleFactor(
)); |
1356 } | 1356 } |
1357 | 1357 |
1358 TEST_P(ParameterizedWebFrameTest, PermanentInitialPageScaleFactorOverridesPageVi
ewportInitialScale) | 1358 TEST_P(ParameterizedWebFrameTest, PermanentInitialPageScaleFactorOverridesPageVi
ewportInitialScale) |
1359 { | 1359 { |
1360 registerMockedHttpURLLoad("viewport-wide-2x-initial-scale.html"); | 1360 registerMockedHttpURLLoad("viewport-wide-2x-initial-scale.html"); |
1361 | 1361 |
1362 FixedLayoutTestWebViewClient client; | 1362 FixedLayoutTestWebViewClient client; |
1363 client.m_screenInfo.deviceScaleFactor = 1; | 1363 client.m_screenInfo.deviceScaleFactor = 1; |
1364 int viewportWidth = 640; | 1364 int viewportWidth = 640; |
1365 int viewportHeight = 480; | 1365 int viewportHeight = 480; |
1366 float enforcedPageScaleFactor = 0.5f; | 1366 float enforcedPageScaleFactor = 0.5f; |
1367 | 1367 |
1368 FrameTestHelpers::WebViewHelper webViewHelper(this); | 1368 FrameTestHelpers::WebViewHelper webViewHelper(this); |
1369 webViewHelper.initializeAndLoad(m_baseURL + "viewport-wide-2x-initial-scale.
html", true, 0, &client, enableViewportSettings); | 1369 webViewHelper.initializeAndLoad(m_baseURL + "viewport-wide-2x-initial-scale.
html", true, nullptr, &client, nullptr, enableViewportSettings); |
1370 webViewHelper.webView()->setInitialPageScaleOverride(enforcedPageScaleFactor
); | 1370 webViewHelper.webView()->setInitialPageScaleOverride(enforcedPageScaleFactor
); |
1371 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); | 1371 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); |
1372 | 1372 |
1373 EXPECT_EQ(enforcedPageScaleFactor, webViewHelper.webView()->pageScaleFactor(
)); | 1373 EXPECT_EQ(enforcedPageScaleFactor, webViewHelper.webView()->pageScaleFactor(
)); |
1374 } | 1374 } |
1375 | 1375 |
1376 TEST_P(ParameterizedWebFrameTest, SmallPermanentInitialPageScaleFactorIsClobbere
d) | 1376 TEST_P(ParameterizedWebFrameTest, SmallPermanentInitialPageScaleFactorIsClobbere
d) |
1377 { | 1377 { |
1378 const char* pages[] = { | 1378 const char* pages[] = { |
1379 // These pages trigger the clobbering condition. There must be a matchin
g item in "pageScaleFactors" array. | 1379 // These pages trigger the clobbering condition. There must be a matchin
g item in "pageScaleFactors" array. |
1380 "viewport-device-0.5x-initial-scale.html", | 1380 "viewport-device-0.5x-initial-scale.html", |
1381 "viewport-initial-scale-1.html", | 1381 "viewport-initial-scale-1.html", |
1382 // These ones do not. | 1382 // These ones do not. |
1383 "viewport-auto-initial-scale.html", | 1383 "viewport-auto-initial-scale.html", |
1384 "viewport-target-densitydpi-device-and-fixed-width.html" | 1384 "viewport-target-densitydpi-device-and-fixed-width.html" |
1385 }; | 1385 }; |
1386 float pageScaleFactors[] = { 0.5f, 1.0f }; | 1386 float pageScaleFactors[] = { 0.5f, 1.0f }; |
1387 for (size_t i = 0; i < WTF_ARRAY_LENGTH(pages); ++i) | 1387 for (size_t i = 0; i < WTF_ARRAY_LENGTH(pages); ++i) |
1388 registerMockedHttpURLLoad(pages[i]); | 1388 registerMockedHttpURLLoad(pages[i]); |
1389 | 1389 |
1390 FixedLayoutTestWebViewClient client; | 1390 FixedLayoutTestWebViewClient client; |
1391 client.m_screenInfo.deviceScaleFactor = 1; | 1391 client.m_screenInfo.deviceScaleFactor = 1; |
1392 int viewportWidth = 400; | 1392 int viewportWidth = 400; |
1393 int viewportHeight = 300; | 1393 int viewportHeight = 300; |
1394 float enforcedPageScaleFactor = 0.75f; | 1394 float enforcedPageScaleFactor = 0.75f; |
1395 | 1395 |
1396 for (size_t i = 0; i < WTF_ARRAY_LENGTH(pages); ++i) { | 1396 for (size_t i = 0; i < WTF_ARRAY_LENGTH(pages); ++i) { |
1397 for (int quirkEnabled = 0; quirkEnabled <= 1; ++quirkEnabled) { | 1397 for (int quirkEnabled = 0; quirkEnabled <= 1; ++quirkEnabled) { |
1398 FrameTestHelpers::WebViewHelper webViewHelper(this); | 1398 FrameTestHelpers::WebViewHelper webViewHelper(this); |
1399 webViewHelper.initializeAndLoad(m_baseURL + pages[i], true, 0, &clie
nt, enableViewportSettings); | 1399 webViewHelper.initializeAndLoad(m_baseURL + pages[i], true, nullptr,
&client, nullptr, enableViewportSettings); |
1400 applyViewportStyleOverride(&webViewHelper); | 1400 applyViewportStyleOverride(&webViewHelper); |
1401 webViewHelper.webView()->settings()->setClobberUserAgentInitialScale
Quirk(quirkEnabled); | 1401 webViewHelper.webView()->settings()->setClobberUserAgentInitialScale
Quirk(quirkEnabled); |
1402 webViewHelper.webView()->setInitialPageScaleOverride(enforcedPageSca
leFactor); | 1402 webViewHelper.webView()->setInitialPageScaleOverride(enforcedPageSca
leFactor); |
1403 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); | 1403 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); |
1404 | 1404 |
1405 float expectedPageScaleFactor = quirkEnabled && i < WTF_ARRAY_LENGTH
(pageScaleFactors) ? pageScaleFactors[i] : enforcedPageScaleFactor; | 1405 float expectedPageScaleFactor = quirkEnabled && i < WTF_ARRAY_LENGTH
(pageScaleFactors) ? pageScaleFactors[i] : enforcedPageScaleFactor; |
1406 EXPECT_EQ(expectedPageScaleFactor, webViewHelper.webView()->pageScal
eFactor()); | 1406 EXPECT_EQ(expectedPageScaleFactor, webViewHelper.webView()->pageScal
eFactor()); |
1407 } | 1407 } |
1408 } | 1408 } |
1409 } | 1409 } |
1410 | 1410 |
1411 TEST_P(ParameterizedWebFrameTest, PermanentInitialPageScaleFactorAffectsLayoutWi
dth) | 1411 TEST_P(ParameterizedWebFrameTest, PermanentInitialPageScaleFactorAffectsLayoutWi
dth) |
1412 { | 1412 { |
1413 FixedLayoutTestWebViewClient client; | 1413 FixedLayoutTestWebViewClient client; |
1414 client.m_screenInfo.deviceScaleFactor = 1; | 1414 client.m_screenInfo.deviceScaleFactor = 1; |
1415 int viewportWidth = 640; | 1415 int viewportWidth = 640; |
1416 int viewportHeight = 480; | 1416 int viewportHeight = 480; |
1417 float enforcedPageScaleFactor = 0.5; | 1417 float enforcedPageScaleFactor = 0.5; |
1418 | 1418 |
1419 FrameTestHelpers::WebViewHelper webViewHelper(this); | 1419 FrameTestHelpers::WebViewHelper webViewHelper(this); |
1420 webViewHelper.initializeAndLoad("about:blank", true, 0, &client, enableViewp
ortSettings); | 1420 webViewHelper.initializeAndLoad("about:blank", true, nullptr, &client, nullp
tr, enableViewportSettings); |
1421 webViewHelper.webView()->settings()->setWideViewportQuirkEnabled(true); | 1421 webViewHelper.webView()->settings()->setWideViewportQuirkEnabled(true); |
1422 webViewHelper.webView()->settings()->setUseWideViewport(false); | 1422 webViewHelper.webView()->settings()->setUseWideViewport(false); |
1423 webViewHelper.webView()->settings()->setLoadWithOverviewMode(false); | 1423 webViewHelper.webView()->settings()->setLoadWithOverviewMode(false); |
1424 webViewHelper.webView()->setInitialPageScaleOverride(enforcedPageScaleFactor
); | 1424 webViewHelper.webView()->setInitialPageScaleOverride(enforcedPageScaleFactor
); |
1425 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); | 1425 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); |
1426 | 1426 |
1427 EXPECT_EQ(viewportWidth / enforcedPageScaleFactor, webViewHelper.webViewImpl
()->mainFrameImpl()->frameView()->contentsSize().width()); | 1427 EXPECT_EQ(viewportWidth / enforcedPageScaleFactor, webViewHelper.webViewImpl
()->mainFrameImpl()->frameView()->contentsSize().width()); |
1428 EXPECT_EQ(enforcedPageScaleFactor, webViewHelper.webView()->pageScaleFactor(
)); | 1428 EXPECT_EQ(enforcedPageScaleFactor, webViewHelper.webView()->pageScaleFactor(
)); |
1429 } | 1429 } |
1430 | 1430 |
1431 TEST_P(ParameterizedWebFrameTest, DocumentElementClientHeightWorksWithWrapConten
tMode) | 1431 TEST_P(ParameterizedWebFrameTest, DocumentElementClientHeightWorksWithWrapConten
tMode) |
1432 { | 1432 { |
1433 registerMockedHttpURLLoad("0-by-0.html"); | 1433 registerMockedHttpURLLoad("0-by-0.html"); |
1434 | 1434 |
1435 FixedLayoutTestWebViewClient client; | 1435 FixedLayoutTestWebViewClient client; |
1436 client.m_screenInfo.deviceScaleFactor = 1; | 1436 client.m_screenInfo.deviceScaleFactor = 1; |
1437 int viewportWidth = 640; | 1437 int viewportWidth = 640; |
1438 int viewportHeight = 480; | 1438 int viewportHeight = 480; |
1439 | 1439 |
1440 FrameTestHelpers::WebViewHelper webViewHelper(this); | 1440 FrameTestHelpers::WebViewHelper webViewHelper(this); |
1441 | 1441 |
1442 webViewHelper.initializeAndLoad(m_baseURL + "0-by-0.html", true, 0, &client,
configureAndroid); | 1442 webViewHelper.initializeAndLoad(m_baseURL + "0-by-0.html", true, nullptr, &c
lient, nullptr, configureAndroid); |
1443 webViewHelper.webView()->settings()->setForceZeroLayoutHeight(true); | 1443 webViewHelper.webView()->settings()->setForceZeroLayoutHeight(true); |
1444 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); | 1444 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); |
1445 | 1445 |
1446 LocalFrame* frame = webViewHelper.webViewImpl()->mainFrameImpl()->frame(); | 1446 LocalFrame* frame = webViewHelper.webViewImpl()->mainFrameImpl()->frame(); |
1447 Document* document = frame->document(); | 1447 Document* document = frame->document(); |
1448 EXPECT_EQ(viewportHeight, document->documentElement()->clientHeight()); | 1448 EXPECT_EQ(viewportHeight, document->documentElement()->clientHeight()); |
1449 EXPECT_EQ(viewportWidth, document->documentElement()->clientWidth()); | 1449 EXPECT_EQ(viewportWidth, document->documentElement()->clientWidth()); |
1450 } | 1450 } |
1451 | 1451 |
1452 TEST_P(ParameterizedWebFrameTest, SetForceZeroLayoutHeightWorksWithWrapContentMo
de) | 1452 TEST_P(ParameterizedWebFrameTest, SetForceZeroLayoutHeightWorksWithWrapContentMo
de) |
1453 { | 1453 { |
1454 registerMockedHttpURLLoad("0-by-0.html"); | 1454 registerMockedHttpURLLoad("0-by-0.html"); |
1455 | 1455 |
1456 FixedLayoutTestWebViewClient client; | 1456 FixedLayoutTestWebViewClient client; |
1457 client.m_screenInfo.deviceScaleFactor = 1; | 1457 client.m_screenInfo.deviceScaleFactor = 1; |
1458 int viewportWidth = 640; | 1458 int viewportWidth = 640; |
1459 int viewportHeight = 480; | 1459 int viewportHeight = 480; |
1460 | 1460 |
1461 FrameTestHelpers::WebViewHelper webViewHelper(this); | 1461 FrameTestHelpers::WebViewHelper webViewHelper(this); |
1462 | 1462 |
1463 webViewHelper.initializeAndLoad(m_baseURL + "0-by-0.html", true, 0, &client,
configureAndroid); | 1463 webViewHelper.initializeAndLoad(m_baseURL + "0-by-0.html", true, nullptr, &c
lient, nullptr, configureAndroid); |
1464 webViewHelper.webView()->settings()->setForceZeroLayoutHeight(true); | 1464 webViewHelper.webView()->settings()->setForceZeroLayoutHeight(true); |
1465 PaintLayerCompositor* compositor = webViewHelper.webViewImpl()->compositor()
; | 1465 PaintLayerCompositor* compositor = webViewHelper.webViewImpl()->compositor()
; |
1466 EXPECT_EQ(0, webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->layo
utSize().width()); | 1466 EXPECT_EQ(0, webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->layo
utSize().width()); |
1467 EXPECT_EQ(0, webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->layo
utSize().height()); | 1467 EXPECT_EQ(0, webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->layo
utSize().height()); |
1468 EXPECT_EQ(0.0, compositor->containerLayer()->size().width()); | 1468 EXPECT_EQ(0.0, compositor->containerLayer()->size().width()); |
1469 EXPECT_EQ(0.0, compositor->containerLayer()->size().height()); | 1469 EXPECT_EQ(0.0, compositor->containerLayer()->size().height()); |
1470 | 1470 |
1471 webViewHelper.resize(WebSize(viewportWidth, 0)); | 1471 webViewHelper.resize(WebSize(viewportWidth, 0)); |
1472 EXPECT_EQ(viewportWidth, webViewHelper.webViewImpl()->mainFrameImpl()->frame
View()->layoutSize().width()); | 1472 EXPECT_EQ(viewportWidth, webViewHelper.webViewImpl()->mainFrameImpl()->frame
View()->layoutSize().width()); |
1473 EXPECT_EQ(0, webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->layo
utSize().height()); | 1473 EXPECT_EQ(0, webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->layo
utSize().height()); |
(...skipping 21 matching lines...) Expand all Loading... |
1495 { | 1495 { |
1496 registerMockedHttpURLLoad("200-by-300.html"); | 1496 registerMockedHttpURLLoad("200-by-300.html"); |
1497 | 1497 |
1498 FixedLayoutTestWebViewClient client; | 1498 FixedLayoutTestWebViewClient client; |
1499 client.m_screenInfo.deviceScaleFactor = 1; | 1499 client.m_screenInfo.deviceScaleFactor = 1; |
1500 int viewportWidth = 640; | 1500 int viewportWidth = 640; |
1501 int viewportHeight = 480; | 1501 int viewportHeight = 480; |
1502 | 1502 |
1503 FrameTestHelpers::WebViewHelper webViewHelper(this); | 1503 FrameTestHelpers::WebViewHelper webViewHelper(this); |
1504 | 1504 |
1505 webViewHelper.initializeAndLoad(m_baseURL + "200-by-300.html", true, 0, &cli
ent, enableViewportSettings); | 1505 webViewHelper.initializeAndLoad(m_baseURL + "200-by-300.html", true, nullptr
, &client, nullptr, enableViewportSettings); |
1506 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); | 1506 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); |
1507 | 1507 |
1508 EXPECT_LE(viewportHeight, webViewHelper.webViewImpl()->mainFrameImpl()->fram
eView()->layoutSize().height()); | 1508 EXPECT_LE(viewportHeight, webViewHelper.webViewImpl()->mainFrameImpl()->fram
eView()->layoutSize().height()); |
1509 webViewHelper.webView()->settings()->setForceZeroLayoutHeight(true); | 1509 webViewHelper.webView()->settings()->setForceZeroLayoutHeight(true); |
1510 EXPECT_TRUE(webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->needs
Layout()); | 1510 EXPECT_TRUE(webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->needs
Layout()); |
1511 | 1511 |
1512 EXPECT_EQ(0, webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->layo
utSize().height()); | 1512 EXPECT_EQ(0, webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->layo
utSize().height()); |
1513 | 1513 |
1514 webViewHelper.resize(WebSize(viewportWidth, viewportHeight * 2)); | 1514 webViewHelper.resize(WebSize(viewportWidth, viewportHeight * 2)); |
1515 EXPECT_FALSE(webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->need
sLayout()); | 1515 EXPECT_FALSE(webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->need
sLayout()); |
(...skipping 16 matching lines...) Expand all Loading... |
1532 // because the layout is only updated if either width or height is changed | 1532 // because the layout is only updated if either width or height is changed |
1533 registerMockedHttpURLLoad("button.html"); | 1533 registerMockedHttpURLLoad("button.html"); |
1534 | 1534 |
1535 FixedLayoutTestWebViewClient client; | 1535 FixedLayoutTestWebViewClient client; |
1536 client.m_screenInfo.deviceScaleFactor = 1; | 1536 client.m_screenInfo.deviceScaleFactor = 1; |
1537 int viewportWidth = 640; | 1537 int viewportWidth = 640; |
1538 int viewportHeight = 480; | 1538 int viewportHeight = 480; |
1539 | 1539 |
1540 FrameTestHelpers::WebViewHelper webViewHelper; | 1540 FrameTestHelpers::WebViewHelper webViewHelper; |
1541 | 1541 |
1542 webViewHelper.initializeAndLoad(m_baseURL + "button.html", true, 0, &client,
configureAndroid); | 1542 webViewHelper.initializeAndLoad(m_baseURL + "button.html", true, nullptr, &c
lient, nullptr, configureAndroid); |
1543 // set view height to zero so that if the height of the view is not | 1543 // set view height to zero so that if the height of the view is not |
1544 // successfully updated during later resizes touch events will fail | 1544 // successfully updated during later resizes touch events will fail |
1545 // (as in not hit content included in the view) | 1545 // (as in not hit content included in the view) |
1546 webViewHelper.resize(WebSize(viewportWidth, 0)); | 1546 webViewHelper.resize(WebSize(viewportWidth, 0)); |
1547 | 1547 |
1548 webViewHelper.webView()->settings()->setForceZeroLayoutHeight(true); | 1548 webViewHelper.webView()->settings()->setForceZeroLayoutHeight(true); |
1549 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); | 1549 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); |
1550 | 1550 |
1551 IntPoint hitPoint = IntPoint(30, 30); // button size is 100x100 | 1551 IntPoint hitPoint = IntPoint(30, 30); // button size is 100x100 |
1552 | 1552 |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1630 registerMockedHttpURLLoad("200-by-300.html"); | 1630 registerMockedHttpURLLoad("200-by-300.html"); |
1631 registerMockedHttpURLLoad("large-div.html"); | 1631 registerMockedHttpURLLoad("large-div.html"); |
1632 | 1632 |
1633 FixedLayoutTestWebViewClient client; | 1633 FixedLayoutTestWebViewClient client; |
1634 client.m_screenInfo.deviceScaleFactor = 1; | 1634 client.m_screenInfo.deviceScaleFactor = 1; |
1635 int viewportWidth = 640; | 1635 int viewportWidth = 640; |
1636 int viewportHeight = 480; | 1636 int viewportHeight = 480; |
1637 | 1637 |
1638 FrameTestHelpers::WebViewHelper webViewHelper(this); | 1638 FrameTestHelpers::WebViewHelper webViewHelper(this); |
1639 | 1639 |
1640 webViewHelper.initializeAndLoad(m_baseURL + "200-by-300.html", true, 0, &cli
ent, enableViewportSettings); | 1640 webViewHelper.initializeAndLoad(m_baseURL + "200-by-300.html", true, nullptr
, &client, nullptr, enableViewportSettings); |
1641 webViewHelper.webView()->settings()->setForceZeroLayoutHeight(true); | 1641 webViewHelper.webView()->settings()->setForceZeroLayoutHeight(true); |
1642 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); | 1642 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); |
1643 | 1643 |
1644 FrameTestHelpers::loadFrame(webViewHelper.webView()->mainFrame(), m_baseURL
+ "large-div.html"); | 1644 FrameTestHelpers::loadFrame(webViewHelper.webView()->mainFrame(), m_baseURL
+ "large-div.html"); |
1645 webViewHelper.webView()->updateAllLifecyclePhases(); | 1645 webViewHelper.webView()->updateAllLifecyclePhases(); |
1646 | 1646 |
1647 EXPECT_EQ(0, webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->layo
utSize().height()); | 1647 EXPECT_EQ(0, webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->layo
utSize().height()); |
1648 } | 1648 } |
1649 | 1649 |
1650 TEST_P(ParameterizedWebFrameTest, SetForceZeroLayoutHeightWithWideViewportQuirk) | 1650 TEST_P(ParameterizedWebFrameTest, SetForceZeroLayoutHeightWithWideViewportQuirk) |
1651 { | 1651 { |
1652 registerMockedHttpURLLoad("200-by-300.html"); | 1652 registerMockedHttpURLLoad("200-by-300.html"); |
1653 | 1653 |
1654 FixedLayoutTestWebViewClient client; | 1654 FixedLayoutTestWebViewClient client; |
1655 client.m_screenInfo.deviceScaleFactor = 1; | 1655 client.m_screenInfo.deviceScaleFactor = 1; |
1656 int viewportWidth = 640; | 1656 int viewportWidth = 640; |
1657 int viewportHeight = 480; | 1657 int viewportHeight = 480; |
1658 | 1658 |
1659 FrameTestHelpers::WebViewHelper webViewHelper(this); | 1659 FrameTestHelpers::WebViewHelper webViewHelper(this); |
1660 | 1660 |
1661 webViewHelper.initializeAndLoad(m_baseURL + "200-by-300.html", true, 0, &cli
ent, enableViewportSettings); | 1661 webViewHelper.initializeAndLoad(m_baseURL + "200-by-300.html", true, nullptr
, &client, nullptr, enableViewportSettings); |
1662 webViewHelper.webView()->settings()->setWideViewportQuirkEnabled(true); | 1662 webViewHelper.webView()->settings()->setWideViewportQuirkEnabled(true); |
1663 webViewHelper.webView()->settings()->setUseWideViewport(true); | 1663 webViewHelper.webView()->settings()->setUseWideViewport(true); |
1664 webViewHelper.webView()->settings()->setForceZeroLayoutHeight(true); | 1664 webViewHelper.webView()->settings()->setForceZeroLayoutHeight(true); |
1665 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); | 1665 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); |
1666 | 1666 |
1667 EXPECT_EQ(0, webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->layo
utSize().height()); | 1667 EXPECT_EQ(0, webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->layo
utSize().height()); |
1668 } | 1668 } |
1669 | 1669 |
1670 TEST_P(ParameterizedWebFrameTest, WideViewportAndWideContentWithInitialScale) | 1670 TEST_P(ParameterizedWebFrameTest, WideViewportAndWideContentWithInitialScale) |
1671 { | 1671 { |
1672 registerMockedHttpURLLoad("wide_document_width_viewport.html"); | 1672 registerMockedHttpURLLoad("wide_document_width_viewport.html"); |
1673 registerMockedHttpURLLoad("white-1x1.png"); | 1673 registerMockedHttpURLLoad("white-1x1.png"); |
1674 | 1674 |
1675 FixedLayoutTestWebViewClient client; | 1675 FixedLayoutTestWebViewClient client; |
1676 client.m_screenInfo.deviceScaleFactor = 1; | 1676 client.m_screenInfo.deviceScaleFactor = 1; |
1677 int viewportWidth = 600; | 1677 int viewportWidth = 600; |
1678 int viewportHeight = 800; | 1678 int viewportHeight = 800; |
1679 | 1679 |
1680 FrameTestHelpers::WebViewHelper webViewHelper(this); | 1680 FrameTestHelpers::WebViewHelper webViewHelper(this); |
1681 webViewHelper.initializeAndLoad("about:blank", true, 0, &client, enableViewp
ortSettings); | 1681 webViewHelper.initializeAndLoad("about:blank", true, nullptr, &client, nullp
tr, enableViewportSettings); |
1682 webViewHelper.webView()->settings()->setWideViewportQuirkEnabled(true); | 1682 webViewHelper.webView()->settings()->setWideViewportQuirkEnabled(true); |
1683 webViewHelper.webView()->settings()->setUseWideViewport(true); | 1683 webViewHelper.webView()->settings()->setUseWideViewport(true); |
1684 webViewHelper.webView()->settings()->setViewportMetaLayoutSizeQuirk(true); | 1684 webViewHelper.webView()->settings()->setViewportMetaLayoutSizeQuirk(true); |
1685 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); | 1685 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); |
1686 | 1686 |
1687 FrameTestHelpers::loadFrame(webViewHelper.webView()->mainFrame(), m_baseURL
+ "wide_document_width_viewport.html"); | 1687 FrameTestHelpers::loadFrame(webViewHelper.webView()->mainFrame(), m_baseURL
+ "wide_document_width_viewport.html"); |
1688 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); | 1688 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); |
1689 | 1689 |
1690 int wideDocumentWidth = 800; | 1690 int wideDocumentWidth = 800; |
1691 float minimumPageScaleFactor = viewportWidth / (float) wideDocumentWidth; | 1691 float minimumPageScaleFactor = viewportWidth / (float) wideDocumentWidth; |
1692 EXPECT_EQ(minimumPageScaleFactor, webViewHelper.webViewImpl()->pageScaleFact
or()); | 1692 EXPECT_EQ(minimumPageScaleFactor, webViewHelper.webViewImpl()->pageScaleFact
or()); |
1693 EXPECT_EQ(minimumPageScaleFactor, webViewHelper.webViewImpl()->minimumPageSc
aleFactor()); | 1693 EXPECT_EQ(minimumPageScaleFactor, webViewHelper.webViewImpl()->minimumPageSc
aleFactor()); |
1694 } | 1694 } |
1695 | 1695 |
1696 TEST_P(ParameterizedWebFrameTest, WideViewportQuirkClobbersHeight) | 1696 TEST_P(ParameterizedWebFrameTest, WideViewportQuirkClobbersHeight) |
1697 { | 1697 { |
1698 registerMockedHttpURLLoad("viewport-height-1000.html"); | 1698 registerMockedHttpURLLoad("viewport-height-1000.html"); |
1699 | 1699 |
1700 FixedLayoutTestWebViewClient client; | 1700 FixedLayoutTestWebViewClient client; |
1701 client.m_screenInfo.deviceScaleFactor = 1; | 1701 client.m_screenInfo.deviceScaleFactor = 1; |
1702 int viewportWidth = 600; | 1702 int viewportWidth = 600; |
1703 int viewportHeight = 800; | 1703 int viewportHeight = 800; |
1704 | 1704 |
1705 FrameTestHelpers::WebViewHelper webViewHelper(this); | 1705 FrameTestHelpers::WebViewHelper webViewHelper(this); |
1706 webViewHelper.initializeAndLoad("about:blank", true, 0, &client, enableViewp
ortSettings); | 1706 webViewHelper.initializeAndLoad("about:blank", true, nullptr, &client, nullp
tr, enableViewportSettings); |
1707 webViewHelper.webView()->settings()->setWideViewportQuirkEnabled(true); | 1707 webViewHelper.webView()->settings()->setWideViewportQuirkEnabled(true); |
1708 webViewHelper.webView()->settings()->setUseWideViewport(false); | 1708 webViewHelper.webView()->settings()->setUseWideViewport(false); |
1709 webViewHelper.webView()->settings()->setViewportMetaLayoutSizeQuirk(true); | 1709 webViewHelper.webView()->settings()->setViewportMetaLayoutSizeQuirk(true); |
1710 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); | 1710 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); |
1711 | 1711 |
1712 FrameTestHelpers::loadFrame(webViewHelper.webView()->mainFrame(), m_baseURL
+ "viewport-height-1000.html"); | 1712 FrameTestHelpers::loadFrame(webViewHelper.webView()->mainFrame(), m_baseURL
+ "viewport-height-1000.html"); |
1713 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); | 1713 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); |
1714 | 1714 |
1715 EXPECT_EQ(800, webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->la
youtSize().height()); | 1715 EXPECT_EQ(800, webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->la
youtSize().height()); |
1716 EXPECT_EQ(1, webViewHelper.webView()->pageScaleFactor()); | 1716 EXPECT_EQ(1, webViewHelper.webView()->pageScaleFactor()); |
1717 } | 1717 } |
1718 | 1718 |
1719 TEST_P(ParameterizedWebFrameTest, LayoutSize320Quirk) | 1719 TEST_P(ParameterizedWebFrameTest, LayoutSize320Quirk) |
1720 { | 1720 { |
1721 registerMockedHttpURLLoad("viewport/viewport-30.html"); | 1721 registerMockedHttpURLLoad("viewport/viewport-30.html"); |
1722 | 1722 |
1723 FixedLayoutTestWebViewClient client; | 1723 FixedLayoutTestWebViewClient client; |
1724 client.m_screenInfo.deviceScaleFactor = 1; | 1724 client.m_screenInfo.deviceScaleFactor = 1; |
1725 int viewportWidth = 600; | 1725 int viewportWidth = 600; |
1726 int viewportHeight = 800; | 1726 int viewportHeight = 800; |
1727 | 1727 |
1728 FrameTestHelpers::WebViewHelper webViewHelper(this); | 1728 FrameTestHelpers::WebViewHelper webViewHelper(this); |
1729 webViewHelper.initializeAndLoad("about:blank", true, 0, &client, enableViewp
ortSettings); | 1729 webViewHelper.initializeAndLoad("about:blank", true, nullptr, &client, nullp
tr, enableViewportSettings); |
1730 webViewHelper.webView()->settings()->setWideViewportQuirkEnabled(true); | 1730 webViewHelper.webView()->settings()->setWideViewportQuirkEnabled(true); |
1731 webViewHelper.webView()->settings()->setUseWideViewport(true); | 1731 webViewHelper.webView()->settings()->setUseWideViewport(true); |
1732 webViewHelper.webView()->settings()->setViewportMetaLayoutSizeQuirk(true); | 1732 webViewHelper.webView()->settings()->setViewportMetaLayoutSizeQuirk(true); |
1733 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); | 1733 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); |
1734 | 1734 |
1735 FrameTestHelpers::loadFrame(webViewHelper.webView()->mainFrame(), m_baseURL
+ "viewport/viewport-30.html"); | 1735 FrameTestHelpers::loadFrame(webViewHelper.webView()->mainFrame(), m_baseURL
+ "viewport/viewport-30.html"); |
1736 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); | 1736 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); |
1737 | 1737 |
1738 EXPECT_EQ(600, webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->la
youtSize().width()); | 1738 EXPECT_EQ(600, webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->la
youtSize().width()); |
1739 EXPECT_EQ(800, webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->la
youtSize().height()); | 1739 EXPECT_EQ(800, webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->la
youtSize().height()); |
(...skipping 30 matching lines...) Expand all Loading... |
1770 TEST_P(ParameterizedWebFrameTest, ZeroValuesQuirk) | 1770 TEST_P(ParameterizedWebFrameTest, ZeroValuesQuirk) |
1771 { | 1771 { |
1772 registerMockedHttpURLLoad("viewport-zero-values.html"); | 1772 registerMockedHttpURLLoad("viewport-zero-values.html"); |
1773 | 1773 |
1774 FixedLayoutTestWebViewClient client; | 1774 FixedLayoutTestWebViewClient client; |
1775 client.m_screenInfo.deviceScaleFactor = 1; | 1775 client.m_screenInfo.deviceScaleFactor = 1; |
1776 int viewportWidth = 640; | 1776 int viewportWidth = 640; |
1777 int viewportHeight = 480; | 1777 int viewportHeight = 480; |
1778 | 1778 |
1779 FrameTestHelpers::WebViewHelper webViewHelper(this); | 1779 FrameTestHelpers::WebViewHelper webViewHelper(this); |
1780 webViewHelper.initialize(true, 0, &client, enableViewportSettings); | 1780 webViewHelper.initialize(true, nullptr, &client, nullptr, enableViewportSett
ings); |
1781 webViewHelper.webView()->settings()->setViewportMetaZeroValuesQuirk(true); | 1781 webViewHelper.webView()->settings()->setViewportMetaZeroValuesQuirk(true); |
1782 webViewHelper.webView()->settings()->setWideViewportQuirkEnabled(true); | 1782 webViewHelper.webView()->settings()->setWideViewportQuirkEnabled(true); |
1783 webViewHelper.webView()->settings()->setViewportMetaLayoutSizeQuirk(true); | 1783 webViewHelper.webView()->settings()->setViewportMetaLayoutSizeQuirk(true); |
1784 FrameTestHelpers::loadFrame(webViewHelper.webView()->mainFrame(), m_baseURL
+ "viewport-zero-values.html"); | 1784 FrameTestHelpers::loadFrame(webViewHelper.webView()->mainFrame(), m_baseURL
+ "viewport-zero-values.html"); |
1785 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); | 1785 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); |
1786 | 1786 |
1787 EXPECT_EQ(viewportWidth, webViewHelper.webViewImpl()->mainFrameImpl()->frame
View()->layoutSize().width()); | 1787 EXPECT_EQ(viewportWidth, webViewHelper.webViewImpl()->mainFrameImpl()->frame
View()->layoutSize().width()); |
1788 EXPECT_EQ(1.0f, webViewHelper.webView()->pageScaleFactor()); | 1788 EXPECT_EQ(1.0f, webViewHelper.webView()->pageScaleFactor()); |
1789 | 1789 |
1790 webViewHelper.webView()->settings()->setUseWideViewport(true); | 1790 webViewHelper.webView()->settings()->setUseWideViewport(true); |
1791 webViewHelper.webView()->updateAllLifecyclePhases(); | 1791 webViewHelper.webView()->updateAllLifecyclePhases(); |
1792 EXPECT_EQ(viewportWidth, webViewHelper.webViewImpl()->mainFrameImpl()->frame
View()->layoutSize().width()); | 1792 EXPECT_EQ(viewportWidth, webViewHelper.webViewImpl()->mainFrameImpl()->frame
View()->layoutSize().width()); |
1793 EXPECT_EQ(1.0f, webViewHelper.webView()->pageScaleFactor()); | 1793 EXPECT_EQ(1.0f, webViewHelper.webView()->pageScaleFactor()); |
1794 } | 1794 } |
1795 | 1795 |
1796 TEST_P(ParameterizedWebFrameTest, OverflowHiddenDisablesScrolling) | 1796 TEST_P(ParameterizedWebFrameTest, OverflowHiddenDisablesScrolling) |
1797 { | 1797 { |
1798 registerMockedHttpURLLoad("body-overflow-hidden.html"); | 1798 registerMockedHttpURLLoad("body-overflow-hidden.html"); |
1799 | 1799 |
1800 FixedLayoutTestWebViewClient client; | 1800 FixedLayoutTestWebViewClient client; |
1801 client.m_screenInfo.deviceScaleFactor = 1; | 1801 client.m_screenInfo.deviceScaleFactor = 1; |
1802 int viewportWidth = 640; | 1802 int viewportWidth = 640; |
1803 int viewportHeight = 480; | 1803 int viewportHeight = 480; |
1804 | 1804 |
1805 FrameTestHelpers::WebViewHelper webViewHelper(this); | 1805 FrameTestHelpers::WebViewHelper webViewHelper(this); |
1806 webViewHelper.initialize(true, 0, &client); | 1806 webViewHelper.initialize(true, nullptr, &client, nullptr); |
1807 FrameTestHelpers::loadFrame(webViewHelper.webView()->mainFrame(), m_baseURL
+ "body-overflow-hidden.html"); | 1807 FrameTestHelpers::loadFrame(webViewHelper.webView()->mainFrame(), m_baseURL
+ "body-overflow-hidden.html"); |
1808 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); | 1808 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); |
1809 | 1809 |
1810 FrameView* view = webViewHelper.webViewImpl()->mainFrameImpl()->frameView(); | 1810 FrameView* view = webViewHelper.webViewImpl()->mainFrameImpl()->frameView(); |
1811 EXPECT_FALSE(view->userInputScrollable(VerticalScrollbar)); | 1811 EXPECT_FALSE(view->userInputScrollable(VerticalScrollbar)); |
1812 EXPECT_FALSE(view->userInputScrollable(HorizontalScrollbar)); | 1812 EXPECT_FALSE(view->userInputScrollable(HorizontalScrollbar)); |
1813 } | 1813 } |
1814 | 1814 |
1815 TEST_P(ParameterizedWebFrameTest, OverflowHiddenDisablesScrollingWithSetCanHaveS
crollbars) | 1815 TEST_P(ParameterizedWebFrameTest, OverflowHiddenDisablesScrollingWithSetCanHaveS
crollbars) |
1816 { | 1816 { |
1817 registerMockedHttpURLLoad("body-overflow-hidden-short.html"); | 1817 registerMockedHttpURLLoad("body-overflow-hidden-short.html"); |
1818 | 1818 |
1819 FixedLayoutTestWebViewClient client; | 1819 FixedLayoutTestWebViewClient client; |
1820 client.m_screenInfo.deviceScaleFactor = 1; | 1820 client.m_screenInfo.deviceScaleFactor = 1; |
1821 int viewportWidth = 640; | 1821 int viewportWidth = 640; |
1822 int viewportHeight = 480; | 1822 int viewportHeight = 480; |
1823 | 1823 |
1824 FrameTestHelpers::WebViewHelper webViewHelper(this); | 1824 FrameTestHelpers::WebViewHelper webViewHelper(this); |
1825 webViewHelper.initialize(true, 0, &client); | 1825 webViewHelper.initialize(true, nullptr, &client, nullptr); |
1826 FrameTestHelpers::loadFrame(webViewHelper.webView()->mainFrame(), m_baseURL
+ "body-overflow-hidden-short.html"); | 1826 FrameTestHelpers::loadFrame(webViewHelper.webView()->mainFrame(), m_baseURL
+ "body-overflow-hidden-short.html"); |
1827 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); | 1827 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); |
1828 | 1828 |
1829 FrameView* view = webViewHelper.webViewImpl()->mainFrameImpl()->frameView(); | 1829 FrameView* view = webViewHelper.webViewImpl()->mainFrameImpl()->frameView(); |
1830 EXPECT_FALSE(view->userInputScrollable(VerticalScrollbar)); | 1830 EXPECT_FALSE(view->userInputScrollable(VerticalScrollbar)); |
1831 EXPECT_FALSE(view->userInputScrollable(HorizontalScrollbar)); | 1831 EXPECT_FALSE(view->userInputScrollable(HorizontalScrollbar)); |
1832 | 1832 |
1833 webViewHelper.webViewImpl()->mainFrameImpl()->setCanHaveScrollbars(true); | 1833 webViewHelper.webViewImpl()->mainFrameImpl()->setCanHaveScrollbars(true); |
1834 EXPECT_FALSE(view->userInputScrollable(VerticalScrollbar)); | 1834 EXPECT_FALSE(view->userInputScrollable(VerticalScrollbar)); |
1835 EXPECT_FALSE(view->userInputScrollable(HorizontalScrollbar)); | 1835 EXPECT_FALSE(view->userInputScrollable(HorizontalScrollbar)); |
1836 } | 1836 } |
1837 | 1837 |
1838 TEST_F(WebFrameTest, IgnoreOverflowHiddenQuirk) | 1838 TEST_F(WebFrameTest, IgnoreOverflowHiddenQuirk) |
1839 { | 1839 { |
1840 registerMockedHttpURLLoad("body-overflow-hidden.html"); | 1840 registerMockedHttpURLLoad("body-overflow-hidden.html"); |
1841 | 1841 |
1842 FixedLayoutTestWebViewClient client; | 1842 FixedLayoutTestWebViewClient client; |
1843 client.m_screenInfo.deviceScaleFactor = 1; | 1843 client.m_screenInfo.deviceScaleFactor = 1; |
1844 int viewportWidth = 640; | 1844 int viewportWidth = 640; |
1845 int viewportHeight = 480; | 1845 int viewportHeight = 480; |
1846 | 1846 |
1847 FrameTestHelpers::WebViewHelper webViewHelper; | 1847 FrameTestHelpers::WebViewHelper webViewHelper; |
1848 webViewHelper.initialize(true, 0, &client); | 1848 webViewHelper.initialize(true, nullptr, &client, nullptr); |
1849 webViewHelper.webView()->settings()->setIgnoreMainFrameOverflowHiddenQuirk(t
rue); | 1849 webViewHelper.webView()->settings()->setIgnoreMainFrameOverflowHiddenQuirk(t
rue); |
1850 FrameTestHelpers::loadFrame(webViewHelper.webView()->mainFrame(), m_baseURL
+ "body-overflow-hidden.html"); | 1850 FrameTestHelpers::loadFrame(webViewHelper.webView()->mainFrame(), m_baseURL
+ "body-overflow-hidden.html"); |
1851 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); | 1851 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); |
1852 | 1852 |
1853 FrameView* view = webViewHelper.webViewImpl()->mainFrameImpl()->frameView(); | 1853 FrameView* view = webViewHelper.webViewImpl()->mainFrameImpl()->frameView(); |
1854 EXPECT_TRUE(view->userInputScrollable(VerticalScrollbar)); | 1854 EXPECT_TRUE(view->userInputScrollable(VerticalScrollbar)); |
1855 } | 1855 } |
1856 | 1856 |
1857 TEST_P(ParameterizedWebFrameTest, NonZeroValuesNoQuirk) | 1857 TEST_P(ParameterizedWebFrameTest, NonZeroValuesNoQuirk) |
1858 { | 1858 { |
1859 registerMockedHttpURLLoad("viewport-nonzero-values.html"); | 1859 registerMockedHttpURLLoad("viewport-nonzero-values.html"); |
1860 | 1860 |
1861 FixedLayoutTestWebViewClient client; | 1861 FixedLayoutTestWebViewClient client; |
1862 client.m_screenInfo.deviceScaleFactor = 1; | 1862 client.m_screenInfo.deviceScaleFactor = 1; |
1863 int viewportWidth = 640; | 1863 int viewportWidth = 640; |
1864 int viewportHeight = 480; | 1864 int viewportHeight = 480; |
1865 float expectedPageScaleFactor = 0.5f; | 1865 float expectedPageScaleFactor = 0.5f; |
1866 | 1866 |
1867 FrameTestHelpers::WebViewHelper webViewHelper(this); | 1867 FrameTestHelpers::WebViewHelper webViewHelper(this); |
1868 webViewHelper.initialize(true, 0, &client, enableViewportSettings); | 1868 webViewHelper.initialize(true, nullptr, &client, nullptr, enableViewportSett
ings); |
1869 webViewHelper.webView()->settings()->setViewportMetaZeroValuesQuirk(true); | 1869 webViewHelper.webView()->settings()->setViewportMetaZeroValuesQuirk(true); |
1870 webViewHelper.webView()->settings()->setWideViewportQuirkEnabled(true); | 1870 webViewHelper.webView()->settings()->setWideViewportQuirkEnabled(true); |
1871 FrameTestHelpers::loadFrame(webViewHelper.webView()->mainFrame(), m_baseURL
+ "viewport-nonzero-values.html"); | 1871 FrameTestHelpers::loadFrame(webViewHelper.webView()->mainFrame(), m_baseURL
+ "viewport-nonzero-values.html"); |
1872 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); | 1872 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); |
1873 | 1873 |
1874 EXPECT_EQ(viewportWidth / expectedPageScaleFactor, webViewHelper.webViewImpl
()->mainFrameImpl()->frameView()->layoutSize().width()); | 1874 EXPECT_EQ(viewportWidth / expectedPageScaleFactor, webViewHelper.webViewImpl
()->mainFrameImpl()->frameView()->layoutSize().width()); |
1875 EXPECT_EQ(expectedPageScaleFactor, webViewHelper.webView()->pageScaleFactor(
)); | 1875 EXPECT_EQ(expectedPageScaleFactor, webViewHelper.webView()->pageScaleFactor(
)); |
1876 | 1876 |
1877 webViewHelper.webView()->settings()->setUseWideViewport(true); | 1877 webViewHelper.webView()->settings()->setUseWideViewport(true); |
1878 webViewHelper.webView()->updateAllLifecyclePhases(); | 1878 webViewHelper.webView()->updateAllLifecyclePhases(); |
1879 EXPECT_EQ(viewportWidth / expectedPageScaleFactor, webViewHelper.webViewImpl
()->mainFrameImpl()->frameView()->layoutSize().width()); | 1879 EXPECT_EQ(viewportWidth / expectedPageScaleFactor, webViewHelper.webViewImpl
()->mainFrameImpl()->frameView()->layoutSize().width()); |
1880 EXPECT_EQ(expectedPageScaleFactor, webViewHelper.webView()->pageScaleFactor(
)); | 1880 EXPECT_EQ(expectedPageScaleFactor, webViewHelper.webView()->pageScaleFactor(
)); |
1881 } | 1881 } |
1882 | 1882 |
1883 TEST_P(ParameterizedWebFrameTest, setPageScaleFactorDoesNotLayout) | 1883 TEST_P(ParameterizedWebFrameTest, setPageScaleFactorDoesNotLayout) |
1884 { | 1884 { |
1885 registerMockedHttpURLLoad("fixed_layout.html"); | 1885 registerMockedHttpURLLoad("fixed_layout.html"); |
1886 | 1886 |
1887 FixedLayoutTestWebViewClient client; | 1887 FixedLayoutTestWebViewClient client; |
1888 client.m_screenInfo.deviceScaleFactor = 1; | 1888 client.m_screenInfo.deviceScaleFactor = 1; |
1889 // Small viewport to ensure there are always scrollbars. | 1889 // Small viewport to ensure there are always scrollbars. |
1890 int viewportWidth = 64; | 1890 int viewportWidth = 64; |
1891 int viewportHeight = 48; | 1891 int viewportHeight = 48; |
1892 | 1892 |
1893 FrameTestHelpers::WebViewHelper webViewHelper(this); | 1893 FrameTestHelpers::WebViewHelper webViewHelper(this); |
1894 webViewHelper.initializeAndLoad(m_baseURL + "fixed_layout.html", true, 0, &c
lient, enableViewportSettings); | 1894 webViewHelper.initializeAndLoad(m_baseURL + "fixed_layout.html", true, nullp
tr, &client, nullptr, enableViewportSettings); |
1895 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); | 1895 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); |
1896 | 1896 |
1897 int prevLayoutCount = webViewHelper.webViewImpl()->mainFrameImpl()->frameVie
w()->layoutCount(); | 1897 int prevLayoutCount = webViewHelper.webViewImpl()->mainFrameImpl()->frameVie
w()->layoutCount(); |
1898 webViewHelper.webViewImpl()->setPageScaleFactor(3); | 1898 webViewHelper.webViewImpl()->setPageScaleFactor(3); |
1899 EXPECT_FALSE(webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->need
sLayout()); | 1899 EXPECT_FALSE(webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->need
sLayout()); |
1900 EXPECT_EQ(prevLayoutCount, webViewHelper.webViewImpl()->mainFrameImpl()->fra
meView()->layoutCount()); | 1900 EXPECT_EQ(prevLayoutCount, webViewHelper.webViewImpl()->mainFrameImpl()->fra
meView()->layoutCount()); |
1901 } | 1901 } |
1902 | 1902 |
1903 TEST_P(ParameterizedWebFrameTest, setPageScaleFactorWithOverlayScrollbarsDoesNot
Layout) | 1903 TEST_P(ParameterizedWebFrameTest, setPageScaleFactorWithOverlayScrollbarsDoesNot
Layout) |
1904 { | 1904 { |
1905 registerMockedHttpURLLoad("fixed_layout.html"); | 1905 registerMockedHttpURLLoad("fixed_layout.html"); |
1906 | 1906 |
1907 FixedLayoutTestWebViewClient client; | 1907 FixedLayoutTestWebViewClient client; |
1908 client.m_screenInfo.deviceScaleFactor = 1; | 1908 client.m_screenInfo.deviceScaleFactor = 1; |
1909 int viewportWidth = 640; | 1909 int viewportWidth = 640; |
1910 int viewportHeight = 480; | 1910 int viewportHeight = 480; |
1911 | 1911 |
1912 FrameTestHelpers::WebViewHelper webViewHelper(this); | 1912 FrameTestHelpers::WebViewHelper webViewHelper(this); |
1913 webViewHelper.initializeAndLoad(m_baseURL + "fixed_layout.html", true, 0, &c
lient, enableViewportSettings); | 1913 webViewHelper.initializeAndLoad(m_baseURL + "fixed_layout.html", true, nullp
tr, &client, nullptr, enableViewportSettings); |
1914 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); | 1914 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); |
1915 | 1915 |
1916 int prevLayoutCount = webViewHelper.webViewImpl()->mainFrameImpl()->frameVie
w()->layoutCount(); | 1916 int prevLayoutCount = webViewHelper.webViewImpl()->mainFrameImpl()->frameVie
w()->layoutCount(); |
1917 webViewHelper.webViewImpl()->setPageScaleFactor(30); | 1917 webViewHelper.webViewImpl()->setPageScaleFactor(30); |
1918 EXPECT_FALSE(webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->need
sLayout()); | 1918 EXPECT_FALSE(webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->need
sLayout()); |
1919 EXPECT_EQ(prevLayoutCount, webViewHelper.webViewImpl()->mainFrameImpl()->fra
meView()->layoutCount()); | 1919 EXPECT_EQ(prevLayoutCount, webViewHelper.webViewImpl()->mainFrameImpl()->fra
meView()->layoutCount()); |
1920 | 1920 |
1921 } | 1921 } |
1922 | 1922 |
1923 TEST_P(ParameterizedWebFrameTest, pageScaleFactorWrittenToHistoryItem) | 1923 TEST_P(ParameterizedWebFrameTest, pageScaleFactorWrittenToHistoryItem) |
1924 { | 1924 { |
1925 registerMockedHttpURLLoad("fixed_layout.html"); | 1925 registerMockedHttpURLLoad("fixed_layout.html"); |
1926 | 1926 |
1927 FixedLayoutTestWebViewClient client; | 1927 FixedLayoutTestWebViewClient client; |
1928 client.m_screenInfo.deviceScaleFactor = 1; | 1928 client.m_screenInfo.deviceScaleFactor = 1; |
1929 int viewportWidth = 640; | 1929 int viewportWidth = 640; |
1930 int viewportHeight = 480; | 1930 int viewportHeight = 480; |
1931 | 1931 |
1932 FrameTestHelpers::WebViewHelper webViewHelper(this); | 1932 FrameTestHelpers::WebViewHelper webViewHelper(this); |
1933 webViewHelper.initializeAndLoad(m_baseURL + "fixed_layout.html", true, 0, &c
lient, enableViewportSettings); | 1933 webViewHelper.initializeAndLoad(m_baseURL + "fixed_layout.html", true, nullp
tr, &client, nullptr, enableViewportSettings); |
1934 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); | 1934 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); |
1935 | 1935 |
1936 webViewHelper.webView()->setPageScaleFactor(3); | 1936 webViewHelper.webView()->setPageScaleFactor(3); |
1937 EXPECT_EQ(3, toLocalFrame(webViewHelper.webViewImpl()->page()->mainFrame())-
>loader().currentItem()->pageScaleFactor()); | 1937 EXPECT_EQ(3, toLocalFrame(webViewHelper.webViewImpl()->page()->mainFrame())-
>loader().currentItem()->pageScaleFactor()); |
1938 } | 1938 } |
1939 | 1939 |
1940 TEST_P(ParameterizedWebFrameTest, initialScaleWrittenToHistoryItem) | 1940 TEST_P(ParameterizedWebFrameTest, initialScaleWrittenToHistoryItem) |
1941 { | 1941 { |
1942 registerMockedHttpURLLoad("fixed_layout.html"); | 1942 registerMockedHttpURLLoad("fixed_layout.html"); |
1943 | 1943 |
1944 FixedLayoutTestWebViewClient client; | 1944 FixedLayoutTestWebViewClient client; |
1945 client.m_screenInfo.deviceScaleFactor = 1; | 1945 client.m_screenInfo.deviceScaleFactor = 1; |
1946 int viewportWidth = 640; | 1946 int viewportWidth = 640; |
1947 int viewportHeight = 480; | 1947 int viewportHeight = 480; |
1948 | 1948 |
1949 FrameTestHelpers::WebViewHelper webViewHelper(this); | 1949 FrameTestHelpers::WebViewHelper webViewHelper(this); |
1950 webViewHelper.initialize(true, 0, &client, enableViewportSettings); | 1950 webViewHelper.initialize(true, nullptr, &client, nullptr, enableViewportSett
ings); |
1951 webViewHelper.webView()->setDefaultPageScaleLimits(0.25f, 5); | 1951 webViewHelper.webView()->setDefaultPageScaleLimits(0.25f, 5); |
1952 FrameTestHelpers::loadFrame(webViewHelper.webView()->mainFrame(), m_baseURL
+ "fixed_layout.html"); | 1952 FrameTestHelpers::loadFrame(webViewHelper.webView()->mainFrame(), m_baseURL
+ "fixed_layout.html"); |
1953 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); | 1953 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); |
1954 | 1954 |
1955 int defaultFixedLayoutWidth = 980; | 1955 int defaultFixedLayoutWidth = 980; |
1956 float minimumPageScaleFactor = viewportWidth / (float) defaultFixedLayoutWid
th; | 1956 float minimumPageScaleFactor = viewportWidth / (float) defaultFixedLayoutWid
th; |
1957 EXPECT_EQ(minimumPageScaleFactor, toLocalFrame(webViewHelper.webViewImpl()->
page()->mainFrame())->loader().currentItem()->pageScaleFactor()); | 1957 EXPECT_EQ(minimumPageScaleFactor, toLocalFrame(webViewHelper.webViewImpl()->
page()->mainFrame())->loader().currentItem()->pageScaleFactor()); |
1958 } | 1958 } |
1959 | 1959 |
1960 TEST_P(ParameterizedWebFrameTest, pageScaleFactorDoesntShrinkFrameView) | 1960 TEST_P(ParameterizedWebFrameTest, pageScaleFactorDoesntShrinkFrameView) |
1961 { | 1961 { |
1962 registerMockedHttpURLLoad("large-div.html"); | 1962 registerMockedHttpURLLoad("large-div.html"); |
1963 | 1963 |
1964 FixedLayoutTestWebViewClient client; | 1964 FixedLayoutTestWebViewClient client; |
1965 client.m_screenInfo.deviceScaleFactor = 1; | 1965 client.m_screenInfo.deviceScaleFactor = 1; |
1966 // Small viewport to ensure there are always scrollbars. | 1966 // Small viewport to ensure there are always scrollbars. |
1967 int viewportWidth = 64; | 1967 int viewportWidth = 64; |
1968 int viewportHeight = 48; | 1968 int viewportHeight = 48; |
1969 | 1969 |
1970 FrameTestHelpers::WebViewHelper webViewHelper(this); | 1970 FrameTestHelpers::WebViewHelper webViewHelper(this); |
1971 webViewHelper.initializeAndLoad(m_baseURL + "large-div.html", true, 0, &clie
nt, enableViewportSettings); | 1971 webViewHelper.initializeAndLoad(m_baseURL + "large-div.html", true, nullptr,
&client, nullptr, enableViewportSettings); |
1972 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); | 1972 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); |
1973 | 1973 |
1974 FrameView* view = webViewHelper.webViewImpl()->mainFrameImpl()->frameView(); | 1974 FrameView* view = webViewHelper.webViewImpl()->mainFrameImpl()->frameView(); |
1975 int viewportWidthMinusScrollbar = viewportWidth; | 1975 int viewportWidthMinusScrollbar = viewportWidth; |
1976 int viewportHeightMinusScrollbar = viewportHeight; | 1976 int viewportHeightMinusScrollbar = viewportHeight; |
1977 | 1977 |
1978 if (view->verticalScrollbar() && !view->verticalScrollbar()->isOverlayScroll
bar()) | 1978 if (view->verticalScrollbar() && !view->verticalScrollbar()->isOverlayScroll
bar()) |
1979 viewportWidthMinusScrollbar -= 15; | 1979 viewportWidthMinusScrollbar -= 15; |
1980 | 1980 |
1981 if (view->horizontalScrollbar() && !view->horizontalScrollbar()->isOverlaySc
rollbar()) | 1981 if (view->horizontalScrollbar() && !view->horizontalScrollbar()->isOverlaySc
rollbar()) |
(...skipping 17 matching lines...) Expand all Loading... |
1999 TEST_P(ParameterizedWebFrameTest, pageScaleFactorDoesNotApplyCssTransform) | 1999 TEST_P(ParameterizedWebFrameTest, pageScaleFactorDoesNotApplyCssTransform) |
2000 { | 2000 { |
2001 registerMockedHttpURLLoad("fixed_layout.html"); | 2001 registerMockedHttpURLLoad("fixed_layout.html"); |
2002 | 2002 |
2003 FixedLayoutTestWebViewClient client; | 2003 FixedLayoutTestWebViewClient client; |
2004 client.m_screenInfo.deviceScaleFactor = 1; | 2004 client.m_screenInfo.deviceScaleFactor = 1; |
2005 int viewportWidth = 640; | 2005 int viewportWidth = 640; |
2006 int viewportHeight = 480; | 2006 int viewportHeight = 480; |
2007 | 2007 |
2008 FrameTestHelpers::WebViewHelper webViewHelper(this); | 2008 FrameTestHelpers::WebViewHelper webViewHelper(this); |
2009 webViewHelper.initializeAndLoad(m_baseURL + "fixed_layout.html", true, 0, &c
lient, enableViewportSettings); | 2009 webViewHelper.initializeAndLoad(m_baseURL + "fixed_layout.html", true, nullp
tr, &client, nullptr, enableViewportSettings); |
2010 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); | 2010 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); |
2011 | 2011 |
2012 webViewHelper.webView()->setPageScaleFactor(2); | 2012 webViewHelper.webView()->setPageScaleFactor(2); |
2013 | 2013 |
2014 EXPECT_EQ(980, toLocalFrame(webViewHelper.webViewImpl()->page()->mainFrame()
)->contentLayoutItem().documentRect().width()); | 2014 EXPECT_EQ(980, toLocalFrame(webViewHelper.webViewImpl()->page()->mainFrame()
)->contentLayoutItem().documentRect().width()); |
2015 EXPECT_EQ(980, webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->co
ntentsSize().width()); | 2015 EXPECT_EQ(980, webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->co
ntentsSize().width()); |
2016 } | 2016 } |
2017 | 2017 |
2018 TEST_P(ParameterizedWebFrameTest, targetDensityDpiHigh) | 2018 TEST_P(ParameterizedWebFrameTest, targetDensityDpiHigh) |
2019 { | 2019 { |
2020 registerMockedHttpURLLoad("viewport-target-densitydpi-high.html"); | 2020 registerMockedHttpURLLoad("viewport-target-densitydpi-high.html"); |
2021 | 2021 |
2022 FixedLayoutTestWebViewClient client; | 2022 FixedLayoutTestWebViewClient client; |
2023 // high-dpi = 240 | 2023 // high-dpi = 240 |
2024 float targetDpi = 240.0f; | 2024 float targetDpi = 240.0f; |
2025 float deviceScaleFactors[] = { 1.0f, 4.0f / 3.0f, 2.0f }; | 2025 float deviceScaleFactors[] = { 1.0f, 4.0f / 3.0f, 2.0f }; |
2026 int viewportWidth = 640; | 2026 int viewportWidth = 640; |
2027 int viewportHeight = 480; | 2027 int viewportHeight = 480; |
2028 | 2028 |
2029 for (size_t i = 0; i < WTF_ARRAY_LENGTH(deviceScaleFactors); ++i) { | 2029 for (size_t i = 0; i < WTF_ARRAY_LENGTH(deviceScaleFactors); ++i) { |
2030 float deviceScaleFactor = deviceScaleFactors[i]; | 2030 float deviceScaleFactor = deviceScaleFactors[i]; |
2031 float deviceDpi = deviceScaleFactor * 160.0f; | 2031 float deviceDpi = deviceScaleFactor * 160.0f; |
2032 client.m_screenInfo.deviceScaleFactor = deviceScaleFactor; | 2032 client.m_screenInfo.deviceScaleFactor = deviceScaleFactor; |
2033 | 2033 |
2034 FrameTestHelpers::WebViewHelper webViewHelper(this); | 2034 FrameTestHelpers::WebViewHelper webViewHelper(this); |
2035 webViewHelper.initializeAndLoad(m_baseURL + "viewport-target-densitydpi-
high.html", true, 0, &client, enableViewportSettings); | 2035 webViewHelper.initializeAndLoad(m_baseURL + "viewport-target-densitydpi-
high.html", true, nullptr, &client, nullptr, enableViewportSettings); |
2036 webViewHelper.webView()->settings()->setWideViewportQuirkEnabled(true); | 2036 webViewHelper.webView()->settings()->setWideViewportQuirkEnabled(true); |
2037 webViewHelper.webView()->settings()->setSupportDeprecatedTargetDensityDP
I(true); | 2037 webViewHelper.webView()->settings()->setSupportDeprecatedTargetDensityDP
I(true); |
2038 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); | 2038 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); |
2039 | 2039 |
2040 // We need to account for the fact that logical pixels are unconditional
ly multiplied by deviceScaleFactor to produce | 2040 // We need to account for the fact that logical pixels are unconditional
ly multiplied by deviceScaleFactor to produce |
2041 // physical pixels. | 2041 // physical pixels. |
2042 float densityDpiScaleRatio = deviceScaleFactor * targetDpi / deviceDpi; | 2042 float densityDpiScaleRatio = deviceScaleFactor * targetDpi / deviceDpi; |
2043 EXPECT_NEAR(viewportWidth * densityDpiScaleRatio, webViewHelper.webViewI
mpl()->mainFrameImpl()->frameView()->layoutSize().width(), 1.0f); | 2043 EXPECT_NEAR(viewportWidth * densityDpiScaleRatio, webViewHelper.webViewI
mpl()->mainFrameImpl()->frameView()->layoutSize().width(), 1.0f); |
2044 EXPECT_NEAR(viewportHeight * densityDpiScaleRatio, webViewHelper.webView
Impl()->mainFrameImpl()->frameView()->layoutSize().height(), 1.0f); | 2044 EXPECT_NEAR(viewportHeight * densityDpiScaleRatio, webViewHelper.webView
Impl()->mainFrameImpl()->frameView()->layoutSize().height(), 1.0f); |
2045 EXPECT_NEAR(1.0f / densityDpiScaleRatio, webViewHelper.webView()->pageSc
aleFactor(), 0.01f); | 2045 EXPECT_NEAR(1.0f / densityDpiScaleRatio, webViewHelper.webView()->pageSc
aleFactor(), 0.01f); |
2046 } | 2046 } |
2047 } | 2047 } |
2048 | 2048 |
2049 TEST_P(ParameterizedWebFrameTest, targetDensityDpiDevice) | 2049 TEST_P(ParameterizedWebFrameTest, targetDensityDpiDevice) |
2050 { | 2050 { |
2051 registerMockedHttpURLLoad("viewport-target-densitydpi-device.html"); | 2051 registerMockedHttpURLLoad("viewport-target-densitydpi-device.html"); |
2052 | 2052 |
2053 float deviceScaleFactors[] = { 1.0f, 4.0f / 3.0f, 2.0f }; | 2053 float deviceScaleFactors[] = { 1.0f, 4.0f / 3.0f, 2.0f }; |
2054 | 2054 |
2055 FixedLayoutTestWebViewClient client; | 2055 FixedLayoutTestWebViewClient client; |
2056 int viewportWidth = 640; | 2056 int viewportWidth = 640; |
2057 int viewportHeight = 480; | 2057 int viewportHeight = 480; |
2058 | 2058 |
2059 for (size_t i = 0; i < WTF_ARRAY_LENGTH(deviceScaleFactors); ++i) { | 2059 for (size_t i = 0; i < WTF_ARRAY_LENGTH(deviceScaleFactors); ++i) { |
2060 client.m_screenInfo.deviceScaleFactor = deviceScaleFactors[i]; | 2060 client.m_screenInfo.deviceScaleFactor = deviceScaleFactors[i]; |
2061 | 2061 |
2062 FrameTestHelpers::WebViewHelper webViewHelper(this); | 2062 FrameTestHelpers::WebViewHelper webViewHelper(this); |
2063 webViewHelper.initializeAndLoad(m_baseURL + "viewport-target-densitydpi-
device.html", true, 0, &client, enableViewportSettings); | 2063 webViewHelper.initializeAndLoad(m_baseURL + "viewport-target-densitydpi-
device.html", true, nullptr, &client, nullptr, enableViewportSettings); |
2064 webViewHelper.webView()->settings()->setWideViewportQuirkEnabled(true); | 2064 webViewHelper.webView()->settings()->setWideViewportQuirkEnabled(true); |
2065 webViewHelper.webView()->settings()->setSupportDeprecatedTargetDensityDP
I(true); | 2065 webViewHelper.webView()->settings()->setSupportDeprecatedTargetDensityDP
I(true); |
2066 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); | 2066 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); |
2067 | 2067 |
2068 EXPECT_NEAR(viewportWidth * client.m_screenInfo.deviceScaleFactor, webVi
ewHelper.webViewImpl()->mainFrameImpl()->frameView()->layoutSize().width(), 1.0f
); | 2068 EXPECT_NEAR(viewportWidth * client.m_screenInfo.deviceScaleFactor, webVi
ewHelper.webViewImpl()->mainFrameImpl()->frameView()->layoutSize().width(), 1.0f
); |
2069 EXPECT_NEAR(viewportHeight * client.m_screenInfo.deviceScaleFactor, webV
iewHelper.webViewImpl()->mainFrameImpl()->frameView()->layoutSize().height(), 1.
0f); | 2069 EXPECT_NEAR(viewportHeight * client.m_screenInfo.deviceScaleFactor, webV
iewHelper.webViewImpl()->mainFrameImpl()->frameView()->layoutSize().height(), 1.
0f); |
2070 EXPECT_NEAR(1.0f / client.m_screenInfo.deviceScaleFactor, webViewHelper.
webView()->pageScaleFactor(), 0.01f); | 2070 EXPECT_NEAR(1.0f / client.m_screenInfo.deviceScaleFactor, webViewHelper.
webView()->pageScaleFactor(), 0.01f); |
2071 } | 2071 } |
2072 } | 2072 } |
2073 | 2073 |
2074 TEST_P(ParameterizedWebFrameTest, targetDensityDpiDeviceAndFixedWidth) | 2074 TEST_P(ParameterizedWebFrameTest, targetDensityDpiDeviceAndFixedWidth) |
2075 { | 2075 { |
2076 registerMockedHttpURLLoad("viewport-target-densitydpi-device-and-fixed-width
.html"); | 2076 registerMockedHttpURLLoad("viewport-target-densitydpi-device-and-fixed-width
.html"); |
2077 | 2077 |
2078 float deviceScaleFactors[] = { 1.0f, 4.0f / 3.0f, 2.0f }; | 2078 float deviceScaleFactors[] = { 1.0f, 4.0f / 3.0f, 2.0f }; |
2079 | 2079 |
2080 FixedLayoutTestWebViewClient client; | 2080 FixedLayoutTestWebViewClient client; |
2081 int viewportWidth = 640; | 2081 int viewportWidth = 640; |
2082 int viewportHeight = 480; | 2082 int viewportHeight = 480; |
2083 | 2083 |
2084 for (size_t i = 0; i < WTF_ARRAY_LENGTH(deviceScaleFactors); ++i) { | 2084 for (size_t i = 0; i < WTF_ARRAY_LENGTH(deviceScaleFactors); ++i) { |
2085 client.m_screenInfo.deviceScaleFactor = deviceScaleFactors[i]; | 2085 client.m_screenInfo.deviceScaleFactor = deviceScaleFactors[i]; |
2086 | 2086 |
2087 FrameTestHelpers::WebViewHelper webViewHelper(this); | 2087 FrameTestHelpers::WebViewHelper webViewHelper(this); |
2088 webViewHelper.initializeAndLoad(m_baseURL + "viewport-target-densitydpi-
device-and-fixed-width.html", true, 0, &client, enableViewportSettings); | 2088 webViewHelper.initializeAndLoad(m_baseURL + "viewport-target-densitydpi-
device-and-fixed-width.html", true, nullptr, &client, nullptr, enableViewportSet
tings); |
2089 webViewHelper.webView()->settings()->setWideViewportQuirkEnabled(true); | 2089 webViewHelper.webView()->settings()->setWideViewportQuirkEnabled(true); |
2090 webViewHelper.webView()->settings()->setSupportDeprecatedTargetDensityDP
I(true); | 2090 webViewHelper.webView()->settings()->setSupportDeprecatedTargetDensityDP
I(true); |
2091 webViewHelper.webView()->settings()->setUseWideViewport(true); | 2091 webViewHelper.webView()->settings()->setUseWideViewport(true); |
2092 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); | 2092 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); |
2093 | 2093 |
2094 EXPECT_NEAR(viewportWidth, webViewHelper.webViewImpl()->mainFrameImpl()-
>frameView()->layoutSize().width(), 1.0f); | 2094 EXPECT_NEAR(viewportWidth, webViewHelper.webViewImpl()->mainFrameImpl()-
>frameView()->layoutSize().width(), 1.0f); |
2095 EXPECT_NEAR(viewportHeight, webViewHelper.webViewImpl()->mainFrameImpl()
->frameView()->layoutSize().height(), 1.0f); | 2095 EXPECT_NEAR(viewportHeight, webViewHelper.webViewImpl()->mainFrameImpl()
->frameView()->layoutSize().height(), 1.0f); |
2096 EXPECT_NEAR(1.0f, webViewHelper.webView()->pageScaleFactor(), 0.01f); | 2096 EXPECT_NEAR(1.0f, webViewHelper.webView()->pageScaleFactor(), 0.01f); |
2097 } | 2097 } |
2098 } | 2098 } |
2099 | 2099 |
2100 TEST_P(ParameterizedWebFrameTest, NoWideViewportAndScaleLessThanOne) | 2100 TEST_P(ParameterizedWebFrameTest, NoWideViewportAndScaleLessThanOne) |
2101 { | 2101 { |
2102 registerMockedHttpURLLoad("viewport-initial-scale-less-than-1.html"); | 2102 registerMockedHttpURLLoad("viewport-initial-scale-less-than-1.html"); |
2103 | 2103 |
2104 FixedLayoutTestWebViewClient client; | 2104 FixedLayoutTestWebViewClient client; |
2105 client.m_screenInfo.deviceScaleFactor = 1.33f; | 2105 client.m_screenInfo.deviceScaleFactor = 1.33f; |
2106 int viewportWidth = 640; | 2106 int viewportWidth = 640; |
2107 int viewportHeight = 480; | 2107 int viewportHeight = 480; |
2108 | 2108 |
2109 FrameTestHelpers::WebViewHelper webViewHelper(this); | 2109 FrameTestHelpers::WebViewHelper webViewHelper(this); |
2110 webViewHelper.initializeAndLoad(m_baseURL + "viewport-initial-scale-less-tha
n-1.html", true, 0, &client, enableViewportSettings); | 2110 webViewHelper.initializeAndLoad(m_baseURL + "viewport-initial-scale-less-tha
n-1.html", true, nullptr, &client, nullptr, enableViewportSettings); |
2111 webViewHelper.webView()->settings()->setSupportDeprecatedTargetDensityDPI(tr
ue); | 2111 webViewHelper.webView()->settings()->setSupportDeprecatedTargetDensityDPI(tr
ue); |
2112 webViewHelper.webView()->settings()->setWideViewportQuirkEnabled(true); | 2112 webViewHelper.webView()->settings()->setWideViewportQuirkEnabled(true); |
2113 webViewHelper.webView()->settings()->setUseWideViewport(false); | 2113 webViewHelper.webView()->settings()->setUseWideViewport(false); |
2114 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); | 2114 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); |
2115 | 2115 |
2116 EXPECT_NEAR(viewportWidth * client.m_screenInfo.deviceScaleFactor, webViewHe
lper.webViewImpl()->mainFrameImpl()->frameView()->layoutSize().width(), 1.0f); | 2116 EXPECT_NEAR(viewportWidth * client.m_screenInfo.deviceScaleFactor, webViewHe
lper.webViewImpl()->mainFrameImpl()->frameView()->layoutSize().width(), 1.0f); |
2117 EXPECT_NEAR(viewportHeight * client.m_screenInfo.deviceScaleFactor, webViewH
elper.webViewImpl()->mainFrameImpl()->frameView()->layoutSize().height(), 1.0f); | 2117 EXPECT_NEAR(viewportHeight * client.m_screenInfo.deviceScaleFactor, webViewH
elper.webViewImpl()->mainFrameImpl()->frameView()->layoutSize().height(), 1.0f); |
2118 EXPECT_NEAR(1.0f / client.m_screenInfo.deviceScaleFactor, webViewHelper.webV
iew()->pageScaleFactor(), 0.01f); | 2118 EXPECT_NEAR(1.0f / client.m_screenInfo.deviceScaleFactor, webViewHelper.webV
iew()->pageScaleFactor(), 0.01f); |
2119 } | 2119 } |
2120 | 2120 |
2121 TEST_P(ParameterizedWebFrameTest, NoWideViewportAndScaleLessThanOneWithDeviceWid
th) | 2121 TEST_P(ParameterizedWebFrameTest, NoWideViewportAndScaleLessThanOneWithDeviceWid
th) |
2122 { | 2122 { |
2123 registerMockedHttpURLLoad("viewport-initial-scale-less-than-1-device-width.h
tml"); | 2123 registerMockedHttpURLLoad("viewport-initial-scale-less-than-1-device-width.h
tml"); |
2124 | 2124 |
2125 FixedLayoutTestWebViewClient client; | 2125 FixedLayoutTestWebViewClient client; |
2126 client.m_screenInfo.deviceScaleFactor = 1.33f; | 2126 client.m_screenInfo.deviceScaleFactor = 1.33f; |
2127 int viewportWidth = 640; | 2127 int viewportWidth = 640; |
2128 int viewportHeight = 480; | 2128 int viewportHeight = 480; |
2129 | 2129 |
2130 FrameTestHelpers::WebViewHelper webViewHelper(this); | 2130 FrameTestHelpers::WebViewHelper webViewHelper(this); |
2131 webViewHelper.initializeAndLoad(m_baseURL + "viewport-initial-scale-less-tha
n-1-device-width.html", true, 0, &client, enableViewportSettings); | 2131 webViewHelper.initializeAndLoad(m_baseURL + "viewport-initial-scale-less-tha
n-1-device-width.html", true, nullptr, &client, nullptr, enableViewportSettings)
; |
2132 webViewHelper.webView()->settings()->setSupportDeprecatedTargetDensityDPI(tr
ue); | 2132 webViewHelper.webView()->settings()->setSupportDeprecatedTargetDensityDPI(tr
ue); |
2133 webViewHelper.webView()->settings()->setWideViewportQuirkEnabled(true); | 2133 webViewHelper.webView()->settings()->setWideViewportQuirkEnabled(true); |
2134 webViewHelper.webView()->settings()->setUseWideViewport(false); | 2134 webViewHelper.webView()->settings()->setUseWideViewport(false); |
2135 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); | 2135 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); |
2136 | 2136 |
2137 const float pageZoom = 0.25f; | 2137 const float pageZoom = 0.25f; |
2138 EXPECT_NEAR(viewportWidth * client.m_screenInfo.deviceScaleFactor / pageZoom
, webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->layoutSize().width(
), 1.0f); | 2138 EXPECT_NEAR(viewportWidth * client.m_screenInfo.deviceScaleFactor / pageZoom
, webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->layoutSize().width(
), 1.0f); |
2139 EXPECT_NEAR(viewportHeight * client.m_screenInfo.deviceScaleFactor / pageZoo
m, webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->layoutSize().heigh
t(), 1.0f); | 2139 EXPECT_NEAR(viewportHeight * client.m_screenInfo.deviceScaleFactor / pageZoo
m, webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->layoutSize().heigh
t(), 1.0f); |
2140 EXPECT_NEAR(1.0f / client.m_screenInfo.deviceScaleFactor, webViewHelper.webV
iew()->pageScaleFactor(), 0.01f); | 2140 EXPECT_NEAR(1.0f / client.m_screenInfo.deviceScaleFactor, webViewHelper.webV
iew()->pageScaleFactor(), 0.01f); |
2141 } | 2141 } |
2142 | 2142 |
2143 TEST_P(ParameterizedWebFrameTest, NoWideViewportAndNoViewportWithInitialPageScal
eOverride) | 2143 TEST_P(ParameterizedWebFrameTest, NoWideViewportAndNoViewportWithInitialPageScal
eOverride) |
2144 { | 2144 { |
2145 registerMockedHttpURLLoad("large-div.html"); | 2145 registerMockedHttpURLLoad("large-div.html"); |
2146 | 2146 |
2147 FixedLayoutTestWebViewClient client; | 2147 FixedLayoutTestWebViewClient client; |
2148 int viewportWidth = 640; | 2148 int viewportWidth = 640; |
2149 int viewportHeight = 480; | 2149 int viewportHeight = 480; |
2150 float enforcedPageScaleFactor = 5.0f; | 2150 float enforcedPageScaleFactor = 5.0f; |
2151 | 2151 |
2152 FrameTestHelpers::WebViewHelper webViewHelper(this); | 2152 FrameTestHelpers::WebViewHelper webViewHelper(this); |
2153 webViewHelper.initializeAndLoad(m_baseURL + "large-div.html", true, 0, &clie
nt, enableViewportSettings); | 2153 webViewHelper.initializeAndLoad(m_baseURL + "large-div.html", true, nullptr,
&client, nullptr, enableViewportSettings); |
2154 webViewHelper.webView()->setDefaultPageScaleLimits(0.25f, 5); | 2154 webViewHelper.webView()->setDefaultPageScaleLimits(0.25f, 5); |
2155 webViewHelper.webView()->settings()->setWideViewportQuirkEnabled(true); | 2155 webViewHelper.webView()->settings()->setWideViewportQuirkEnabled(true); |
2156 webViewHelper.webView()->settings()->setUseWideViewport(false); | 2156 webViewHelper.webView()->settings()->setUseWideViewport(false); |
2157 webViewHelper.webView()->setInitialPageScaleOverride(enforcedPageScaleFactor
); | 2157 webViewHelper.webView()->setInitialPageScaleOverride(enforcedPageScaleFactor
); |
2158 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); | 2158 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); |
2159 | 2159 |
2160 EXPECT_NEAR(viewportWidth / enforcedPageScaleFactor, webViewHelper.webViewIm
pl()->mainFrameImpl()->frameView()->layoutSize().width(), 1.0f); | 2160 EXPECT_NEAR(viewportWidth / enforcedPageScaleFactor, webViewHelper.webViewIm
pl()->mainFrameImpl()->frameView()->layoutSize().width(), 1.0f); |
2161 EXPECT_NEAR(viewportHeight / enforcedPageScaleFactor, webViewHelper.webViewI
mpl()->mainFrameImpl()->frameView()->layoutSize().height(), 1.0f); | 2161 EXPECT_NEAR(viewportHeight / enforcedPageScaleFactor, webViewHelper.webViewI
mpl()->mainFrameImpl()->frameView()->layoutSize().height(), 1.0f); |
2162 EXPECT_NEAR(enforcedPageScaleFactor, webViewHelper.webView()->pageScaleFacto
r(), 0.01f); | 2162 EXPECT_NEAR(enforcedPageScaleFactor, webViewHelper.webView()->pageScaleFacto
r(), 0.01f); |
2163 } | 2163 } |
2164 | 2164 |
2165 TEST_P(ParameterizedWebFrameTest, NoUserScalableQuirkIgnoresViewportScale) | 2165 TEST_P(ParameterizedWebFrameTest, NoUserScalableQuirkIgnoresViewportScale) |
2166 { | 2166 { |
2167 registerMockedHttpURLLoad("viewport-initial-scale-and-user-scalable-no.html"
); | 2167 registerMockedHttpURLLoad("viewport-initial-scale-and-user-scalable-no.html"
); |
2168 | 2168 |
2169 FixedLayoutTestWebViewClient client; | 2169 FixedLayoutTestWebViewClient client; |
2170 int viewportWidth = 640; | 2170 int viewportWidth = 640; |
2171 int viewportHeight = 480; | 2171 int viewportHeight = 480; |
2172 | 2172 |
2173 FrameTestHelpers::WebViewHelper webViewHelper(this); | 2173 FrameTestHelpers::WebViewHelper webViewHelper(this); |
2174 webViewHelper.initializeAndLoad(m_baseURL + "viewport-initial-scale-and-user
-scalable-no.html", true, 0, &client, enableViewportSettings); | 2174 webViewHelper.initializeAndLoad(m_baseURL + "viewport-initial-scale-and-user
-scalable-no.html", true, nullptr, &client, nullptr, enableViewportSettings); |
2175 webViewHelper.webView()->settings()->setViewportMetaNonUserScalableQuirk(tru
e); | 2175 webViewHelper.webView()->settings()->setViewportMetaNonUserScalableQuirk(tru
e); |
2176 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); | 2176 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); |
2177 | 2177 |
2178 EXPECT_NEAR(viewportWidth, webViewHelper.webViewImpl()->mainFrameImpl()->fra
meView()->layoutSize().width(), 1.0f); | 2178 EXPECT_NEAR(viewportWidth, webViewHelper.webViewImpl()->mainFrameImpl()->fra
meView()->layoutSize().width(), 1.0f); |
2179 EXPECT_NEAR(viewportHeight, webViewHelper.webViewImpl()->mainFrameImpl()->fr
ameView()->layoutSize().height(), 1.0f); | 2179 EXPECT_NEAR(viewportHeight, webViewHelper.webViewImpl()->mainFrameImpl()->fr
ameView()->layoutSize().height(), 1.0f); |
2180 EXPECT_NEAR(1.0f, webViewHelper.webView()->pageScaleFactor(), 0.01f); | 2180 EXPECT_NEAR(1.0f, webViewHelper.webView()->pageScaleFactor(), 0.01f); |
2181 } | 2181 } |
2182 | 2182 |
2183 TEST_P(ParameterizedWebFrameTest, NoUserScalableQuirkIgnoresViewportScaleForNonW
ideViewport) | 2183 TEST_P(ParameterizedWebFrameTest, NoUserScalableQuirkIgnoresViewportScaleForNonW
ideViewport) |
2184 { | 2184 { |
2185 registerMockedHttpURLLoad("viewport-initial-scale-and-user-scalable-no.html"
); | 2185 registerMockedHttpURLLoad("viewport-initial-scale-and-user-scalable-no.html"
); |
2186 | 2186 |
2187 FixedLayoutTestWebViewClient client; | 2187 FixedLayoutTestWebViewClient client; |
2188 client.m_screenInfo.deviceScaleFactor = 1.33f; | 2188 client.m_screenInfo.deviceScaleFactor = 1.33f; |
2189 int viewportWidth = 640; | 2189 int viewportWidth = 640; |
2190 int viewportHeight = 480; | 2190 int viewportHeight = 480; |
2191 | 2191 |
2192 FrameTestHelpers::WebViewHelper webViewHelper(this); | 2192 FrameTestHelpers::WebViewHelper webViewHelper(this); |
2193 webViewHelper.initializeAndLoad(m_baseURL + "viewport-initial-scale-and-user
-scalable-no.html", true, 0, &client, enableViewportSettings); | 2193 webViewHelper.initializeAndLoad(m_baseURL + "viewport-initial-scale-and-user
-scalable-no.html", true, nullptr, &client, nullptr, enableViewportSettings); |
2194 webViewHelper.webView()->settings()->setSupportDeprecatedTargetDensityDPI(tr
ue); | 2194 webViewHelper.webView()->settings()->setSupportDeprecatedTargetDensityDPI(tr
ue); |
2195 webViewHelper.webView()->settings()->setViewportMetaNonUserScalableQuirk(tru
e); | 2195 webViewHelper.webView()->settings()->setViewportMetaNonUserScalableQuirk(tru
e); |
2196 webViewHelper.webView()->settings()->setWideViewportQuirkEnabled(true); | 2196 webViewHelper.webView()->settings()->setWideViewportQuirkEnabled(true); |
2197 webViewHelper.webView()->settings()->setUseWideViewport(false); | 2197 webViewHelper.webView()->settings()->setUseWideViewport(false); |
2198 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); | 2198 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); |
2199 | 2199 |
2200 EXPECT_NEAR(viewportWidth * client.m_screenInfo.deviceScaleFactor, webViewHe
lper.webViewImpl()->mainFrameImpl()->frameView()->layoutSize().width(), 1.0f); | 2200 EXPECT_NEAR(viewportWidth * client.m_screenInfo.deviceScaleFactor, webViewHe
lper.webViewImpl()->mainFrameImpl()->frameView()->layoutSize().width(), 1.0f); |
2201 EXPECT_NEAR(viewportHeight * client.m_screenInfo.deviceScaleFactor, webViewH
elper.webViewImpl()->mainFrameImpl()->frameView()->layoutSize().height(), 1.0f); | 2201 EXPECT_NEAR(viewportHeight * client.m_screenInfo.deviceScaleFactor, webViewH
elper.webViewImpl()->mainFrameImpl()->frameView()->layoutSize().height(), 1.0f); |
2202 EXPECT_NEAR(1.0f / client.m_screenInfo.deviceScaleFactor, webViewHelper.webV
iew()->pageScaleFactor(), 0.01f); | 2202 EXPECT_NEAR(1.0f / client.m_screenInfo.deviceScaleFactor, webViewHelper.webV
iew()->pageScaleFactor(), 0.01f); |
2203 } | 2203 } |
2204 | 2204 |
2205 TEST_P(ParameterizedWebFrameTest, NoUserScalableQuirkIgnoresViewportScaleForWide
Viewport) | 2205 TEST_P(ParameterizedWebFrameTest, NoUserScalableQuirkIgnoresViewportScaleForWide
Viewport) |
2206 { | 2206 { |
2207 registerMockedHttpURLLoad("viewport-2x-initial-scale-non-user-scalable.html"
); | 2207 registerMockedHttpURLLoad("viewport-2x-initial-scale-non-user-scalable.html"
); |
2208 | 2208 |
2209 FixedLayoutTestWebViewClient client; | 2209 FixedLayoutTestWebViewClient client; |
2210 int viewportWidth = 640; | 2210 int viewportWidth = 640; |
2211 int viewportHeight = 480; | 2211 int viewportHeight = 480; |
2212 | 2212 |
2213 FrameTestHelpers::WebViewHelper webViewHelper(this); | 2213 FrameTestHelpers::WebViewHelper webViewHelper(this); |
2214 webViewHelper.initializeAndLoad(m_baseURL + "viewport-2x-initial-scale-non-u
ser-scalable.html", true, 0, &client, enableViewportSettings); | 2214 webViewHelper.initializeAndLoad(m_baseURL + "viewport-2x-initial-scale-non-u
ser-scalable.html", true, nullptr, &client, nullptr, enableViewportSettings); |
2215 webViewHelper.webView()->settings()->setViewportMetaNonUserScalableQuirk(tru
e); | 2215 webViewHelper.webView()->settings()->setViewportMetaNonUserScalableQuirk(tru
e); |
2216 webViewHelper.webView()->settings()->setWideViewportQuirkEnabled(true); | 2216 webViewHelper.webView()->settings()->setWideViewportQuirkEnabled(true); |
2217 webViewHelper.webView()->settings()->setUseWideViewport(true); | 2217 webViewHelper.webView()->settings()->setUseWideViewport(true); |
2218 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); | 2218 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); |
2219 | 2219 |
2220 EXPECT_NEAR(viewportWidth, webViewHelper.webViewImpl()->mainFrameImpl()->fra
meView()->layoutSize().width(), 1.0f); | 2220 EXPECT_NEAR(viewportWidth, webViewHelper.webViewImpl()->mainFrameImpl()->fra
meView()->layoutSize().width(), 1.0f); |
2221 EXPECT_NEAR(viewportHeight, webViewHelper.webViewImpl()->mainFrameImpl()->fr
ameView()->layoutSize().height(), 1.0f); | 2221 EXPECT_NEAR(viewportHeight, webViewHelper.webViewImpl()->mainFrameImpl()->fr
ameView()->layoutSize().height(), 1.0f); |
2222 EXPECT_NEAR(1.0f, webViewHelper.webView()->pageScaleFactor(), 0.01f); | 2222 EXPECT_NEAR(1.0f, webViewHelper.webView()->pageScaleFactor(), 0.01f); |
2223 } | 2223 } |
2224 | 2224 |
2225 TEST_P(ParameterizedWebFrameTest, DesktopPageCanBeZoomedInWhenWideViewportIsTurn
edOff) | 2225 TEST_P(ParameterizedWebFrameTest, DesktopPageCanBeZoomedInWhenWideViewportIsTurn
edOff) |
2226 { | 2226 { |
2227 registerMockedHttpURLLoad("no_viewport_tag.html"); | 2227 registerMockedHttpURLLoad("no_viewport_tag.html"); |
2228 | 2228 |
2229 FixedLayoutTestWebViewClient client; | 2229 FixedLayoutTestWebViewClient client; |
2230 int viewportWidth = 640; | 2230 int viewportWidth = 640; |
2231 int viewportHeight = 480; | 2231 int viewportHeight = 480; |
2232 | 2232 |
2233 FrameTestHelpers::WebViewHelper webViewHelper(this); | 2233 FrameTestHelpers::WebViewHelper webViewHelper(this); |
2234 webViewHelper.initializeAndLoad(m_baseURL + "no_viewport_tag.html", true, 0,
&client, enableViewportSettings); | 2234 webViewHelper.initializeAndLoad(m_baseURL + "no_viewport_tag.html", true, nu
llptr, &client, nullptr, enableViewportSettings); |
2235 webViewHelper.webView()->setDefaultPageScaleLimits(0.25f, 5); | 2235 webViewHelper.webView()->setDefaultPageScaleLimits(0.25f, 5); |
2236 webViewHelper.webView()->settings()->setWideViewportQuirkEnabled(true); | 2236 webViewHelper.webView()->settings()->setWideViewportQuirkEnabled(true); |
2237 webViewHelper.webView()->settings()->setUseWideViewport(false); | 2237 webViewHelper.webView()->settings()->setUseWideViewport(false); |
2238 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); | 2238 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); |
2239 | 2239 |
2240 EXPECT_NEAR(1.0f, webViewHelper.webViewImpl()->pageScaleFactor(), 0.01f); | 2240 EXPECT_NEAR(1.0f, webViewHelper.webViewImpl()->pageScaleFactor(), 0.01f); |
2241 EXPECT_NEAR(1.0f, webViewHelper.webViewImpl()->minimumPageScaleFactor(), 0.0
1f); | 2241 EXPECT_NEAR(1.0f, webViewHelper.webViewImpl()->minimumPageScaleFactor(), 0.0
1f); |
2242 EXPECT_NEAR(5.0f, webViewHelper.webViewImpl()->maximumPageScaleFactor(), 0.0
1f); | 2242 EXPECT_NEAR(5.0f, webViewHelper.webViewImpl()->maximumPageScaleFactor(), 0.0
1f); |
2243 } | 2243 } |
2244 | 2244 |
(...skipping 10 matching lines...) Expand all Loading... |
2255 void testResizeYieldsCorrectScrollAndScale(const char* url, | 2255 void testResizeYieldsCorrectScrollAndScale(const char* url, |
2256 const float initialPageScaleFacto
r, | 2256 const float initialPageScaleFacto
r, |
2257 const WebSize scrollOffset, | 2257 const WebSize scrollOffset, |
2258 const WebSize viewportSize, | 2258 const WebSize viewportSize, |
2259 const bool shouldScaleRelativeToV
iewportWidth) { | 2259 const bool shouldScaleRelativeToV
iewportWidth) { |
2260 registerMockedHttpURLLoad(url); | 2260 registerMockedHttpURLLoad(url); |
2261 | 2261 |
2262 const float aspectRatio = static_cast<float>(viewportSize.width) / viewp
ortSize.height; | 2262 const float aspectRatio = static_cast<float>(viewportSize.width) / viewp
ortSize.height; |
2263 | 2263 |
2264 FrameTestHelpers::WebViewHelper webViewHelper(this); | 2264 FrameTestHelpers::WebViewHelper webViewHelper(this); |
2265 webViewHelper.initializeAndLoad(m_baseURL + url, true, 0, 0, enableViewp
ortSettings); | 2265 webViewHelper.initializeAndLoad(m_baseURL + url, true, nullptr, nullptr,
nullptr, enableViewportSettings); |
2266 webViewHelper.webViewImpl()->setDefaultPageScaleLimits(0.25f, 5); | 2266 webViewHelper.webViewImpl()->setDefaultPageScaleLimits(0.25f, 5); |
2267 | 2267 |
2268 // Origin scrollOffsets preserved under resize. | 2268 // Origin scrollOffsets preserved under resize. |
2269 { | 2269 { |
2270 webViewHelper.resize(WebSize(viewportSize.width, viewportSize.height
)); | 2270 webViewHelper.resize(WebSize(viewportSize.width, viewportSize.height
)); |
2271 webViewHelper.webViewImpl()->setPageScaleFactor(initialPageScaleFact
or); | 2271 webViewHelper.webViewImpl()->setPageScaleFactor(initialPageScaleFact
or); |
2272 ASSERT_EQ(viewportSize, webViewHelper.webViewImpl()->size()); | 2272 ASSERT_EQ(viewportSize, webViewHelper.webViewImpl()->size()); |
2273 ASSERT_EQ(initialPageScaleFactor, webViewHelper.webViewImpl()->pageS
caleFactor()); | 2273 ASSERT_EQ(initialPageScaleFactor, webViewHelper.webViewImpl()->pageS
caleFactor()); |
2274 webViewHelper.resize(WebSize(viewportSize.height, viewportSize.width
)); | 2274 webViewHelper.resize(WebSize(viewportSize.height, viewportSize.width
)); |
2275 float expectedPageScaleFactor = initialPageScaleFactor * (shouldScal
eRelativeToViewportWidth ? 1 / aspectRatio : 1); | 2275 float expectedPageScaleFactor = initialPageScaleFactor * (shouldScal
eRelativeToViewportWidth ? 1 / aspectRatio : 1); |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2357 TEST_P(ParameterizedWebFrameTest, pageScaleFactorUpdatesScrollbars) | 2357 TEST_P(ParameterizedWebFrameTest, pageScaleFactorUpdatesScrollbars) |
2358 { | 2358 { |
2359 registerMockedHttpURLLoad("fixed_layout.html"); | 2359 registerMockedHttpURLLoad("fixed_layout.html"); |
2360 | 2360 |
2361 FixedLayoutTestWebViewClient client; | 2361 FixedLayoutTestWebViewClient client; |
2362 client.m_screenInfo.deviceScaleFactor = 1; | 2362 client.m_screenInfo.deviceScaleFactor = 1; |
2363 int viewportWidth = 640; | 2363 int viewportWidth = 640; |
2364 int viewportHeight = 480; | 2364 int viewportHeight = 480; |
2365 | 2365 |
2366 FrameTestHelpers::WebViewHelper webViewHelper(this); | 2366 FrameTestHelpers::WebViewHelper webViewHelper(this); |
2367 webViewHelper.initializeAndLoad(m_baseURL + "fixed_layout.html", true, 0, &c
lient, enableViewportSettings); | 2367 webViewHelper.initializeAndLoad(m_baseURL + "fixed_layout.html", true, nullp
tr, &client, nullptr, enableViewportSettings); |
2368 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); | 2368 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); |
2369 | 2369 |
2370 FrameView* view = webViewHelper.webViewImpl()->mainFrameImpl()->frameView(); | 2370 FrameView* view = webViewHelper.webViewImpl()->mainFrameImpl()->frameView(); |
2371 EXPECT_EQ(view->scrollSize(HorizontalScrollbar), view->contentsSize().width(
) - view->visibleContentRect().width()); | 2371 EXPECT_EQ(view->scrollSize(HorizontalScrollbar), view->contentsSize().width(
) - view->visibleContentRect().width()); |
2372 EXPECT_EQ(view->scrollSize(VerticalScrollbar), view->contentsSize().height()
- view->visibleContentRect().height()); | 2372 EXPECT_EQ(view->scrollSize(VerticalScrollbar), view->contentsSize().height()
- view->visibleContentRect().height()); |
2373 | 2373 |
2374 webViewHelper.webView()->setPageScaleFactor(10); | 2374 webViewHelper.webView()->setPageScaleFactor(10); |
2375 | 2375 |
2376 EXPECT_EQ(view->scrollSize(HorizontalScrollbar), view->contentsSize().width(
) - view->visibleContentRect().width()); | 2376 EXPECT_EQ(view->scrollSize(HorizontalScrollbar), view->contentsSize().width(
) - view->visibleContentRect().width()); |
2377 EXPECT_EQ(view->scrollSize(VerticalScrollbar), view->contentsSize().height()
- view->visibleContentRect().height()); | 2377 EXPECT_EQ(view->scrollSize(VerticalScrollbar), view->contentsSize().height()
- view->visibleContentRect().height()); |
2378 } | 2378 } |
2379 | 2379 |
2380 TEST_P(ParameterizedWebFrameTest, CanOverrideScaleLimits) | 2380 TEST_P(ParameterizedWebFrameTest, CanOverrideScaleLimits) |
2381 { | 2381 { |
2382 registerMockedHttpURLLoad("no_scale_for_you.html"); | 2382 registerMockedHttpURLLoad("no_scale_for_you.html"); |
2383 | 2383 |
2384 FixedLayoutTestWebViewClient client; | 2384 FixedLayoutTestWebViewClient client; |
2385 client.m_screenInfo.deviceScaleFactor = 1; | 2385 client.m_screenInfo.deviceScaleFactor = 1; |
2386 int viewportWidth = 640; | 2386 int viewportWidth = 640; |
2387 int viewportHeight = 480; | 2387 int viewportHeight = 480; |
2388 | 2388 |
2389 FrameTestHelpers::WebViewHelper webViewHelper(this); | 2389 FrameTestHelpers::WebViewHelper webViewHelper(this); |
2390 webViewHelper.initializeAndLoad(m_baseURL + "no_scale_for_you.html", true, 0
, &client, enableViewportSettings); | 2390 webViewHelper.initializeAndLoad(m_baseURL + "no_scale_for_you.html", true, n
ullptr, &client, nullptr, enableViewportSettings); |
2391 webViewHelper.webView()->setDefaultPageScaleLimits(0.25f, 5); | 2391 webViewHelper.webView()->setDefaultPageScaleLimits(0.25f, 5); |
2392 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); | 2392 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); |
2393 | 2393 |
2394 EXPECT_EQ(2.0f, webViewHelper.webViewImpl()->minimumPageScaleFactor()); | 2394 EXPECT_EQ(2.0f, webViewHelper.webViewImpl()->minimumPageScaleFactor()); |
2395 EXPECT_EQ(2.0f, webViewHelper.webViewImpl()->maximumPageScaleFactor()); | 2395 EXPECT_EQ(2.0f, webViewHelper.webViewImpl()->maximumPageScaleFactor()); |
2396 | 2396 |
2397 webViewHelper.webView()->setIgnoreViewportTagScaleLimits(true); | 2397 webViewHelper.webView()->setIgnoreViewportTagScaleLimits(true); |
2398 webViewHelper.webView()->updateAllLifecyclePhases(); | 2398 webViewHelper.webView()->updateAllLifecyclePhases(); |
2399 | 2399 |
2400 EXPECT_EQ(1.0f, webViewHelper.webViewImpl()->minimumPageScaleFactor()); | 2400 EXPECT_EQ(1.0f, webViewHelper.webViewImpl()->minimumPageScaleFactor()); |
(...skipping 13 matching lines...) Expand all Loading... |
2414 TEST_F(WebFrameTest, updateOverlayScrollbarLayers) | 2414 TEST_F(WebFrameTest, updateOverlayScrollbarLayers) |
2415 #endif | 2415 #endif |
2416 { | 2416 { |
2417 registerMockedHttpURLLoad("large-div.html"); | 2417 registerMockedHttpURLLoad("large-div.html"); |
2418 | 2418 |
2419 int viewWidth = 500; | 2419 int viewWidth = 500; |
2420 int viewHeight = 500; | 2420 int viewHeight = 500; |
2421 | 2421 |
2422 OwnPtr<FakeCompositingWebViewClient> fakeCompositingWebViewClient = adoptPtr
(new FakeCompositingWebViewClient()); | 2422 OwnPtr<FakeCompositingWebViewClient> fakeCompositingWebViewClient = adoptPtr
(new FakeCompositingWebViewClient()); |
2423 FrameTestHelpers::WebViewHelper webViewHelper; | 2423 FrameTestHelpers::WebViewHelper webViewHelper; |
2424 webViewHelper.initialize(true, 0, fakeCompositingWebViewClient.get(), &confi
gueCompositingWebView); | 2424 webViewHelper.initialize(true, nullptr, fakeCompositingWebViewClient.get(),
nullptr, &configueCompositingWebView); |
2425 | 2425 |
2426 webViewHelper.resize(WebSize(viewWidth, viewHeight)); | 2426 webViewHelper.resize(WebSize(viewWidth, viewHeight)); |
2427 FrameTestHelpers::loadFrame(webViewHelper.webView()->mainFrame(), m_baseURL
+ "large-div.html"); | 2427 FrameTestHelpers::loadFrame(webViewHelper.webView()->mainFrame(), m_baseURL
+ "large-div.html"); |
2428 | 2428 |
2429 FrameView* view = webViewHelper.webViewImpl()->mainFrameImpl()->frameView(); | 2429 FrameView* view = webViewHelper.webViewImpl()->mainFrameImpl()->frameView(); |
2430 EXPECT_TRUE(view->layoutView()->compositor()->layerForHorizontalScrollbar())
; | 2430 EXPECT_TRUE(view->layoutView()->compositor()->layerForHorizontalScrollbar())
; |
2431 EXPECT_TRUE(view->layoutView()->compositor()->layerForVerticalScrollbar()); | 2431 EXPECT_TRUE(view->layoutView()->compositor()->layerForVerticalScrollbar()); |
2432 | 2432 |
2433 webViewHelper.resize(WebSize(viewWidth * 10, viewHeight * 10)); | 2433 webViewHelper.resize(WebSize(viewWidth * 10, viewHeight * 10)); |
2434 EXPECT_FALSE(view->layoutView()->compositor()->layerForHorizontalScrollbar()
); | 2434 EXPECT_FALSE(view->layoutView()->compositor()->layerForHorizontalScrollbar()
); |
(...skipping 30 matching lines...) Expand all Loading... |
2465 | 2465 |
2466 TEST_P(ParameterizedWebFrameTest, DivAutoZoomParamsTest) | 2466 TEST_P(ParameterizedWebFrameTest, DivAutoZoomParamsTest) |
2467 { | 2467 { |
2468 registerMockedHttpURLLoad("get_scale_for_auto_zoom_into_div_test.html"); | 2468 registerMockedHttpURLLoad("get_scale_for_auto_zoom_into_div_test.html"); |
2469 | 2469 |
2470 const float deviceScaleFactor = 2.0f; | 2470 const float deviceScaleFactor = 2.0f; |
2471 int viewportWidth = 640 / deviceScaleFactor; | 2471 int viewportWidth = 640 / deviceScaleFactor; |
2472 int viewportHeight = 1280 / deviceScaleFactor; | 2472 int viewportHeight = 1280 / deviceScaleFactor; |
2473 float doubleTapZoomAlreadyLegibleRatio = 1.2f; | 2473 float doubleTapZoomAlreadyLegibleRatio = 1.2f; |
2474 FrameTestHelpers::WebViewHelper webViewHelper(this); | 2474 FrameTestHelpers::WebViewHelper webViewHelper(this); |
2475 webViewHelper.initializeAndLoad(m_baseURL + "get_scale_for_auto_zoom_into_di
v_test.html", false, 0, 0, configureAndroid); | 2475 webViewHelper.initializeAndLoad(m_baseURL + "get_scale_for_auto_zoom_into_di
v_test.html", false, nullptr, nullptr, nullptr, configureAndroid); |
2476 webViewHelper.webView()->setDeviceScaleFactor(deviceScaleFactor); | 2476 webViewHelper.webView()->setDeviceScaleFactor(deviceScaleFactor); |
2477 webViewHelper.webView()->setDefaultPageScaleLimits(0.01f, 4); | 2477 webViewHelper.webView()->setDefaultPageScaleLimits(0.01f, 4); |
2478 webViewHelper.webView()->setPageScaleFactor(0.5f); | 2478 webViewHelper.webView()->setPageScaleFactor(0.5f); |
2479 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); | 2479 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); |
2480 | 2480 |
2481 WebRect wideDiv(200, 100, 400, 150); | 2481 WebRect wideDiv(200, 100, 400, 150); |
2482 WebRect tallDiv(200, 300, 400, 800); | 2482 WebRect tallDiv(200, 300, 400, 800); |
2483 WebPoint doubleTapPointWide(wideDiv.x + 50, wideDiv.y + 50); | 2483 WebPoint doubleTapPointWide(wideDiv.x + 50, wideDiv.y + 50); |
2484 WebPoint doubleTapPointTall(tallDiv.x + 50, tallDiv.y + 50); | 2484 WebPoint doubleTapPointTall(tallDiv.x + 50, tallDiv.y + 50); |
2485 float scale; | 2485 float scale; |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2517 | 2517 |
2518 TEST_P(ParameterizedWebFrameTest, DivAutoZoomWideDivTest) | 2518 TEST_P(ParameterizedWebFrameTest, DivAutoZoomWideDivTest) |
2519 { | 2519 { |
2520 registerMockedHttpURLLoad("get_wide_div_for_auto_zoom_test.html"); | 2520 registerMockedHttpURLLoad("get_wide_div_for_auto_zoom_test.html"); |
2521 | 2521 |
2522 const float deviceScaleFactor = 2.0f; | 2522 const float deviceScaleFactor = 2.0f; |
2523 int viewportWidth = 640 / deviceScaleFactor; | 2523 int viewportWidth = 640 / deviceScaleFactor; |
2524 int viewportHeight = 1280 / deviceScaleFactor; | 2524 int viewportHeight = 1280 / deviceScaleFactor; |
2525 float doubleTapZoomAlreadyLegibleRatio = 1.2f; | 2525 float doubleTapZoomAlreadyLegibleRatio = 1.2f; |
2526 FrameTestHelpers::WebViewHelper webViewHelper(this); | 2526 FrameTestHelpers::WebViewHelper webViewHelper(this); |
2527 webViewHelper.initializeAndLoad(m_baseURL + "get_wide_div_for_auto_zoom_test
.html", false, 0, 0, configureAndroid); | 2527 webViewHelper.initializeAndLoad(m_baseURL + "get_wide_div_for_auto_zoom_test
.html", false, nullptr, nullptr, nullptr, configureAndroid); |
2528 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); | 2528 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); |
2529 webViewHelper.webView()->setDeviceScaleFactor(deviceScaleFactor); | 2529 webViewHelper.webView()->setDeviceScaleFactor(deviceScaleFactor); |
2530 webViewHelper.webView()->setPageScaleFactor(1.0f); | 2530 webViewHelper.webView()->setPageScaleFactor(1.0f); |
2531 webViewHelper.webView()->updateAllLifecyclePhases(); | 2531 webViewHelper.webView()->updateAllLifecyclePhases(); |
2532 | 2532 |
2533 webViewHelper.webViewImpl()->enableFakePageScaleAnimationForTesting(true); | 2533 webViewHelper.webViewImpl()->enableFakePageScaleAnimationForTesting(true); |
2534 | 2534 |
2535 float doubleTapZoomAlreadyLegibleScale = webViewHelper.webViewImpl()->minimu
mPageScaleFactor() * doubleTapZoomAlreadyLegibleRatio; | 2535 float doubleTapZoomAlreadyLegibleScale = webViewHelper.webViewImpl()->minimu
mPageScaleFactor() * doubleTapZoomAlreadyLegibleRatio; |
2536 | 2536 |
2537 WebRect div(0, 100, viewportWidth, 150); | 2537 WebRect div(0, 100, viewportWidth, 150); |
(...skipping 11 matching lines...) Expand all Loading... |
2549 { | 2549 { |
2550 // When a block is taller than the viewport and a zoom targets a lower part | 2550 // When a block is taller than the viewport and a zoom targets a lower part |
2551 // of it, then we should keep the target point onscreen instead of snapping | 2551 // of it, then we should keep the target point onscreen instead of snapping |
2552 // back up the top of the block. | 2552 // back up the top of the block. |
2553 registerMockedHttpURLLoad("very_tall_div.html"); | 2553 registerMockedHttpURLLoad("very_tall_div.html"); |
2554 | 2554 |
2555 const float deviceScaleFactor = 2.0f; | 2555 const float deviceScaleFactor = 2.0f; |
2556 int viewportWidth = 640 / deviceScaleFactor; | 2556 int viewportWidth = 640 / deviceScaleFactor; |
2557 int viewportHeight = 1280 / deviceScaleFactor; | 2557 int viewportHeight = 1280 / deviceScaleFactor; |
2558 FrameTestHelpers::WebViewHelper webViewHelper(this); | 2558 FrameTestHelpers::WebViewHelper webViewHelper(this); |
2559 webViewHelper.initializeAndLoad(m_baseURL + "very_tall_div.html", true, 0, 0
, configureAndroid); | 2559 webViewHelper.initializeAndLoad(m_baseURL + "very_tall_div.html", true, null
ptr, nullptr, nullptr, configureAndroid); |
2560 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); | 2560 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); |
2561 webViewHelper.webView()->setDeviceScaleFactor(deviceScaleFactor); | 2561 webViewHelper.webView()->setDeviceScaleFactor(deviceScaleFactor); |
2562 webViewHelper.webView()->setPageScaleFactor(1.0f); | 2562 webViewHelper.webView()->setPageScaleFactor(1.0f); |
2563 webViewHelper.webView()->updateAllLifecyclePhases(); | 2563 webViewHelper.webView()->updateAllLifecyclePhases(); |
2564 | 2564 |
2565 WebRect div(200, 300, 400, 5000); | 2565 WebRect div(200, 300, 400, 5000); |
2566 WebPoint point(div.x + 50, div.y + 3000); | 2566 WebPoint point(div.x + 50, div.y + 3000); |
2567 float scale; | 2567 float scale; |
2568 WebPoint scroll; | 2568 WebPoint scroll; |
2569 | 2569 |
2570 WebRect blockBound = webViewHelper.webViewImpl()->computeBlockBound(point, t
rue); | 2570 WebRect blockBound = webViewHelper.webViewImpl()->computeBlockBound(point, t
rue); |
2571 webViewHelper.webViewImpl()->computeScaleAndScrollForBlockRect(point, blockB
ound, 0, 1.0f, scale, scroll); | 2571 webViewHelper.webViewImpl()->computeScaleAndScrollForBlockRect(point, blockB
ound, 0, 1.0f, scale, scroll); |
2572 EXPECT_EQ(scale, 1.0f); | 2572 EXPECT_EQ(scale, 1.0f); |
2573 EXPECT_EQ(scroll.y, 2660); | 2573 EXPECT_EQ(scroll.y, 2660); |
2574 } | 2574 } |
2575 | 2575 |
2576 TEST_F(WebFrameTest, DivAutoZoomMultipleDivsTest) | 2576 TEST_F(WebFrameTest, DivAutoZoomMultipleDivsTest) |
2577 { | 2577 { |
2578 registerMockedHttpURLLoad("get_multiple_divs_for_auto_zoom_test.html"); | 2578 registerMockedHttpURLLoad("get_multiple_divs_for_auto_zoom_test.html"); |
2579 | 2579 |
2580 const float deviceScaleFactor = 2.0f; | 2580 const float deviceScaleFactor = 2.0f; |
2581 int viewportWidth = 640 / deviceScaleFactor; | 2581 int viewportWidth = 640 / deviceScaleFactor; |
2582 int viewportHeight = 1280 / deviceScaleFactor; | 2582 int viewportHeight = 1280 / deviceScaleFactor; |
2583 float doubleTapZoomAlreadyLegibleRatio = 1.2f; | 2583 float doubleTapZoomAlreadyLegibleRatio = 1.2f; |
2584 FrameTestHelpers::WebViewHelper webViewHelper; | 2584 FrameTestHelpers::WebViewHelper webViewHelper; |
2585 webViewHelper.initializeAndLoad(m_baseURL + "get_multiple_divs_for_auto_zoom
_test.html", false, 0, 0, configureAndroid); | 2585 webViewHelper.initializeAndLoad(m_baseURL + "get_multiple_divs_for_auto_zoom
_test.html", false, nullptr, nullptr, nullptr, configureAndroid); |
2586 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); | 2586 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); |
2587 webViewHelper.webView()->setDefaultPageScaleLimits(0.5f, 4); | 2587 webViewHelper.webView()->setDefaultPageScaleLimits(0.5f, 4); |
2588 webViewHelper.webView()->setDeviceScaleFactor(deviceScaleFactor); | 2588 webViewHelper.webView()->setDeviceScaleFactor(deviceScaleFactor); |
2589 webViewHelper.webView()->setPageScaleFactor(0.5f); | 2589 webViewHelper.webView()->setPageScaleFactor(0.5f); |
2590 webViewHelper.webView()->setMaximumLegibleScale(1.f); | 2590 webViewHelper.webView()->setMaximumLegibleScale(1.f); |
2591 webViewHelper.webView()->updateAllLifecyclePhases(); | 2591 webViewHelper.webView()->updateAllLifecyclePhases(); |
2592 | 2592 |
2593 webViewHelper.webViewImpl()->enableFakePageScaleAnimationForTesting(true); | 2593 webViewHelper.webViewImpl()->enableFakePageScaleAnimationForTesting(true); |
2594 | 2594 |
2595 WebRect topDiv(200, 100, 200, 150); | 2595 WebRect topDiv(200, 100, 200, 150); |
(...skipping 28 matching lines...) Expand all Loading... |
2624 } | 2624 } |
2625 | 2625 |
2626 TEST_F(WebFrameTest, DivAutoZoomScaleBoundsTest) | 2626 TEST_F(WebFrameTest, DivAutoZoomScaleBoundsTest) |
2627 { | 2627 { |
2628 registerMockedHttpURLLoad("get_scale_bounds_check_for_auto_zoom_test.html"); | 2628 registerMockedHttpURLLoad("get_scale_bounds_check_for_auto_zoom_test.html"); |
2629 | 2629 |
2630 int viewportWidth = 320; | 2630 int viewportWidth = 320; |
2631 int viewportHeight = 480; | 2631 int viewportHeight = 480; |
2632 float doubleTapZoomAlreadyLegibleRatio = 1.2f; | 2632 float doubleTapZoomAlreadyLegibleRatio = 1.2f; |
2633 FrameTestHelpers::WebViewHelper webViewHelper; | 2633 FrameTestHelpers::WebViewHelper webViewHelper; |
2634 webViewHelper.initializeAndLoad(m_baseURL + "get_scale_bounds_check_for_auto
_zoom_test.html", false, 0, 0, configureAndroid); | 2634 webViewHelper.initializeAndLoad(m_baseURL + "get_scale_bounds_check_for_auto
_zoom_test.html", false, nullptr, nullptr, nullptr, configureAndroid); |
2635 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); | 2635 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); |
2636 webViewHelper.webView()->setDeviceScaleFactor(1.5f); | 2636 webViewHelper.webView()->setDeviceScaleFactor(1.5f); |
2637 webViewHelper.webView()->setMaximumLegibleScale(1.f); | 2637 webViewHelper.webView()->setMaximumLegibleScale(1.f); |
2638 webViewHelper.webView()->updateAllLifecyclePhases(); | 2638 webViewHelper.webView()->updateAllLifecyclePhases(); |
2639 | 2639 |
2640 webViewHelper.webViewImpl()->enableFakePageScaleAnimationForTesting(true); | 2640 webViewHelper.webViewImpl()->enableFakePageScaleAnimationForTesting(true); |
2641 | 2641 |
2642 WebRect div(200, 100, 200, 150); | 2642 WebRect div(200, 100, 200, 150); |
2643 WebPoint doubleTapPoint(div.x + 50, div.y + 50); | 2643 WebPoint doubleTapPoint(div.x + 50, div.y + 50); |
2644 float scale; | 2644 float scale; |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2687 | 2687 |
2688 TEST_F(WebFrameTest, DivAutoZoomScaleLegibleScaleTest) | 2688 TEST_F(WebFrameTest, DivAutoZoomScaleLegibleScaleTest) |
2689 { | 2689 { |
2690 registerMockedHttpURLLoad("get_scale_bounds_check_for_auto_zoom_test.html"); | 2690 registerMockedHttpURLLoad("get_scale_bounds_check_for_auto_zoom_test.html"); |
2691 | 2691 |
2692 int viewportWidth = 320; | 2692 int viewportWidth = 320; |
2693 int viewportHeight = 480; | 2693 int viewportHeight = 480; |
2694 float doubleTapZoomAlreadyLegibleRatio = 1.2f; | 2694 float doubleTapZoomAlreadyLegibleRatio = 1.2f; |
2695 float maximumLegibleScaleFactor = 1.13f; | 2695 float maximumLegibleScaleFactor = 1.13f; |
2696 FrameTestHelpers::WebViewHelper webViewHelper; | 2696 FrameTestHelpers::WebViewHelper webViewHelper; |
2697 webViewHelper.initializeAndLoad(m_baseURL + "get_scale_bounds_check_for_auto
_zoom_test.html", false, 0, 0, configureAndroid); | 2697 webViewHelper.initializeAndLoad(m_baseURL + "get_scale_bounds_check_for_auto
_zoom_test.html", false, nullptr, nullptr, nullptr, configureAndroid); |
2698 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); | 2698 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); |
2699 webViewHelper.webView()->setMaximumLegibleScale(maximumLegibleScaleFactor); | 2699 webViewHelper.webView()->setMaximumLegibleScale(maximumLegibleScaleFactor); |
2700 webViewHelper.webView()->updateAllLifecyclePhases(); | 2700 webViewHelper.webView()->updateAllLifecyclePhases(); |
2701 | 2701 |
2702 webViewHelper.webViewImpl()->enableFakePageScaleAnimationForTesting(true); | 2702 webViewHelper.webViewImpl()->enableFakePageScaleAnimationForTesting(true); |
2703 webViewHelper.webViewImpl()->page()->settings().setTextAutosizingEnabled(tru
e); | 2703 webViewHelper.webViewImpl()->page()->settings().setTextAutosizingEnabled(tru
e); |
2704 | 2704 |
2705 WebRect div(200, 100, 200, 150); | 2705 WebRect div(200, 100, 200, 150); |
2706 WebPoint doubleTapPoint(div.x + 50, div.y + 50); | 2706 WebPoint doubleTapPoint(div.x + 50, div.y + 50); |
2707 float scale; | 2707 float scale; |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2766 | 2766 |
2767 TEST_F(WebFrameTest, DivAutoZoomScaleFontScaleFactorTest) | 2767 TEST_F(WebFrameTest, DivAutoZoomScaleFontScaleFactorTest) |
2768 { | 2768 { |
2769 registerMockedHttpURLLoad("get_scale_bounds_check_for_auto_zoom_test.html"); | 2769 registerMockedHttpURLLoad("get_scale_bounds_check_for_auto_zoom_test.html"); |
2770 | 2770 |
2771 int viewportWidth = 320; | 2771 int viewportWidth = 320; |
2772 int viewportHeight = 480; | 2772 int viewportHeight = 480; |
2773 float doubleTapZoomAlreadyLegibleRatio = 1.2f; | 2773 float doubleTapZoomAlreadyLegibleRatio = 1.2f; |
2774 float accessibilityFontScaleFactor = 1.13f; | 2774 float accessibilityFontScaleFactor = 1.13f; |
2775 FrameTestHelpers::WebViewHelper webViewHelper; | 2775 FrameTestHelpers::WebViewHelper webViewHelper; |
2776 webViewHelper.initializeAndLoad(m_baseURL + "get_scale_bounds_check_for_auto
_zoom_test.html", false, 0, 0, configureAndroid); | 2776 webViewHelper.initializeAndLoad(m_baseURL + "get_scale_bounds_check_for_auto
_zoom_test.html", false, nullptr, nullptr, nullptr, configureAndroid); |
2777 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); | 2777 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); |
2778 webViewHelper.webView()->setMaximumLegibleScale(1.f); | 2778 webViewHelper.webView()->setMaximumLegibleScale(1.f); |
2779 webViewHelper.webView()->updateAllLifecyclePhases(); | 2779 webViewHelper.webView()->updateAllLifecyclePhases(); |
2780 | 2780 |
2781 webViewHelper.webViewImpl()->enableFakePageScaleAnimationForTesting(true); | 2781 webViewHelper.webViewImpl()->enableFakePageScaleAnimationForTesting(true); |
2782 webViewHelper.webViewImpl()->page()->settings().setTextAutosizingEnabled(tru
e); | 2782 webViewHelper.webViewImpl()->page()->settings().setTextAutosizingEnabled(tru
e); |
2783 webViewHelper.webViewImpl()->page()->settings().setAccessibilityFontScaleFac
tor(accessibilityFontScaleFactor); | 2783 webViewHelper.webViewImpl()->page()->settings().setAccessibilityFontScaleFac
tor(accessibilityFontScaleFactor); |
2784 | 2784 |
2785 WebRect div(200, 100, 200, 150); | 2785 WebRect div(200, 100, 200, 150); |
2786 WebPoint doubleTapPoint(div.x + 50, div.y + 50); | 2786 WebPoint doubleTapPoint(div.x + 50, div.y + 50); |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2841 EXPECT_FLOAT_EQ(webViewHelper.webViewImpl()->minimumPageScaleFactor(), scale
); | 2841 EXPECT_FLOAT_EQ(webViewHelper.webViewImpl()->minimumPageScaleFactor(), scale
); |
2842 simulateDoubleTap(webViewHelper.webViewImpl(), doubleTapPoint, scale); | 2842 simulateDoubleTap(webViewHelper.webViewImpl(), doubleTapPoint, scale); |
2843 EXPECT_FLOAT_EQ(legibleScale, scale); | 2843 EXPECT_FLOAT_EQ(legibleScale, scale); |
2844 } | 2844 } |
2845 | 2845 |
2846 TEST_P(ParameterizedWebFrameTest, BlockBoundTest) | 2846 TEST_P(ParameterizedWebFrameTest, BlockBoundTest) |
2847 { | 2847 { |
2848 registerMockedHttpURLLoad("block_bound.html"); | 2848 registerMockedHttpURLLoad("block_bound.html"); |
2849 | 2849 |
2850 FrameTestHelpers::WebViewHelper webViewHelper(this); | 2850 FrameTestHelpers::WebViewHelper webViewHelper(this); |
2851 webViewHelper.initializeAndLoad(m_baseURL + "block_bound.html", false, 0, 0,
configureAndroid); | 2851 webViewHelper.initializeAndLoad(m_baseURL + "block_bound.html", false, nullp
tr, nullptr, nullptr, configureAndroid); |
2852 | 2852 |
2853 IntRect rectBack = IntRect(0, 0, 200, 200); | 2853 IntRect rectBack = IntRect(0, 0, 200, 200); |
2854 IntRect rectLeftTop = IntRect(10, 10, 80, 80); | 2854 IntRect rectLeftTop = IntRect(10, 10, 80, 80); |
2855 IntRect rectRightBottom = IntRect(110, 110, 80, 80); | 2855 IntRect rectRightBottom = IntRect(110, 110, 80, 80); |
2856 IntRect blockBound; | 2856 IntRect blockBound; |
2857 | 2857 |
2858 blockBound = IntRect(webViewHelper.webViewImpl()->computeBlockBound(WebPoint
(9, 9), true)); | 2858 blockBound = IntRect(webViewHelper.webViewImpl()->computeBlockBound(WebPoint
(9, 9), true)); |
2859 EXPECT_RECT_EQ(rectBack, blockBound); | 2859 EXPECT_RECT_EQ(rectBack, blockBound); |
2860 | 2860 |
2861 blockBound = IntRect(webViewHelper.webViewImpl()->computeBlockBound(WebPoint
(10, 10), true)); | 2861 blockBound = IntRect(webViewHelper.webViewImpl()->computeBlockBound(WebPoint
(10, 10), true)); |
(...skipping 1760 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4622 }; | 4622 }; |
4623 | 4623 |
4624 class CompositedSelectionBoundsTest : public WebFrameTest { | 4624 class CompositedSelectionBoundsTest : public WebFrameTest { |
4625 protected: | 4625 protected: |
4626 CompositedSelectionBoundsTest() | 4626 CompositedSelectionBoundsTest() |
4627 : m_fakeSelectionLayerTreeView(m_fakeSelectionWebViewClient.selectionLay
erTreeView()) | 4627 : m_fakeSelectionLayerTreeView(m_fakeSelectionWebViewClient.selectionLay
erTreeView()) |
4628 { | 4628 { |
4629 RuntimeEnabledFeatures::setCompositedSelectionUpdateEnabled(true); | 4629 RuntimeEnabledFeatures::setCompositedSelectionUpdateEnabled(true); |
4630 registerMockedHttpURLLoad("Ahem.ttf"); | 4630 registerMockedHttpURLLoad("Ahem.ttf"); |
4631 | 4631 |
4632 m_webViewHelper.initialize(true, 0, &m_fakeSelectionWebViewClient); | 4632 m_webViewHelper.initialize(true, nullptr, &m_fakeSelectionWebViewClient,
nullptr); |
4633 m_webViewHelper.webView()->settings()->setDefaultFontSize(12); | 4633 m_webViewHelper.webView()->settings()->setDefaultFontSize(12); |
4634 m_webViewHelper.webView()->setDefaultPageScaleLimits(1, 1); | 4634 m_webViewHelper.webView()->setDefaultPageScaleLimits(1, 1); |
4635 m_webViewHelper.resize(WebSize(640, 480)); | 4635 m_webViewHelper.resize(WebSize(640, 480)); |
4636 } | 4636 } |
4637 | 4637 |
4638 void runTest(const char* testFile) | 4638 void runTest(const char* testFile) |
4639 { | 4639 { |
4640 registerMockedHttpURLLoad(testFile); | 4640 registerMockedHttpURLLoad(testFile); |
4641 m_webViewHelper.webView()->setFocus(true); | 4641 m_webViewHelper.webView()->setFocus(true); |
4642 FrameTestHelpers::loadFrame(m_webViewHelper.webView()->mainFrame(), m_ba
seURL + testFile); | 4642 FrameTestHelpers::loadFrame(m_webViewHelper.webView()->mainFrame(), m_ba
seURL + testFile); |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4741 registerMockedHttpURLLoad("select_range_basic.html"); | 4741 registerMockedHttpURLLoad("select_range_basic.html"); |
4742 registerMockedHttpURLLoad("select_range_scroll.html"); | 4742 registerMockedHttpURLLoad("select_range_scroll.html"); |
4743 | 4743 |
4744 int viewWidth = 500; | 4744 int viewWidth = 500; |
4745 int viewHeight = 500; | 4745 int viewHeight = 500; |
4746 | 4746 |
4747 CompositedSelectionBoundsTestWebViewClient fakeSelectionWebViewClient; | 4747 CompositedSelectionBoundsTestWebViewClient fakeSelectionWebViewClient; |
4748 CompositedSelectionBoundsTestLayerTreeView& fakeSelectionLayerTreeView = fak
eSelectionWebViewClient.selectionLayerTreeView(); | 4748 CompositedSelectionBoundsTestLayerTreeView& fakeSelectionLayerTreeView = fak
eSelectionWebViewClient.selectionLayerTreeView(); |
4749 | 4749 |
4750 FrameTestHelpers::WebViewHelper webViewHelper(this); | 4750 FrameTestHelpers::WebViewHelper webViewHelper(this); |
4751 webViewHelper.initialize(true, 0, &fakeSelectionWebViewClient); | 4751 webViewHelper.initialize(true, nullptr, &fakeSelectionWebViewClient, nullptr
); |
4752 webViewHelper.webView()->settings()->setDefaultFontSize(12); | 4752 webViewHelper.webView()->settings()->setDefaultFontSize(12); |
4753 webViewHelper.webView()->setDefaultPageScaleLimits(1, 1); | 4753 webViewHelper.webView()->setDefaultPageScaleLimits(1, 1); |
4754 webViewHelper.resize(WebSize(viewWidth, viewHeight)); | 4754 webViewHelper.resize(WebSize(viewWidth, viewHeight)); |
4755 webViewHelper.webView()->setFocus(true); | 4755 webViewHelper.webView()->setFocus(true); |
4756 FrameTestHelpers::loadFrame(webViewHelper.webView()->mainFrame(), m_baseURL
+ "select_range_basic.html"); | 4756 FrameTestHelpers::loadFrame(webViewHelper.webView()->mainFrame(), m_baseURL
+ "select_range_basic.html"); |
4757 | 4757 |
4758 // The frame starts with no selection. | 4758 // The frame starts with no selection. |
4759 WebFrame* frame = webViewHelper.webView()->mainFrame(); | 4759 WebFrame* frame = webViewHelper.webView()->mainFrame(); |
4760 ASSERT_TRUE(frame->hasSelection()); | 4760 ASSERT_TRUE(frame->hasSelection()); |
4761 EXPECT_TRUE(fakeSelectionLayerTreeView.getAndResetSelectionCleared()); | 4761 EXPECT_TRUE(fakeSelectionLayerTreeView.getAndResetSelectionCleared()); |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4894 TEST_P(ParameterizedWebFrameTest, DisambiguationPopupMobileSite) | 4894 TEST_P(ParameterizedWebFrameTest, DisambiguationPopupMobileSite) |
4895 { | 4895 { |
4896 const std::string htmlFile = "disambiguation_popup_mobile_site.html"; | 4896 const std::string htmlFile = "disambiguation_popup_mobile_site.html"; |
4897 registerMockedHttpURLLoad(htmlFile); | 4897 registerMockedHttpURLLoad(htmlFile); |
4898 | 4898 |
4899 DisambiguationPopupTestWebViewClient client; | 4899 DisambiguationPopupTestWebViewClient client; |
4900 | 4900 |
4901 // Make sure we initialize to minimum scale, even if the window size | 4901 // Make sure we initialize to minimum scale, even if the window size |
4902 // only becomes available after the load begins. | 4902 // only becomes available after the load begins. |
4903 FrameTestHelpers::WebViewHelper webViewHelper(this); | 4903 FrameTestHelpers::WebViewHelper webViewHelper(this); |
4904 webViewHelper.initializeAndLoad(m_baseURL + htmlFile, true, 0, &client, enab
leViewportSettings); | 4904 webViewHelper.initializeAndLoad(m_baseURL + htmlFile, true, nullptr, &client
, nullptr, enableViewportSettings); |
4905 webViewHelper.resize(WebSize(1000, 1000)); | 4905 webViewHelper.resize(WebSize(1000, 1000)); |
4906 | 4906 |
4907 client.resetTriggered(); | 4907 client.resetTriggered(); |
4908 webViewHelper.webView()->handleInputEvent(fatTap(0, 0)); | 4908 webViewHelper.webView()->handleInputEvent(fatTap(0, 0)); |
4909 EXPECT_FALSE(client.triggered()); | 4909 EXPECT_FALSE(client.triggered()); |
4910 | 4910 |
4911 client.resetTriggered(); | 4911 client.resetTriggered(); |
4912 webViewHelper.webView()->handleInputEvent(fatTap(200, 115)); | 4912 webViewHelper.webView()->handleInputEvent(fatTap(200, 115)); |
4913 EXPECT_FALSE(client.triggered()); | 4913 EXPECT_FALSE(client.triggered()); |
4914 | 4914 |
(...skipping 13 matching lines...) Expand all Loading... |
4928 TEST_P(ParameterizedWebFrameTest, DisambiguationPopupViewportSite) | 4928 TEST_P(ParameterizedWebFrameTest, DisambiguationPopupViewportSite) |
4929 { | 4929 { |
4930 const std::string htmlFile = "disambiguation_popup_viewport_site.html"; | 4930 const std::string htmlFile = "disambiguation_popup_viewport_site.html"; |
4931 registerMockedHttpURLLoad(htmlFile); | 4931 registerMockedHttpURLLoad(htmlFile); |
4932 | 4932 |
4933 DisambiguationPopupTestWebViewClient client; | 4933 DisambiguationPopupTestWebViewClient client; |
4934 | 4934 |
4935 // Make sure we initialize to minimum scale, even if the window size | 4935 // Make sure we initialize to minimum scale, even if the window size |
4936 // only becomes available after the load begins. | 4936 // only becomes available after the load begins. |
4937 FrameTestHelpers::WebViewHelper webViewHelper(this); | 4937 FrameTestHelpers::WebViewHelper webViewHelper(this); |
4938 webViewHelper.initializeAndLoad(m_baseURL + htmlFile, true, 0, &client, enab
leViewportSettings); | 4938 webViewHelper.initializeAndLoad(m_baseURL + htmlFile, true, nullptr, &client
, nullptr, enableViewportSettings); |
4939 webViewHelper.resize(WebSize(1000, 1000)); | 4939 webViewHelper.resize(WebSize(1000, 1000)); |
4940 | 4940 |
4941 client.resetTriggered(); | 4941 client.resetTriggered(); |
4942 webViewHelper.webView()->handleInputEvent(fatTap(0, 0)); | 4942 webViewHelper.webView()->handleInputEvent(fatTap(0, 0)); |
4943 EXPECT_FALSE(client.triggered()); | 4943 EXPECT_FALSE(client.triggered()); |
4944 | 4944 |
4945 client.resetTriggered(); | 4945 client.resetTriggered(); |
4946 webViewHelper.webView()->handleInputEvent(fatTap(200, 115)); | 4946 webViewHelper.webView()->handleInputEvent(fatTap(200, 115)); |
4947 EXPECT_FALSE(client.triggered()); | 4947 EXPECT_FALSE(client.triggered()); |
4948 | 4948 |
(...skipping 11 matching lines...) Expand all Loading... |
4960 } | 4960 } |
4961 | 4961 |
4962 TEST_F(WebFrameTest, DisambiguationPopupVisualViewport) | 4962 TEST_F(WebFrameTest, DisambiguationPopupVisualViewport) |
4963 { | 4963 { |
4964 const std::string htmlFile = "disambiguation_popup_200_by_800.html"; | 4964 const std::string htmlFile = "disambiguation_popup_200_by_800.html"; |
4965 registerMockedHttpURLLoad(htmlFile); | 4965 registerMockedHttpURLLoad(htmlFile); |
4966 | 4966 |
4967 DisambiguationPopupTestWebViewClient client; | 4967 DisambiguationPopupTestWebViewClient client; |
4968 | 4968 |
4969 FrameTestHelpers::WebViewHelper webViewHelper; | 4969 FrameTestHelpers::WebViewHelper webViewHelper; |
4970 webViewHelper.initializeAndLoad(m_baseURL + htmlFile, true, 0, &client, conf
igureAndroid); | 4970 webViewHelper.initializeAndLoad(m_baseURL + htmlFile, true, nullptr, &client
, nullptr, configureAndroid); |
4971 | 4971 |
4972 WebViewImpl* webViewImpl = webViewHelper.webViewImpl(); | 4972 WebViewImpl* webViewImpl = webViewHelper.webViewImpl(); |
4973 ASSERT_TRUE(webViewImpl); | 4973 ASSERT_TRUE(webViewImpl); |
4974 LocalFrame* frame = webViewImpl->mainFrameImpl()->frame(); | 4974 LocalFrame* frame = webViewImpl->mainFrameImpl()->frame(); |
4975 ASSERT_TRUE(frame); | 4975 ASSERT_TRUE(frame); |
4976 | 4976 |
4977 webViewHelper.resize(WebSize(100, 200)); | 4977 webViewHelper.resize(WebSize(100, 200)); |
4978 | 4978 |
4979 // Scroll main frame to the bottom of the document | 4979 // Scroll main frame to the bottom of the document |
4980 webViewImpl->mainFrame()->setScrollOffset(WebSize(0, 400)); | 4980 webViewImpl->mainFrame()->setScrollOffset(WebSize(0, 400)); |
(...skipping 1106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6087 private: | 6087 private: |
6088 int m_numOfImageRequests; | 6088 int m_numOfImageRequests; |
6089 }; | 6089 }; |
6090 | 6090 |
6091 TEST_P(ParameterizedWebFrameTest, NavigateToSameNoConditionalRequestForSubresour
ce) | 6091 TEST_P(ParameterizedWebFrameTest, NavigateToSameNoConditionalRequestForSubresour
ce) |
6092 { | 6092 { |
6093 registerMockedHttpURLLoad("foo_with_image.html"); | 6093 registerMockedHttpURLLoad("foo_with_image.html"); |
6094 registerMockedHttpURLLoad("white-1x1.png"); | 6094 registerMockedHttpURLLoad("white-1x1.png"); |
6095 TestSameDocumentWithImageWebFrameClient client; | 6095 TestSameDocumentWithImageWebFrameClient client; |
6096 FrameTestHelpers::WebViewHelper webViewHelper(this); | 6096 FrameTestHelpers::WebViewHelper webViewHelper(this); |
6097 webViewHelper.initializeAndLoad(m_baseURL + "foo_with_image.html", true, &cl
ient, 0, &configureLoadsImagesAutomatically); | 6097 webViewHelper.initializeAndLoad(m_baseURL + "foo_with_image.html", true, &cl
ient, nullptr, nullptr, &configureLoadsImagesAutomatically); |
6098 | 6098 |
6099 WebCache::clear(); | 6099 WebCache::clear(); |
6100 FrameTestHelpers::loadFrame(webViewHelper.webView()->mainFrame(), m_baseURL
+ "foo_with_image.html"); | 6100 FrameTestHelpers::loadFrame(webViewHelper.webView()->mainFrame(), m_baseURL
+ "foo_with_image.html"); |
6101 | 6101 |
6102 EXPECT_EQ(client.numOfImageRequests(), 2); | 6102 EXPECT_EQ(client.numOfImageRequests(), 2); |
6103 } | 6103 } |
6104 | 6104 |
6105 TEST_P(ParameterizedWebFrameTest, WebNodeImageContents) | 6105 TEST_P(ParameterizedWebFrameTest, WebNodeImageContents) |
6106 { | 6106 { |
6107 FrameTestHelpers::WebViewHelper webViewHelper(this); | 6107 FrameTestHelpers::WebViewHelper webViewHelper(this); |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6289 EXPECT_EQ(url2, iframe->document().url().string().utf8()); | 6289 EXPECT_EQ(url2, iframe->document().url().string().utf8()); |
6290 EXPECT_FALSE(client.replacesCurrentHistoryItem()); | 6290 EXPECT_FALSE(client.replacesCurrentHistoryItem()); |
6291 } | 6291 } |
6292 | 6292 |
6293 // Test verifies that layout will change a layer's scrollable attibutes | 6293 // Test verifies that layout will change a layer's scrollable attibutes |
6294 TEST_F(WebFrameTest, overflowHiddenRewrite) | 6294 TEST_F(WebFrameTest, overflowHiddenRewrite) |
6295 { | 6295 { |
6296 registerMockedHttpURLLoad("non-scrollable.html"); | 6296 registerMockedHttpURLLoad("non-scrollable.html"); |
6297 OwnPtr<FakeCompositingWebViewClient> fakeCompositingWebViewClient = adoptPtr
(new FakeCompositingWebViewClient()); | 6297 OwnPtr<FakeCompositingWebViewClient> fakeCompositingWebViewClient = adoptPtr
(new FakeCompositingWebViewClient()); |
6298 FrameTestHelpers::WebViewHelper webViewHelper; | 6298 FrameTestHelpers::WebViewHelper webViewHelper; |
6299 webViewHelper.initialize(true, 0, fakeCompositingWebViewClient.get(), &confi
gueCompositingWebView); | 6299 webViewHelper.initialize(true, nullptr, fakeCompositingWebViewClient.get(),
nullptr, &configueCompositingWebView); |
6300 | 6300 |
6301 webViewHelper.resize(WebSize(100, 100)); | 6301 webViewHelper.resize(WebSize(100, 100)); |
6302 FrameTestHelpers::loadFrame(webViewHelper.webView()->mainFrame(), m_baseURL
+ "non-scrollable.html"); | 6302 FrameTestHelpers::loadFrame(webViewHelper.webView()->mainFrame(), m_baseURL
+ "non-scrollable.html"); |
6303 | 6303 |
6304 PaintLayerCompositor* compositor = webViewHelper.webViewImpl()->compositor(
); | 6304 PaintLayerCompositor* compositor = webViewHelper.webViewImpl()->compositor(
); |
6305 ASSERT_TRUE(compositor->scrollLayer()); | 6305 ASSERT_TRUE(compositor->scrollLayer()); |
6306 | 6306 |
6307 // Verify that the WebLayer is not scrollable initially. | 6307 // Verify that the WebLayer is not scrollable initially. |
6308 GraphicsLayer* scrollLayer = compositor->scrollLayer(); | 6308 GraphicsLayer* scrollLayer = compositor->scrollLayer(); |
6309 WebLayer* webScrollLayer = scrollLayer->platformLayer(); | 6309 WebLayer* webScrollLayer = scrollLayer->platformLayer(); |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6368 FrameTestHelpers::WebViewHelper webViewHelper(this); | 6368 FrameTestHelpers::WebViewHelper webViewHelper(this); |
6369 webViewHelper.initializeAndLoad(m_baseURL + "create_child_frame_fail.html",
true, &client); | 6369 webViewHelper.initializeAndLoad(m_baseURL + "create_child_frame_fail.html",
true, &client); |
6370 | 6370 |
6371 EXPECT_EQ(1, client.callCount()); | 6371 EXPECT_EQ(1, client.callCount()); |
6372 } | 6372 } |
6373 | 6373 |
6374 TEST_P(ParameterizedWebFrameTest, fixedPositionInFixedViewport) | 6374 TEST_P(ParameterizedWebFrameTest, fixedPositionInFixedViewport) |
6375 { | 6375 { |
6376 registerMockedHttpURLLoad("fixed-position-in-fixed-viewport.html"); | 6376 registerMockedHttpURLLoad("fixed-position-in-fixed-viewport.html"); |
6377 FrameTestHelpers::WebViewHelper webViewHelper(this); | 6377 FrameTestHelpers::WebViewHelper webViewHelper(this); |
6378 webViewHelper.initializeAndLoad(m_baseURL + "fixed-position-in-fixed-viewpor
t.html", true, 0, 0, enableViewportSettings); | 6378 webViewHelper.initializeAndLoad(m_baseURL + "fixed-position-in-fixed-viewpor
t.html", true, nullptr, nullptr, nullptr, enableViewportSettings); |
6379 | 6379 |
6380 WebView* webView = webViewHelper.webView(); | 6380 WebView* webView = webViewHelper.webView(); |
6381 webViewHelper.resize(WebSize(100, 100)); | 6381 webViewHelper.resize(WebSize(100, 100)); |
6382 | 6382 |
6383 Document* document = toWebLocalFrameImpl(webView->mainFrame())->frame()->doc
ument(); | 6383 Document* document = toWebLocalFrameImpl(webView->mainFrame())->frame()->doc
ument(); |
6384 Element* bottomFixed = document->getElementById("bottom-fixed"); | 6384 Element* bottomFixed = document->getElementById("bottom-fixed"); |
6385 Element* topBottomFixed = document->getElementById("top-bottom-fixed"); | 6385 Element* topBottomFixed = document->getElementById("top-bottom-fixed"); |
6386 Element* rightFixed = document->getElementById("right-fixed"); | 6386 Element* rightFixed = document->getElementById("right-fixed"); |
6387 Element* leftRightFixed = document->getElementById("left-right-fixed"); | 6387 Element* leftRightFixed = document->getElementById("left-right-fixed"); |
6388 | 6388 |
(...skipping 19 matching lines...) Expand all Loading... |
6408 EXPECT_RECT_EQ(IntRect(0, 0, 200, 200), frameView->frameRect()); | 6408 EXPECT_RECT_EQ(IntRect(0, 0, 200, 200), frameView->frameRect()); |
6409 frameView->setFrameRect(IntRect(100, 100, 200, 200)); | 6409 frameView->setFrameRect(IntRect(100, 100, 200, 200)); |
6410 EXPECT_RECT_EQ(IntRect(100, 100, 200, 200), frameView->frameRect()); | 6410 EXPECT_RECT_EQ(IntRect(100, 100, 200, 200), frameView->frameRect()); |
6411 } | 6411 } |
6412 | 6412 |
6413 TEST_F(WebFrameTest, FrameViewScrollAccountsForTopControls) | 6413 TEST_F(WebFrameTest, FrameViewScrollAccountsForTopControls) |
6414 { | 6414 { |
6415 FakeCompositingWebViewClient client; | 6415 FakeCompositingWebViewClient client; |
6416 registerMockedHttpURLLoad("long_scroll.html"); | 6416 registerMockedHttpURLLoad("long_scroll.html"); |
6417 FrameTestHelpers::WebViewHelper webViewHelper; | 6417 FrameTestHelpers::WebViewHelper webViewHelper; |
6418 webViewHelper.initializeAndLoad(m_baseURL + "long_scroll.html", true, 0, &cl
ient, configureAndroid); | 6418 webViewHelper.initializeAndLoad(m_baseURL + "long_scroll.html", true, nullpt
r, &client, nullptr, configureAndroid); |
6419 | 6419 |
6420 WebViewImpl* webView = webViewHelper.webViewImpl(); | 6420 WebViewImpl* webView = webViewHelper.webViewImpl(); |
6421 FrameView* frameView = webViewHelper.webViewImpl()->mainFrameImpl()->frameVi
ew(); | 6421 FrameView* frameView = webViewHelper.webViewImpl()->mainFrameImpl()->frameVi
ew(); |
6422 | 6422 |
6423 float topControlsHeight = 40; | 6423 float topControlsHeight = 40; |
6424 webView->resizeWithTopControls(WebSize(100, 100), topControlsHeight, false); | 6424 webView->resizeWithTopControls(WebSize(100, 100), topControlsHeight, false); |
6425 webView->setPageScaleFactor(2.0f); | 6425 webView->setPageScaleFactor(2.0f); |
6426 webView->updateAllLifecyclePhases(); | 6426 webView->updateAllLifecyclePhases(); |
6427 | 6427 |
6428 webView->mainFrame()->setScrollOffset(WebSize(0, 2000)); | 6428 webView->mainFrame()->setScrollOffset(WebSize(0, 2000)); |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6474 TEST_F(WebFrameTest, MaximumScrollPositionCanBeNegative) | 6474 TEST_F(WebFrameTest, MaximumScrollPositionCanBeNegative) |
6475 { | 6475 { |
6476 registerMockedHttpURLLoad("rtl-overview-mode.html"); | 6476 registerMockedHttpURLLoad("rtl-overview-mode.html"); |
6477 | 6477 |
6478 FixedLayoutTestWebViewClient client; | 6478 FixedLayoutTestWebViewClient client; |
6479 client.m_screenInfo.deviceScaleFactor = 1; | 6479 client.m_screenInfo.deviceScaleFactor = 1; |
6480 int viewportWidth = 640; | 6480 int viewportWidth = 640; |
6481 int viewportHeight = 480; | 6481 int viewportHeight = 480; |
6482 | 6482 |
6483 FrameTestHelpers::WebViewHelper webViewHelper; | 6483 FrameTestHelpers::WebViewHelper webViewHelper; |
6484 webViewHelper.initializeAndLoad(m_baseURL + "rtl-overview-mode.html", true,
0, &client, enableViewportSettings); | 6484 webViewHelper.initializeAndLoad(m_baseURL + "rtl-overview-mode.html", true,
nullptr, &client, nullptr, enableViewportSettings); |
6485 webViewHelper.webView()->setInitialPageScaleOverride(-1); | 6485 webViewHelper.webView()->setInitialPageScaleOverride(-1); |
6486 webViewHelper.webView()->settings()->setWideViewportQuirkEnabled(true); | 6486 webViewHelper.webView()->settings()->setWideViewportQuirkEnabled(true); |
6487 webViewHelper.webView()->settings()->setLoadWithOverviewMode(true); | 6487 webViewHelper.webView()->settings()->setLoadWithOverviewMode(true); |
6488 webViewHelper.webView()->settings()->setUseWideViewport(true); | 6488 webViewHelper.webView()->settings()->setUseWideViewport(true); |
6489 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); | 6489 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); |
6490 webViewHelper.webView()->updateAllLifecyclePhases(); | 6490 webViewHelper.webView()->updateAllLifecyclePhases(); |
6491 | 6491 |
6492 FrameView* frameView = webViewHelper.webViewImpl()->mainFrameImpl()->frameVi
ew(); | 6492 FrameView* frameView = webViewHelper.webViewImpl()->mainFrameImpl()->frameVi
ew(); |
6493 EXPECT_LT(frameView->maximumScrollPosition().x(), 0); | 6493 EXPECT_LT(frameView->maximumScrollPosition().x(), 0); |
6494 } | 6494 } |
6495 | 6495 |
6496 TEST_P(ParameterizedWebFrameTest, FullscreenLayerSize) | 6496 TEST_P(ParameterizedWebFrameTest, FullscreenLayerSize) |
6497 { | 6497 { |
6498 FakeCompositingWebViewClient client; | 6498 FakeCompositingWebViewClient client; |
6499 registerMockedHttpURLLoad("fullscreen_div.html"); | 6499 registerMockedHttpURLLoad("fullscreen_div.html"); |
6500 FrameTestHelpers::WebViewHelper webViewHelper(this); | 6500 FrameTestHelpers::WebViewHelper webViewHelper(this); |
6501 int viewportWidth = 640; | 6501 int viewportWidth = 640; |
6502 int viewportHeight = 480; | 6502 int viewportHeight = 480; |
6503 client.m_screenInfo.rect.width = viewportWidth; | 6503 client.m_screenInfo.rect.width = viewportWidth; |
6504 client.m_screenInfo.rect.height = viewportHeight; | 6504 client.m_screenInfo.rect.height = viewportHeight; |
6505 WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad(m_baseURL + "full
screen_div.html", true, 0, &client, configureAndroid); | 6505 WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad(m_baseURL + "full
screen_div.html", true, nullptr, &client, nullptr, configureAndroid); |
6506 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); | 6506 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); |
6507 webViewImpl->updateAllLifecyclePhases(); | 6507 webViewImpl->updateAllLifecyclePhases(); |
6508 | 6508 |
6509 Document* document = toWebLocalFrameImpl(webViewImpl->mainFrame())->frame()-
>document(); | 6509 Document* document = toWebLocalFrameImpl(webViewImpl->mainFrame())->frame()-
>document(); |
6510 UserGestureIndicator gesture(DefinitelyProcessingUserGesture); | 6510 UserGestureIndicator gesture(DefinitelyProcessingUserGesture); |
6511 Element* divFullscreen = document->getElementById("div1"); | 6511 Element* divFullscreen = document->getElementById("div1"); |
6512 Fullscreen::from(*document).requestFullscreen(*divFullscreen, Fullscreen::Pr
efixedRequest); | 6512 Fullscreen::from(*document).requestFullscreen(*divFullscreen, Fullscreen::Pr
efixedRequest); |
6513 webViewImpl->didEnterFullScreen(); | 6513 webViewImpl->didEnterFullScreen(); |
6514 webViewImpl->updateAllLifecyclePhases(); | 6514 webViewImpl->updateAllLifecyclePhases(); |
6515 ASSERT_TRUE(Fullscreen::isFullScreen(*document)); | 6515 ASSERT_TRUE(Fullscreen::isFullScreen(*document)); |
(...skipping 12 matching lines...) Expand all Loading... |
6528 EXPECT_EQ(viewportWidth, fullscreenLayoutObject->logicalHeight().toInt()); | 6528 EXPECT_EQ(viewportWidth, fullscreenLayoutObject->logicalHeight().toInt()); |
6529 } | 6529 } |
6530 | 6530 |
6531 TEST_F(WebFrameTest, FullscreenLayerNonScrollable) | 6531 TEST_F(WebFrameTest, FullscreenLayerNonScrollable) |
6532 { | 6532 { |
6533 FakeCompositingWebViewClient client; | 6533 FakeCompositingWebViewClient client; |
6534 registerMockedHttpURLLoad("fullscreen_div.html"); | 6534 registerMockedHttpURLLoad("fullscreen_div.html"); |
6535 FrameTestHelpers::WebViewHelper webViewHelper; | 6535 FrameTestHelpers::WebViewHelper webViewHelper; |
6536 int viewportWidth = 640; | 6536 int viewportWidth = 640; |
6537 int viewportHeight = 480; | 6537 int viewportHeight = 480; |
6538 WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad(m_baseURL + "full
screen_div.html", true, 0, &client, configureAndroid); | 6538 WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad(m_baseURL + "full
screen_div.html", true, nullptr, &client, nullptr, configureAndroid); |
6539 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); | 6539 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); |
6540 webViewImpl->updateAllLifecyclePhases(); | 6540 webViewImpl->updateAllLifecyclePhases(); |
6541 | 6541 |
6542 Document* document = toWebLocalFrameImpl(webViewImpl->mainFrame())->frame()-
>document(); | 6542 Document* document = toWebLocalFrameImpl(webViewImpl->mainFrame())->frame()-
>document(); |
6543 UserGestureIndicator gesture(DefinitelyProcessingUserGesture); | 6543 UserGestureIndicator gesture(DefinitelyProcessingUserGesture); |
6544 Element* divFullscreen = document->getElementById("div1"); | 6544 Element* divFullscreen = document->getElementById("div1"); |
6545 Fullscreen::from(*document).requestFullscreen(*divFullscreen, Fullscreen::Pr
efixedRequest); | 6545 Fullscreen::from(*document).requestFullscreen(*divFullscreen, Fullscreen::Pr
efixedRequest); |
6546 webViewImpl->didEnterFullScreen(); | 6546 webViewImpl->didEnterFullScreen(); |
6547 webViewImpl->updateAllLifecyclePhases(); | 6547 webViewImpl->updateAllLifecyclePhases(); |
6548 | 6548 |
(...skipping 17 matching lines...) Expand all Loading... |
6566 ASSERT_TRUE(visualViewportScrollLayer->userScrollableVertical()); | 6566 ASSERT_TRUE(visualViewportScrollLayer->userScrollableVertical()); |
6567 } | 6567 } |
6568 | 6568 |
6569 TEST_P(ParameterizedWebFrameTest, FullscreenMainFrame) | 6569 TEST_P(ParameterizedWebFrameTest, FullscreenMainFrame) |
6570 { | 6570 { |
6571 FakeCompositingWebViewClient client; | 6571 FakeCompositingWebViewClient client; |
6572 registerMockedHttpURLLoad("fullscreen_div.html"); | 6572 registerMockedHttpURLLoad("fullscreen_div.html"); |
6573 FrameTestHelpers::WebViewHelper webViewHelper(this); | 6573 FrameTestHelpers::WebViewHelper webViewHelper(this); |
6574 int viewportWidth = 640; | 6574 int viewportWidth = 640; |
6575 int viewportHeight = 480; | 6575 int viewportHeight = 480; |
6576 WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad(m_baseURL + "full
screen_div.html", true, 0, &client, configureAndroid); | 6576 WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad(m_baseURL + "full
screen_div.html", true, nullptr, &client, nullptr, configureAndroid); |
6577 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); | 6577 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); |
6578 webViewImpl->updateAllLifecyclePhases(); | 6578 webViewImpl->updateAllLifecyclePhases(); |
6579 | 6579 |
6580 Document* document = toWebLocalFrameImpl(webViewImpl->mainFrame())->frame()-
>document(); | 6580 Document* document = toWebLocalFrameImpl(webViewImpl->mainFrame())->frame()-
>document(); |
6581 UserGestureIndicator gesture(DefinitelyProcessingUserGesture); | 6581 UserGestureIndicator gesture(DefinitelyProcessingUserGesture); |
6582 Fullscreen::from(*document).requestFullscreen(*document->documentElement(),
Fullscreen::PrefixedRequest); | 6582 Fullscreen::from(*document).requestFullscreen(*document->documentElement(),
Fullscreen::PrefixedRequest); |
6583 webViewImpl->didEnterFullScreen(); | 6583 webViewImpl->didEnterFullScreen(); |
6584 webViewImpl->updateAllLifecyclePhases(); | 6584 webViewImpl->updateAllLifecyclePhases(); |
6585 | 6585 |
6586 // Verify that the main frame is still scrollable. | 6586 // Verify that the main frame is still scrollable. |
6587 ASSERT_TRUE(Fullscreen::isFullScreen(*document)); | 6587 ASSERT_TRUE(Fullscreen::isFullScreen(*document)); |
6588 WebLayer* webScrollLayer = webViewImpl->compositor()->scrollLayer()->platfor
mLayer(); | 6588 WebLayer* webScrollLayer = webViewImpl->compositor()->scrollLayer()->platfor
mLayer(); |
6589 ASSERT_TRUE(webScrollLayer->scrollable()); | 6589 ASSERT_TRUE(webScrollLayer->scrollable()); |
6590 ASSERT_TRUE(webScrollLayer->userScrollableHorizontal()); | 6590 ASSERT_TRUE(webScrollLayer->userScrollableHorizontal()); |
6591 ASSERT_TRUE(webScrollLayer->userScrollableVertical()); | 6591 ASSERT_TRUE(webScrollLayer->userScrollableVertical()); |
6592 | 6592 |
6593 // Verify the main frame still behaves correctly after a resize. | 6593 // Verify the main frame still behaves correctly after a resize. |
6594 webViewHelper.resize(WebSize(viewportHeight, viewportWidth)); | 6594 webViewHelper.resize(WebSize(viewportHeight, viewportWidth)); |
6595 ASSERT_TRUE(webScrollLayer->scrollable()); | 6595 ASSERT_TRUE(webScrollLayer->scrollable()); |
6596 ASSERT_TRUE(webScrollLayer->userScrollableHorizontal()); | 6596 ASSERT_TRUE(webScrollLayer->userScrollableHorizontal()); |
6597 ASSERT_TRUE(webScrollLayer->userScrollableVertical()); | 6597 ASSERT_TRUE(webScrollLayer->userScrollableVertical()); |
6598 } | 6598 } |
6599 | 6599 |
6600 TEST_P(ParameterizedWebFrameTest, FullscreenSubframe) | 6600 TEST_P(ParameterizedWebFrameTest, FullscreenSubframe) |
6601 { | 6601 { |
6602 FakeCompositingWebViewClient client; | 6602 FakeCompositingWebViewClient client; |
6603 registerMockedHttpURLLoad("fullscreen_iframe.html"); | 6603 registerMockedHttpURLLoad("fullscreen_iframe.html"); |
6604 registerMockedHttpURLLoad("fullscreen_div.html"); | 6604 registerMockedHttpURLLoad("fullscreen_div.html"); |
6605 FrameTestHelpers::WebViewHelper webViewHelper(this); | 6605 FrameTestHelpers::WebViewHelper webViewHelper(this); |
6606 WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad(m_baseURL + "full
screen_iframe.html", true, 0, &client, configureAndroid); | 6606 WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad(m_baseURL + "full
screen_iframe.html", true, nullptr, &client, nullptr, configureAndroid); |
6607 int viewportWidth = 640; | 6607 int viewportWidth = 640; |
6608 int viewportHeight = 480; | 6608 int viewportHeight = 480; |
6609 client.m_screenInfo.rect.width = viewportWidth; | 6609 client.m_screenInfo.rect.width = viewportWidth; |
6610 client.m_screenInfo.rect.height = viewportHeight; | 6610 client.m_screenInfo.rect.height = viewportHeight; |
6611 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); | 6611 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); |
6612 webViewImpl->updateAllLifecyclePhases(); | 6612 webViewImpl->updateAllLifecyclePhases(); |
6613 | 6613 |
6614 Document* document = toWebLocalFrameImpl(webViewHelper.webView()->mainFrame(
)->firstChild())->frame()->document(); | 6614 Document* document = toWebLocalFrameImpl(webViewHelper.webView()->mainFrame(
)->firstChild())->frame()->document(); |
6615 UserGestureIndicator gesture(DefinitelyProcessingUserGesture); | 6615 UserGestureIndicator gesture(DefinitelyProcessingUserGesture); |
6616 Element* divFullscreen = document->getElementById("div1"); | 6616 Element* divFullscreen = document->getElementById("div1"); |
(...skipping 13 matching lines...) Expand all Loading... |
6630 webViewImpl->updateAllLifecyclePhases(); | 6630 webViewImpl->updateAllLifecyclePhases(); |
6631 EXPECT_EQ(viewportHeight, fullscreenLayoutObject->logicalWidth().toInt()); | 6631 EXPECT_EQ(viewportHeight, fullscreenLayoutObject->logicalWidth().toInt()); |
6632 EXPECT_EQ(viewportWidth, fullscreenLayoutObject->logicalHeight().toInt()); | 6632 EXPECT_EQ(viewportWidth, fullscreenLayoutObject->logicalHeight().toInt()); |
6633 } | 6633 } |
6634 | 6634 |
6635 TEST_P(ParameterizedWebFrameTest, FullscreenWithTinyViewport) | 6635 TEST_P(ParameterizedWebFrameTest, FullscreenWithTinyViewport) |
6636 { | 6636 { |
6637 FakeCompositingWebViewClient client; | 6637 FakeCompositingWebViewClient client; |
6638 registerMockedHttpURLLoad("viewport-tiny.html"); | 6638 registerMockedHttpURLLoad("viewport-tiny.html"); |
6639 FrameTestHelpers::WebViewHelper webViewHelper(this); | 6639 FrameTestHelpers::WebViewHelper webViewHelper(this); |
6640 WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad(m_baseURL + "view
port-tiny.html", true, 0, &client, configureAndroid); | 6640 WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad(m_baseURL + "view
port-tiny.html", true, nullptr, &client, nullptr, configureAndroid); |
6641 int viewportWidth = 384; | 6641 int viewportWidth = 384; |
6642 int viewportHeight = 640; | 6642 int viewportHeight = 640; |
6643 client.m_screenInfo.rect.width = viewportWidth; | 6643 client.m_screenInfo.rect.width = viewportWidth; |
6644 client.m_screenInfo.rect.height = viewportHeight; | 6644 client.m_screenInfo.rect.height = viewportHeight; |
6645 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); | 6645 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); |
6646 webViewImpl->updateAllLifecyclePhases(); | 6646 webViewImpl->updateAllLifecyclePhases(); |
6647 | 6647 |
6648 LayoutView* layoutView = webViewHelper.webViewImpl()->mainFrameImpl()->frame
View()->layoutView(); | 6648 LayoutView* layoutView = webViewHelper.webViewImpl()->mainFrameImpl()->frame
View()->layoutView(); |
6649 EXPECT_EQ(320, layoutView->logicalWidth().floor()); | 6649 EXPECT_EQ(320, layoutView->logicalWidth().floor()); |
6650 EXPECT_EQ(533, layoutView->logicalHeight().floor()); | 6650 EXPECT_EQ(533, layoutView->logicalHeight().floor()); |
(...skipping 19 matching lines...) Expand all Loading... |
6670 EXPECT_FLOAT_EQ(1.2, webViewImpl->pageScaleFactor()); | 6670 EXPECT_FLOAT_EQ(1.2, webViewImpl->pageScaleFactor()); |
6671 EXPECT_FLOAT_EQ(1.2, webViewImpl->minimumPageScaleFactor()); | 6671 EXPECT_FLOAT_EQ(1.2, webViewImpl->minimumPageScaleFactor()); |
6672 EXPECT_FLOAT_EQ(5.0, webViewImpl->maximumPageScaleFactor()); | 6672 EXPECT_FLOAT_EQ(5.0, webViewImpl->maximumPageScaleFactor()); |
6673 } | 6673 } |
6674 | 6674 |
6675 TEST_P(ParameterizedWebFrameTest, FullscreenResizeWithTinyViewport) | 6675 TEST_P(ParameterizedWebFrameTest, FullscreenResizeWithTinyViewport) |
6676 { | 6676 { |
6677 FakeCompositingWebViewClient client; | 6677 FakeCompositingWebViewClient client; |
6678 registerMockedHttpURLLoad("viewport-tiny.html"); | 6678 registerMockedHttpURLLoad("viewport-tiny.html"); |
6679 FrameTestHelpers::WebViewHelper webViewHelper(this); | 6679 FrameTestHelpers::WebViewHelper webViewHelper(this); |
6680 WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad(m_baseURL + "view
port-tiny.html", true, 0, &client, configureAndroid); | 6680 WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad(m_baseURL + "view
port-tiny.html", true, nullptr, &client, nullptr, configureAndroid); |
6681 int viewportWidth = 384; | 6681 int viewportWidth = 384; |
6682 int viewportHeight = 640; | 6682 int viewportHeight = 640; |
6683 client.m_screenInfo.rect.width = viewportWidth; | 6683 client.m_screenInfo.rect.width = viewportWidth; |
6684 client.m_screenInfo.rect.height = viewportHeight; | 6684 client.m_screenInfo.rect.height = viewportHeight; |
6685 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); | 6685 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); |
6686 webViewImpl->updateAllLifecyclePhases(); | 6686 webViewImpl->updateAllLifecyclePhases(); |
6687 | 6687 |
6688 LayoutView* layoutView = webViewHelper.webViewImpl()->mainFrameImpl()->frame
View()->layoutView(); | 6688 LayoutView* layoutView = webViewHelper.webViewImpl()->mainFrameImpl()->frame
View()->layoutView(); |
6689 Document* document = toWebLocalFrameImpl(webViewImpl->mainFrame())->frame()-
>document(); | 6689 Document* document = toWebLocalFrameImpl(webViewImpl->mainFrame())->frame()-
>document(); |
6690 UserGestureIndicator gesture(DefinitelyProcessingUserGesture); | 6690 UserGestureIndicator gesture(DefinitelyProcessingUserGesture); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6724 // resize and switching fullscreen state operations on WebView, with the | 6724 // resize and switching fullscreen state operations on WebView, with the |
6725 // interference from Android status bars like a real device does. | 6725 // interference from Android status bars like a real device does. |
6726 // This verifies we handle the transition and restore states correctly. | 6726 // This verifies we handle the transition and restore states correctly. |
6727 WebSize screenSizeMinusStatusBarsMinusUrlBar(598, 303); | 6727 WebSize screenSizeMinusStatusBarsMinusUrlBar(598, 303); |
6728 WebSize screenSizeMinusStatusBars(598, 359); | 6728 WebSize screenSizeMinusStatusBars(598, 359); |
6729 WebSize screenSize(640, 384); | 6729 WebSize screenSize(640, 384); |
6730 | 6730 |
6731 FakeCompositingWebViewClient client; | 6731 FakeCompositingWebViewClient client; |
6732 registerMockedHttpURLLoad("fullscreen_restore_scale_factor.html"); | 6732 registerMockedHttpURLLoad("fullscreen_restore_scale_factor.html"); |
6733 FrameTestHelpers::WebViewHelper webViewHelper(this); | 6733 FrameTestHelpers::WebViewHelper webViewHelper(this); |
6734 WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad(m_baseURL + "full
screen_restore_scale_factor.html", true, nullptr, &client, &configureAndroid); | 6734 WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad(m_baseURL + "full
screen_restore_scale_factor.html", true, nullptr, &client, nullptr, &configureAn
droid); |
6735 client.m_screenInfo.rect.width = screenSizeMinusStatusBarsMinusUrlBar.width; | 6735 client.m_screenInfo.rect.width = screenSizeMinusStatusBarsMinusUrlBar.width; |
6736 client.m_screenInfo.rect.height = screenSizeMinusStatusBarsMinusUrlBar.heigh
t; | 6736 client.m_screenInfo.rect.height = screenSizeMinusStatusBarsMinusUrlBar.heigh
t; |
6737 webViewHelper.resize(screenSizeMinusStatusBarsMinusUrlBar); | 6737 webViewHelper.resize(screenSizeMinusStatusBarsMinusUrlBar); |
6738 LayoutView* layoutView = webViewHelper.webViewImpl()->mainFrameImpl()->frame
View()->layoutView(); | 6738 LayoutView* layoutView = webViewHelper.webViewImpl()->mainFrameImpl()->frame
View()->layoutView(); |
6739 EXPECT_EQ(screenSizeMinusStatusBarsMinusUrlBar.width, layoutView->logicalWid
th().floor()); | 6739 EXPECT_EQ(screenSizeMinusStatusBarsMinusUrlBar.width, layoutView->logicalWid
th().floor()); |
6740 EXPECT_EQ(screenSizeMinusStatusBarsMinusUrlBar.height, layoutView->logicalHe
ight().floor()); | 6740 EXPECT_EQ(screenSizeMinusStatusBarsMinusUrlBar.height, layoutView->logicalHe
ight().floor()); |
6741 EXPECT_FLOAT_EQ(1.0, webViewImpl->pageScaleFactor()); | 6741 EXPECT_FLOAT_EQ(1.0, webViewImpl->pageScaleFactor()); |
6742 EXPECT_FLOAT_EQ(1.0, webViewImpl->minimumPageScaleFactor()); | 6742 EXPECT_FLOAT_EQ(1.0, webViewImpl->minimumPageScaleFactor()); |
6743 EXPECT_FLOAT_EQ(5.0, webViewImpl->maximumPageScaleFactor()); | 6743 EXPECT_FLOAT_EQ(5.0, webViewImpl->maximumPageScaleFactor()); |
6744 | 6744 |
(...skipping 1089 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7834 { | 7834 { |
7835 FrameTestHelpers::TestWebViewClient viewClient; | 7835 FrameTestHelpers::TestWebViewClient viewClient; |
7836 WebView* view = WebView::create(&viewClient); | 7836 WebView* view = WebView::create(&viewClient); |
7837 | 7837 |
7838 FrameTestHelpers::TestWebRemoteFrameClient remoteClient; | 7838 FrameTestHelpers::TestWebRemoteFrameClient remoteClient; |
7839 view->setMainFrame(remoteClient.frame()); | 7839 view->setMainFrame(remoteClient.frame()); |
7840 | 7840 |
7841 WebLocalFrame* childFrame = FrameTestHelpers::createLocalChild(view->mainFra
me()->toWebRemoteFrame()); | 7841 WebLocalFrame* childFrame = FrameTestHelpers::createLocalChild(view->mainFra
me()->toWebRemoteFrame()); |
7842 | 7842 |
7843 GestureEventTestWebViewClient childViewClient; | 7843 GestureEventTestWebViewClient childViewClient; |
7844 WebFrameWidget* widget = WebFrameWidget::create(&childViewClient, childFrame
); | 7844 WebFrameWidget* widget = WebFrameWidget::create(childViewClient.widgetClient
(), childFrame); |
7845 | 7845 |
7846 view->resize(WebSize(1000, 1000)); | 7846 view->resize(WebSize(1000, 1000)); |
7847 | 7847 |
7848 widget->handleInputEvent(fatTap(20, 20)); | 7848 widget->handleInputEvent(fatTap(20, 20)); |
7849 EXPECT_TRUE(childViewClient.didHandleGestureEvent()); | 7849 EXPECT_TRUE(childViewClient.didHandleGestureEvent()); |
7850 | 7850 |
7851 widget->close(); | 7851 widget->close(); |
7852 view->close(); | 7852 view->close(); |
7853 } | 7853 } |
7854 | 7854 |
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8158 | 8158 |
8159 INSTANTIATE_TEST_CASE_P(All, WebFrameOverscrollTest, ::testing::Values( | 8159 INSTANTIATE_TEST_CASE_P(All, WebFrameOverscrollTest, ::testing::Values( |
8160 WebGestureDeviceTouchpad, | 8160 WebGestureDeviceTouchpad, |
8161 WebGestureDeviceTouchscreen)); | 8161 WebGestureDeviceTouchscreen)); |
8162 | 8162 |
8163 TEST_P(WebFrameOverscrollTest, AccumulatedRootOverscrollAndUnsedDeltaValuesOnOve
rscroll) | 8163 TEST_P(WebFrameOverscrollTest, AccumulatedRootOverscrollAndUnsedDeltaValuesOnOve
rscroll) |
8164 { | 8164 { |
8165 OverscrollWebViewClient client; | 8165 OverscrollWebViewClient client; |
8166 registerMockedHttpURLLoad("overscroll/overscroll.html"); | 8166 registerMockedHttpURLLoad("overscroll/overscroll.html"); |
8167 FrameTestHelpers::WebViewHelper webViewHelper; | 8167 FrameTestHelpers::WebViewHelper webViewHelper; |
8168 webViewHelper.initializeAndLoad(m_baseURL + "overscroll/overscroll.html", tr
ue, 0, &client, configureAndroid); | 8168 webViewHelper.initializeAndLoad(m_baseURL + "overscroll/overscroll.html", tr
ue, nullptr, &client, nullptr, configureAndroid); |
8169 webViewHelper.resize(WebSize(200, 200)); | 8169 webViewHelper.resize(WebSize(200, 200)); |
8170 | 8170 |
8171 // Calculation of accumulatedRootOverscroll and unusedDelta on multiple scro
llUpdate. | 8171 // Calculation of accumulatedRootOverscroll and unusedDelta on multiple scro
llUpdate. |
8172 ScrollBegin(&webViewHelper); | 8172 ScrollBegin(&webViewHelper); |
8173 EXPECT_CALL(client, didOverscroll(WebFloatSize(8, 16), WebFloatSize(8, 16),
WebFloatPoint(100, 100), WebFloatSize())); | 8173 EXPECT_CALL(client, didOverscroll(WebFloatSize(8, 16), WebFloatSize(8, 16),
WebFloatPoint(100, 100), WebFloatSize())); |
8174 ScrollUpdate(&webViewHelper, -308, -316); | 8174 ScrollUpdate(&webViewHelper, -308, -316); |
8175 Mock::VerifyAndClearExpectations(&client); | 8175 Mock::VerifyAndClearExpectations(&client); |
8176 | 8176 |
8177 EXPECT_CALL(client, didOverscroll(WebFloatSize(0, 13), WebFloatSize(8, 29),
WebFloatPoint(100, 100), WebFloatSize())); | 8177 EXPECT_CALL(client, didOverscroll(WebFloatSize(0, 13), WebFloatSize(8, 29),
WebFloatPoint(100, 100), WebFloatSize())); |
8178 ScrollUpdate(&webViewHelper, 0, -13); | 8178 ScrollUpdate(&webViewHelper, 0, -13); |
(...skipping 21 matching lines...) Expand all Loading... |
8200 EXPECT_CALL(client, didOverscroll(_, _, _, _)).Times(0); | 8200 EXPECT_CALL(client, didOverscroll(_, _, _, _)).Times(0); |
8201 ScrollEnd(&webViewHelper); | 8201 ScrollEnd(&webViewHelper); |
8202 Mock::VerifyAndClearExpectations(&client); | 8202 Mock::VerifyAndClearExpectations(&client); |
8203 } | 8203 } |
8204 | 8204 |
8205 TEST_P(WebFrameOverscrollTest, AccumulatedOverscrollAndUnusedDeltaValuesOnDiffer
entAxesOverscroll) | 8205 TEST_P(WebFrameOverscrollTest, AccumulatedOverscrollAndUnusedDeltaValuesOnDiffer
entAxesOverscroll) |
8206 { | 8206 { |
8207 OverscrollWebViewClient client; | 8207 OverscrollWebViewClient client; |
8208 registerMockedHttpURLLoad("overscroll/div-overscroll.html"); | 8208 registerMockedHttpURLLoad("overscroll/div-overscroll.html"); |
8209 FrameTestHelpers::WebViewHelper webViewHelper; | 8209 FrameTestHelpers::WebViewHelper webViewHelper; |
8210 webViewHelper.initializeAndLoad(m_baseURL + "overscroll/div-overscroll.html"
, true, 0, &client, configureAndroid); | 8210 webViewHelper.initializeAndLoad(m_baseURL + "overscroll/div-overscroll.html"
, true, nullptr, &client, nullptr, configureAndroid); |
8211 webViewHelper.resize(WebSize(200, 200)); | 8211 webViewHelper.resize(WebSize(200, 200)); |
8212 | 8212 |
8213 ScrollBegin(&webViewHelper); | 8213 ScrollBegin(&webViewHelper); |
8214 | 8214 |
8215 // Scroll the Div to the end. | 8215 // Scroll the Div to the end. |
8216 EXPECT_CALL(client, didOverscroll(_, _, _, _)).Times(0); | 8216 EXPECT_CALL(client, didOverscroll(_, _, _, _)).Times(0); |
8217 ScrollUpdate(&webViewHelper, 0, -316); | 8217 ScrollUpdate(&webViewHelper, 0, -316); |
8218 Mock::VerifyAndClearExpectations(&client); | 8218 Mock::VerifyAndClearExpectations(&client); |
8219 | 8219 |
8220 ScrollEnd(&webViewHelper); | 8220 ScrollEnd(&webViewHelper); |
(...skipping 22 matching lines...) Expand all Loading... |
8243 // EXPECT_CALL(client, didOverscroll(WebFloatSize(0, 100), WebFloatSize(0, 1
00), WebFloatPoint(100, 100), WebFloatSize())); | 8243 // EXPECT_CALL(client, didOverscroll(WebFloatSize(0, 100), WebFloatSize(0, 1
00), WebFloatPoint(100, 100), WebFloatSize())); |
8244 // ScrollUpdate(&webViewHelper, -100, -100); | 8244 // ScrollUpdate(&webViewHelper, -100, -100); |
8245 // Mock::VerifyAndClearExpectations(&client); | 8245 // Mock::VerifyAndClearExpectations(&client); |
8246 } | 8246 } |
8247 | 8247 |
8248 TEST_P(WebFrameOverscrollTest, RootLayerOverscrolledOnInnerDivOverScroll) | 8248 TEST_P(WebFrameOverscrollTest, RootLayerOverscrolledOnInnerDivOverScroll) |
8249 { | 8249 { |
8250 OverscrollWebViewClient client; | 8250 OverscrollWebViewClient client; |
8251 registerMockedHttpURLLoad("overscroll/div-overscroll.html"); | 8251 registerMockedHttpURLLoad("overscroll/div-overscroll.html"); |
8252 FrameTestHelpers::WebViewHelper webViewHelper; | 8252 FrameTestHelpers::WebViewHelper webViewHelper; |
8253 webViewHelper.initializeAndLoad(m_baseURL + "overscroll/div-overscroll.html"
, true, 0, &client, configureAndroid); | 8253 webViewHelper.initializeAndLoad(m_baseURL + "overscroll/div-overscroll.html"
, true, nullptr, &client, nullptr, configureAndroid); |
8254 webViewHelper.resize(WebSize(200, 200)); | 8254 webViewHelper.resize(WebSize(200, 200)); |
8255 | 8255 |
8256 ScrollBegin(&webViewHelper); | 8256 ScrollBegin(&webViewHelper); |
8257 | 8257 |
8258 // Scroll the Div to the end. | 8258 // Scroll the Div to the end. |
8259 EXPECT_CALL(client, didOverscroll(_, _, _, _)).Times(0); | 8259 EXPECT_CALL(client, didOverscroll(_, _, _, _)).Times(0); |
8260 ScrollUpdate(&webViewHelper, 0, -316); | 8260 ScrollUpdate(&webViewHelper, 0, -316); |
8261 Mock::VerifyAndClearExpectations(&client); | 8261 Mock::VerifyAndClearExpectations(&client); |
8262 | 8262 |
8263 ScrollEnd(&webViewHelper); | 8263 ScrollEnd(&webViewHelper); |
8264 ScrollBegin(&webViewHelper); | 8264 ScrollBegin(&webViewHelper); |
8265 | 8265 |
8266 // Now On Scrolling DIV, scroll is bubbled and root layer is over-scrolled. | 8266 // Now On Scrolling DIV, scroll is bubbled and root layer is over-scrolled. |
8267 EXPECT_CALL(client, didOverscroll(WebFloatSize(0, 50), WebFloatSize(0, 50),
WebFloatPoint(100, 100), WebFloatSize())); | 8267 EXPECT_CALL(client, didOverscroll(WebFloatSize(0, 50), WebFloatSize(0, 50),
WebFloatPoint(100, 100), WebFloatSize())); |
8268 ScrollUpdate(&webViewHelper, 0, -150); | 8268 ScrollUpdate(&webViewHelper, 0, -150); |
8269 Mock::VerifyAndClearExpectations(&client); | 8269 Mock::VerifyAndClearExpectations(&client); |
8270 } | 8270 } |
8271 | 8271 |
8272 TEST_P(WebFrameOverscrollTest, RootLayerOverscrolledOnInnerIFrameOverScroll) | 8272 TEST_P(WebFrameOverscrollTest, RootLayerOverscrolledOnInnerIFrameOverScroll) |
8273 { | 8273 { |
8274 OverscrollWebViewClient client; | 8274 OverscrollWebViewClient client; |
8275 registerMockedHttpURLLoad("overscroll/iframe-overscroll.html"); | 8275 registerMockedHttpURLLoad("overscroll/iframe-overscroll.html"); |
8276 registerMockedHttpURLLoad("overscroll/scrollable-iframe.html"); | 8276 registerMockedHttpURLLoad("overscroll/scrollable-iframe.html"); |
8277 FrameTestHelpers::WebViewHelper webViewHelper; | 8277 FrameTestHelpers::WebViewHelper webViewHelper; |
8278 webViewHelper.initializeAndLoad(m_baseURL + "overscroll/iframe-overscroll.ht
ml", true, 0, &client, configureAndroid); | 8278 webViewHelper.initializeAndLoad(m_baseURL + "overscroll/iframe-overscroll.ht
ml", true, nullptr, &client, nullptr, configureAndroid); |
8279 webViewHelper.resize(WebSize(200, 200)); | 8279 webViewHelper.resize(WebSize(200, 200)); |
8280 | 8280 |
8281 ScrollBegin(&webViewHelper); | 8281 ScrollBegin(&webViewHelper); |
8282 // Scroll the IFrame to the end. | 8282 // Scroll the IFrame to the end. |
8283 EXPECT_CALL(client, didOverscroll(_, _, _, _)).Times(0); | 8283 EXPECT_CALL(client, didOverscroll(_, _, _, _)).Times(0); |
8284 | 8284 |
8285 // This scroll will fully scroll the iframe but will be consumed before bein
g | 8285 // This scroll will fully scroll the iframe but will be consumed before bein
g |
8286 // counted as overscroll. | 8286 // counted as overscroll. |
8287 ScrollUpdate(&webViewHelper, 0, -320); | 8287 ScrollUpdate(&webViewHelper, 0, -320); |
8288 | 8288 |
(...skipping 11 matching lines...) Expand all Loading... |
8300 Mock::VerifyAndClearExpectations(&client); | 8300 Mock::VerifyAndClearExpectations(&client); |
8301 | 8301 |
8302 ScrollEnd(&webViewHelper); | 8302 ScrollEnd(&webViewHelper); |
8303 } | 8303 } |
8304 | 8304 |
8305 TEST_P(WebFrameOverscrollTest, ScaledPageRootLayerOverscrolled) | 8305 TEST_P(WebFrameOverscrollTest, ScaledPageRootLayerOverscrolled) |
8306 { | 8306 { |
8307 OverscrollWebViewClient client; | 8307 OverscrollWebViewClient client; |
8308 registerMockedHttpURLLoad("overscroll/overscroll.html"); | 8308 registerMockedHttpURLLoad("overscroll/overscroll.html"); |
8309 FrameTestHelpers::WebViewHelper webViewHelper; | 8309 FrameTestHelpers::WebViewHelper webViewHelper; |
8310 WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad(m_baseURL + "over
scroll/overscroll.html", true, 0, &client, configureAndroid); | 8310 WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad(m_baseURL + "over
scroll/overscroll.html", true, nullptr, &client, nullptr, configureAndroid); |
8311 webViewHelper.resize(WebSize(200, 200)); | 8311 webViewHelper.resize(WebSize(200, 200)); |
8312 webViewImpl->setPageScaleFactor(3.0); | 8312 webViewImpl->setPageScaleFactor(3.0); |
8313 | 8313 |
8314 // Calculation of accumulatedRootOverscroll and unusedDelta on scaled page.
The point is (99, 99) because we clamp | 8314 // Calculation of accumulatedRootOverscroll and unusedDelta on scaled page.
The point is (99, 99) because we clamp |
8315 // in the division by 3 to 33 so when we go back to viewport coordinates it
becomes (99, 99). | 8315 // in the division by 3 to 33 so when we go back to viewport coordinates it
becomes (99, 99). |
8316 ScrollBegin(&webViewHelper); | 8316 ScrollBegin(&webViewHelper); |
8317 EXPECT_CALL(client, didOverscroll(WebFloatSize(0, -30), WebFloatSize(0, -30)
, WebFloatPoint(99, 99), WebFloatSize())); | 8317 EXPECT_CALL(client, didOverscroll(WebFloatSize(0, -30), WebFloatSize(0, -30)
, WebFloatPoint(99, 99), WebFloatSize())); |
8318 ScrollUpdate(&webViewHelper, 0, 30); | 8318 ScrollUpdate(&webViewHelper, 0, 30); |
8319 Mock::VerifyAndClearExpectations(&client); | 8319 Mock::VerifyAndClearExpectations(&client); |
8320 | 8320 |
(...skipping 13 matching lines...) Expand all Loading... |
8334 EXPECT_CALL(client, didOverscroll(_, _, _, _)).Times(0); | 8334 EXPECT_CALL(client, didOverscroll(_, _, _, _)).Times(0); |
8335 ScrollEnd(&webViewHelper); | 8335 ScrollEnd(&webViewHelper); |
8336 Mock::VerifyAndClearExpectations(&client); | 8336 Mock::VerifyAndClearExpectations(&client); |
8337 } | 8337 } |
8338 | 8338 |
8339 TEST_P(WebFrameOverscrollTest, NoOverscrollForSmallvalues) | 8339 TEST_P(WebFrameOverscrollTest, NoOverscrollForSmallvalues) |
8340 { | 8340 { |
8341 OverscrollWebViewClient client; | 8341 OverscrollWebViewClient client; |
8342 registerMockedHttpURLLoad("overscroll/overscroll.html"); | 8342 registerMockedHttpURLLoad("overscroll/overscroll.html"); |
8343 FrameTestHelpers::WebViewHelper webViewHelper; | 8343 FrameTestHelpers::WebViewHelper webViewHelper; |
8344 webViewHelper.initializeAndLoad(m_baseURL + "overscroll/overscroll.html", tr
ue, 0, &client, configureAndroid); | 8344 webViewHelper.initializeAndLoad(m_baseURL + "overscroll/overscroll.html", tr
ue, nullptr, &client, nullptr, configureAndroid); |
8345 webViewHelper.resize(WebSize(200, 200)); | 8345 webViewHelper.resize(WebSize(200, 200)); |
8346 | 8346 |
8347 ScrollBegin(&webViewHelper); | 8347 ScrollBegin(&webViewHelper); |
8348 EXPECT_CALL(client, didOverscroll(WebFloatSize(-10, -10), WebFloatSize(-10,
-10), WebFloatPoint(100, 100), WebFloatSize())); | 8348 EXPECT_CALL(client, didOverscroll(WebFloatSize(-10, -10), WebFloatSize(-10,
-10), WebFloatPoint(100, 100), WebFloatSize())); |
8349 ScrollUpdate(&webViewHelper, 10, 10); | 8349 ScrollUpdate(&webViewHelper, 10, 10); |
8350 Mock::VerifyAndClearExpectations(&client); | 8350 Mock::VerifyAndClearExpectations(&client); |
8351 | 8351 |
8352 EXPECT_CALL(client, didOverscroll(WebFloatSize(0, -0.10), WebFloatSize(-10,
-10.10), WebFloatPoint(100, 100), WebFloatSize())); | 8352 EXPECT_CALL(client, didOverscroll(WebFloatSize(0, -0.10), WebFloatSize(-10,
-10.10), WebFloatPoint(100, 100), WebFloatSize())); |
8353 ScrollUpdate(&webViewHelper, 0, 0.10); | 8353 ScrollUpdate(&webViewHelper, 0, 0.10); |
8354 Mock::VerifyAndClearExpectations(&client); | 8354 Mock::VerifyAndClearExpectations(&client); |
(...skipping 30 matching lines...) Expand all Loading... |
8385 EXPECT_CALL(client, didOverscroll(_, _, _, _)).Times(0); | 8385 EXPECT_CALL(client, didOverscroll(_, _, _, _)).Times(0); |
8386 ScrollEnd(&webViewHelper); | 8386 ScrollEnd(&webViewHelper); |
8387 Mock::VerifyAndClearExpectations(&client); | 8387 Mock::VerifyAndClearExpectations(&client); |
8388 } | 8388 } |
8389 | 8389 |
8390 TEST_P(WebFrameOverscrollTest, ReportingLatestOverscrollForElasticOverscroll) | 8390 TEST_P(WebFrameOverscrollTest, ReportingLatestOverscrollForElasticOverscroll) |
8391 { | 8391 { |
8392 OverscrollWebViewClient client; | 8392 OverscrollWebViewClient client; |
8393 registerMockedHttpURLLoad("overscroll/overscroll.html"); | 8393 registerMockedHttpURLLoad("overscroll/overscroll.html"); |
8394 FrameTestHelpers::WebViewHelper webViewHelper; | 8394 FrameTestHelpers::WebViewHelper webViewHelper; |
8395 webViewHelper.initializeAndLoad(m_baseURL + "overscroll/overscroll.html", tr
ue, 0, &client, configureAndroid); | 8395 webViewHelper.initializeAndLoad(m_baseURL + "overscroll/overscroll.html", tr
ue, nullptr, &client, nullptr, configureAndroid); |
8396 webViewHelper.resize(WebSize(200, 200)); | 8396 webViewHelper.resize(WebSize(200, 200)); |
8397 | 8397 |
8398 EXPECT_CALL(client, didOverscroll(WebFloatSize(-1000, -1000), WebFloatSize(-
1000, -1000), WebFloatPoint(), WebFloatSize())); | 8398 EXPECT_CALL(client, didOverscroll(WebFloatSize(-1000, -1000), WebFloatSize(-
1000, -1000), WebFloatPoint(), WebFloatSize())); |
8399 ScrollByWheel(&webViewHelper, 10, 10, 1000, 1000); | 8399 ScrollByWheel(&webViewHelper, 10, 10, 1000, 1000); |
8400 Mock::VerifyAndClearExpectations(&client); | 8400 Mock::VerifyAndClearExpectations(&client); |
8401 } | 8401 } |
8402 | 8402 |
8403 TEST_P(WebFrameOverscrollTest, ScrollPageWithBodyExplicitlyOverflowing) | 8403 TEST_P(WebFrameOverscrollTest, ScrollPageWithBodyExplicitlyOverflowing) |
8404 { | 8404 { |
8405 RuntimeEnabledFeatures::setScrollTopLeftInteropEnabled(false); | 8405 RuntimeEnabledFeatures::setScrollTopLeftInteropEnabled(false); |
8406 | 8406 |
8407 OverscrollWebViewClient client; | 8407 OverscrollWebViewClient client; |
8408 registerMockedHttpURLLoad("mouse-wheel-overflow-body.html"); | 8408 registerMockedHttpURLLoad("mouse-wheel-overflow-body.html"); |
8409 FrameTestHelpers::WebViewHelper webViewHelper; | 8409 FrameTestHelpers::WebViewHelper webViewHelper; |
8410 webViewHelper.initializeAndLoad(m_baseURL + "mouse-wheel-overflow-body.html"
, true, 0, &client, configureAndroid); | 8410 webViewHelper.initializeAndLoad(m_baseURL + "mouse-wheel-overflow-body.html"
, true, nullptr, &client, nullptr, configureAndroid); |
8411 webViewHelper.resize(WebSize(800, 600)); | 8411 webViewHelper.resize(WebSize(800, 600)); |
8412 | 8412 |
8413 FrameView* view = webViewHelper.webViewImpl()->mainFrameImpl()->frameView(); | 8413 FrameView* view = webViewHelper.webViewImpl()->mainFrameImpl()->frameView(); |
8414 Document* document = toWebLocalFrameImpl(webViewHelper.webViewImpl()->mainFr
ame())->frame()->document(); | 8414 Document* document = toWebLocalFrameImpl(webViewHelper.webViewImpl()->mainFr
ame())->frame()->document(); |
8415 | 8415 |
8416 { | 8416 { |
8417 EXPECT_CALL(client, didOverscroll(_, _, _, _)).Times(0); | 8417 EXPECT_CALL(client, didOverscroll(_, _, _, _)).Times(0); |
8418 ScrollByWheel(&webViewHelper, 100, 100, 0, -450); | 8418 ScrollByWheel(&webViewHelper, 100, 100, 0, -450); |
8419 | 8419 |
8420 LayoutBox* layoutBody = toLayoutBox(document->body()->layoutObject()); | 8420 LayoutBox* layoutBody = toLayoutBox(document->body()->layoutObject()); |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8602 v8::Local<v8::Value> result = mainFrame->executeScriptAndReturnValue(WebScri
ptSource("hello")); | 8602 v8::Local<v8::Value> result = mainFrame->executeScriptAndReturnValue(WebScri
ptSource("hello")); |
8603 EXPECT_TRUE(result.IsEmpty()); | 8603 EXPECT_TRUE(result.IsEmpty()); |
8604 } | 8604 } |
8605 | 8605 |
8606 // Child frames should never reuse the global on a cross-origin navigation, even | 8606 // Child frames should never reuse the global on a cross-origin navigation, even |
8607 // if the setting is enabled. It's not safe to since the parent could have | 8607 // if the setting is enabled. It's not safe to since the parent could have |
8608 // injected script before the initial navigation. | 8608 // injected script before the initial navigation. |
8609 TEST(WebFrameGlobalReuseTest, ChildFrame) | 8609 TEST(WebFrameGlobalReuseTest, ChildFrame) |
8610 { | 8610 { |
8611 FrameTestHelpers::WebViewHelper helper; | 8611 FrameTestHelpers::WebViewHelper helper; |
8612 helper.initialize(true, nullptr, nullptr, enableGlobalReuseForUnownedMainFra
mes); | 8612 helper.initialize(true, nullptr, nullptr, nullptr, enableGlobalReuseForUnown
edMainFrames); |
8613 | 8613 |
8614 WebLocalFrame* mainFrame = helper.webView()->mainFrame()->toWebLocalFrame(); | 8614 WebLocalFrame* mainFrame = helper.webView()->mainFrame()->toWebLocalFrame(); |
8615 FrameTestHelpers::loadFrame(mainFrame, "data:text/html,<iframe></iframe>"); | 8615 FrameTestHelpers::loadFrame(mainFrame, "data:text/html,<iframe></iframe>"); |
8616 | 8616 |
8617 WebLocalFrame* childFrame = mainFrame->firstChild()->toWebLocalFrame(); | 8617 WebLocalFrame* childFrame = mainFrame->firstChild()->toWebLocalFrame(); |
8618 v8::HandleScope scope(v8::Isolate::GetCurrent()); | 8618 v8::HandleScope scope(v8::Isolate::GetCurrent()); |
8619 childFrame->executeScript(WebScriptSource("hello = 'world';")); | 8619 childFrame->executeScript(WebScriptSource("hello = 'world';")); |
8620 FrameTestHelpers::loadFrame(childFrame, "data:text/html,new page"); | 8620 FrameTestHelpers::loadFrame(childFrame, "data:text/html,new page"); |
8621 v8::Local<v8::Value> result = childFrame->executeScriptAndReturnValue(WebScr
iptSource("hello")); | 8621 v8::Local<v8::Value> result = childFrame->executeScriptAndReturnValue(WebScr
iptSource("hello")); |
8622 EXPECT_TRUE(result.IsEmpty()); | 8622 EXPECT_TRUE(result.IsEmpty()); |
8623 } | 8623 } |
8624 | 8624 |
8625 // A main frame with an opener should never reuse the global on a cross-origin | 8625 // A main frame with an opener should never reuse the global on a cross-origin |
8626 // navigation, even if the setting is enabled. It's not safe to since the opener | 8626 // navigation, even if the setting is enabled. It's not safe to since the opener |
8627 // could have injected script. | 8627 // could have injected script. |
8628 TEST(WebFrameGlobalReuseTest, MainFrameWithOpener) | 8628 TEST(WebFrameGlobalReuseTest, MainFrameWithOpener) |
8629 { | 8629 { |
8630 FrameTestHelpers::TestWebViewClient openerWebViewClient; | 8630 FrameTestHelpers::TestWebViewClient openerWebViewClient; |
8631 FrameTestHelpers::WebViewHelper openerHelper; | 8631 FrameTestHelpers::WebViewHelper openerHelper; |
8632 openerHelper.initialize(false, nullptr, &openerWebViewClient); | 8632 openerHelper.initialize(false, nullptr, &openerWebViewClient, nullptr); |
8633 FrameTestHelpers::WebViewHelper helper; | 8633 FrameTestHelpers::WebViewHelper helper; |
8634 helper.initializeWithOpener(openerHelper.webView()->mainFrame(), true, nullp
tr, nullptr, enableGlobalReuseForUnownedMainFrames); | 8634 helper.initializeWithOpener(openerHelper.webView()->mainFrame(), true, nullp
tr, nullptr, nullptr, enableGlobalReuseForUnownedMainFrames); |
8635 | 8635 |
8636 WebLocalFrame* mainFrame = helper.webView()->mainFrame()->toWebLocalFrame(); | 8636 WebLocalFrame* mainFrame = helper.webView()->mainFrame()->toWebLocalFrame(); |
8637 v8::HandleScope scope(v8::Isolate::GetCurrent()); | 8637 v8::HandleScope scope(v8::Isolate::GetCurrent()); |
8638 mainFrame->executeScript(WebScriptSource("hello = 'world';")); | 8638 mainFrame->executeScript(WebScriptSource("hello = 'world';")); |
8639 FrameTestHelpers::loadFrame(mainFrame, "data:text/html,new page"); | 8639 FrameTestHelpers::loadFrame(mainFrame, "data:text/html,new page"); |
8640 v8::Local<v8::Value> result = mainFrame->executeScriptAndReturnValue(WebScri
ptSource("hello")); | 8640 v8::Local<v8::Value> result = mainFrame->executeScriptAndReturnValue(WebScri
ptSource("hello")); |
8641 EXPECT_TRUE(result.IsEmpty()); | 8641 EXPECT_TRUE(result.IsEmpty()); |
8642 } | 8642 } |
8643 | 8643 |
8644 // A main frame that is unrelated to any other frame /can/ reuse the global if | 8644 // A main frame that is unrelated to any other frame /can/ reuse the global if |
8645 // the setting is enabled. In this case, it's impossible for any other frames to | 8645 // the setting is enabled. In this case, it's impossible for any other frames to |
8646 // have touched the global. Only the embedder could have injected script, and | 8646 // have touched the global. Only the embedder could have injected script, and |
8647 // the embedder enabling this setting is a signal that the injected script needs | 8647 // the embedder enabling this setting is a signal that the injected script needs |
8648 // to persist on the first navigation away from the initial empty document. | 8648 // to persist on the first navigation away from the initial empty document. |
8649 TEST(WebFrameGlobalReuseTest, ReuseForMainFrameIfEnabled) | 8649 TEST(WebFrameGlobalReuseTest, ReuseForMainFrameIfEnabled) |
8650 { | 8650 { |
8651 FrameTestHelpers::WebViewHelper helper; | 8651 FrameTestHelpers::WebViewHelper helper; |
8652 helper.initialize(true, nullptr, nullptr, enableGlobalReuseForUnownedMainFra
mes); | 8652 helper.initialize(true, nullptr, nullptr, nullptr, enableGlobalReuseForUnown
edMainFrames); |
8653 | 8653 |
8654 WebLocalFrame* mainFrame = helper.webView()->mainFrame()->toWebLocalFrame(); | 8654 WebLocalFrame* mainFrame = helper.webView()->mainFrame()->toWebLocalFrame(); |
8655 v8::HandleScope scope(v8::Isolate::GetCurrent()); | 8655 v8::HandleScope scope(v8::Isolate::GetCurrent()); |
8656 mainFrame->executeScript(WebScriptSource("hello = 'world';")); | 8656 mainFrame->executeScript(WebScriptSource("hello = 'world';")); |
8657 FrameTestHelpers::loadFrame(mainFrame, "data:text/html,new page"); | 8657 FrameTestHelpers::loadFrame(mainFrame, "data:text/html,new page"); |
8658 v8::Local<v8::Value> result = mainFrame->executeScriptAndReturnValue(WebScri
ptSource("hello")); | 8658 v8::Local<v8::Value> result = mainFrame->executeScriptAndReturnValue(WebScri
ptSource("hello")); |
8659 ASSERT_TRUE(result->IsString()); | 8659 ASSERT_TRUE(result->IsString()); |
8660 EXPECT_EQ("world", toCoreString(result->ToString(mainFrame->mainWorldScriptC
ontext()).ToLocalChecked())); | 8660 EXPECT_EQ("world", toCoreString(result->ToString(mainFrame->mainWorldScriptC
ontext()).ToLocalChecked())); |
8661 } | 8661 } |
8662 | 8662 |
8663 } // namespace blink | 8663 } // namespace blink |
OLD | NEW |