Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2174)

Side by Side Diff: Source/web/tests/WebFrameTest.cpp

Issue 23461009: Scale to legibleScale if double tap would barely zoom in from zoomed out state. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Source/web/WebViewImpl.cpp ('k') | Source/web/tests/data/get_wide_div_for_auto_zoom_test.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1148 matching lines...) Expand 10 before | Expand all | Expand 10 after
1159 webView->layout(); 1159 webView->layout();
1160 } 1160 }
1161 1161
1162 TEST_F(WebFrameTest, DivAutoZoomParamsTest) 1162 TEST_F(WebFrameTest, DivAutoZoomParamsTest)
1163 { 1163 {
1164 registerMockedHttpURLLoad("get_scale_for_auto_zoom_into_div_test.html"); 1164 registerMockedHttpURLLoad("get_scale_for_auto_zoom_into_div_test.html");
1165 1165
1166 const float deviceScaleFactor = 2.0f; 1166 const float deviceScaleFactor = 2.0f;
1167 int viewportWidth = 640 / deviceScaleFactor; 1167 int viewportWidth = 640 / deviceScaleFactor;
1168 int viewportHeight = 1280 / deviceScaleFactor; 1168 int viewportHeight = 1280 / deviceScaleFactor;
1169 float doubleTapZoomAlreadyLegibleRatio = 1.2f;
1169 m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "get_scale_fo r_auto_zoom_into_div_test.html"); // 1170 m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "get_scale_fo r_auto_zoom_into_div_test.html"); //
1170 m_webView->setDeviceScaleFactor(deviceScaleFactor); 1171 m_webView->setDeviceScaleFactor(deviceScaleFactor);
1171 m_webView->setPageScaleFactorLimits(0.01f, 4); 1172 m_webView->setPageScaleFactorLimits(0.01f, 4);
1172 m_webView->setPageScaleFactor(0.5f, WebPoint(0, 0)); 1173 m_webView->setPageScaleFactor(0.5f, WebPoint(0, 0));
1173 m_webView->resize(WebSize(viewportWidth, viewportHeight)); 1174 m_webView->resize(WebSize(viewportWidth, viewportHeight));
1174 m_webView->enableFixedLayoutMode(true); 1175 m_webView->enableFixedLayoutMode(true);
1175 m_webView->layout(); 1176 m_webView->layout();
1176 1177
1177 WebRect wideDiv(200, 100, 400, 150); 1178 WebRect wideDiv(200, 100, 400, 150);
1178 WebRect tallDiv(200, 300, 400, 800); 1179 WebRect tallDiv(200, 300, 400, 800);
1179 WebRect doubleTapPointWide(wideDiv.x + 50, wideDiv.y + 50, touchPointPadding , touchPointPadding); 1180 WebRect doubleTapPointWide(wideDiv.x + 50, wideDiv.y + 50, touchPointPadding , touchPointPadding);
1180 WebRect doubleTapPointTall(tallDiv.x + 50, tallDiv.y + 50, touchPointPadding , touchPointPadding); 1181 WebRect doubleTapPointTall(tallDiv.x + 50, tallDiv.y + 50, touchPointPadding , touchPointPadding);
1181 WebRect wideBlockBounds; 1182 WebRect wideBlockBounds;
1182 WebRect tallBlockBounds; 1183 WebRect tallBlockBounds;
1183 float scale; 1184 float scale;
1184 WebPoint scroll; 1185 WebPoint scroll;
1185 bool doubleTapShouldZoomOut; 1186
1187 float doubleTapZoomAlreadyLegibleScale = webViewImpl()->minimumPageScaleFact or() * doubleTapZoomAlreadyLegibleRatio;
1186 1188
1187 // Test double-tap zooming into wide div. 1189 // Test double-tap zooming into wide div.
1188 wideBlockBounds = webViewImpl()->computeBlockBounds(doubleTapPointWide, fals e); 1190 wideBlockBounds = webViewImpl()->computeBlockBounds(doubleTapPointWide, fals e);
1189 webViewImpl()->computeScaleAndScrollForBlockRect(wideBlockBounds, touchPoint Padding, scale, scroll, doubleTapShouldZoomOut); 1191 webViewImpl()->computeScaleAndScrollForBlockRect(wideBlockBounds, touchPoint Padding, doubleTapZoomAlreadyLegibleScale, scale, scroll);
1190 // The div should horizontally fill the screen (modulo margins), and 1192 // The div should horizontally fill the screen (modulo margins), and
1191 // vertically centered (modulo integer rounding). 1193 // vertically centered (modulo integer rounding).
1192 EXPECT_NEAR(viewportWidth / (float) wideDiv.width, scale, 0.1); 1194 EXPECT_NEAR(viewportWidth / (float) wideDiv.width, scale, 0.1);
1193 EXPECT_NEAR(wideDiv.x, scroll.x, 20); 1195 EXPECT_NEAR(wideDiv.x, scroll.x, 20);
1194 EXPECT_EQ(0, scroll.y); 1196 EXPECT_EQ(0, scroll.y);
1195 EXPECT_FALSE(doubleTapShouldZoomOut);
1196 1197
1197 setScaleAndScrollAndLayout(webViewImpl(), scroll, scale); 1198 setScaleAndScrollAndLayout(webViewImpl(), scroll, scale);
1198 1199
1199 // Test zoom out back to minimum scale. 1200 // Test zoom out back to minimum scale.
1200 wideBlockBounds = webViewImpl()->computeBlockBounds(doubleTapPointWide, fals e); 1201 wideBlockBounds = webViewImpl()->computeBlockBounds(doubleTapPointWide, fals e);
1201 webViewImpl()->computeScaleAndScrollForBlockRect(wideBlockBounds, touchPoint Padding, scale, scroll, doubleTapShouldZoomOut); 1202 webViewImpl()->computeScaleAndScrollForBlockRect(wideBlockBounds, touchPoint Padding, doubleTapZoomAlreadyLegibleScale, scale, scroll);
1202 EXPECT_TRUE(doubleTapShouldZoomOut);
1203 1203
1204 scale = webViewImpl()->minimumPageScaleFactor(); 1204 scale = webViewImpl()->minimumPageScaleFactor();
1205 setScaleAndScrollAndLayout(webViewImpl(), WebPoint(0, 0), scale); 1205 setScaleAndScrollAndLayout(webViewImpl(), WebPoint(0, 0), scale);
1206 1206
1207 // Test double-tap zooming into tall div. 1207 // Test double-tap zooming into tall div.
1208 tallBlockBounds = webViewImpl()->computeBlockBounds(doubleTapPointTall, fals e); 1208 tallBlockBounds = webViewImpl()->computeBlockBounds(doubleTapPointTall, fals e);
1209 webViewImpl()->computeScaleAndScrollForBlockRect(tallBlockBounds, touchPoint Padding, scale, scroll, doubleTapShouldZoomOut); 1209 webViewImpl()->computeScaleAndScrollForBlockRect(tallBlockBounds, touchPoint Padding, doubleTapZoomAlreadyLegibleScale, scale, scroll);
1210 // The div should start at the top left of the viewport. 1210 // The div should start at the top left of the viewport.
1211 EXPECT_NEAR(viewportWidth / (float) tallDiv.width, scale, 0.1); 1211 EXPECT_NEAR(viewportWidth / (float) tallDiv.width, scale, 0.1);
1212 EXPECT_NEAR(tallDiv.x, scroll.x, 20); 1212 EXPECT_NEAR(tallDiv.x, scroll.x, 20);
1213 EXPECT_NEAR(tallDiv.y, scroll.y, 20); 1213 EXPECT_NEAR(tallDiv.y, scroll.y, 20);
1214 EXPECT_FALSE(doubleTapShouldZoomOut);
1215 1214
1216 // Test for Non-doubletap scaling 1215 // Test for Non-doubletap scaling
1217 // Test zooming into div. 1216 // Test zooming into div.
1218 webViewImpl()->computeScaleAndScrollForBlockRect(webViewImpl()->computeBlock Bounds(WebRect(250, 250, 10, 10), true), 0, scale, scroll, doubleTapShouldZoomOu t); 1217 webViewImpl()->computeScaleAndScrollForBlockRect(webViewImpl()->computeBlock Bounds(WebRect(250, 250, 10, 10), true), 0, doubleTapZoomAlreadyLegibleScale, sc ale, scroll);
1219 EXPECT_NEAR(viewportWidth / (float) wideDiv.width, scale, 0.1); 1218 EXPECT_NEAR(viewportWidth / (float) wideDiv.width, scale, 0.1);
1220 } 1219 }
1221 1220
1222 void simulatePageScale(WebViewImpl* webViewImpl, float& scale) 1221 void simulatePageScale(WebViewImpl* webViewImpl, float& scale)
1223 { 1222 {
1224 WebCore::IntSize scrollDelta = webViewImpl->fakePageScaleAnimationTargetPosi tionForTesting() - webViewImpl->mainFrameImpl()->frameView()->scrollPosition(); 1223 WebCore::IntSize scrollDelta = webViewImpl->fakePageScaleAnimationTargetPosi tionForTesting() - webViewImpl->mainFrameImpl()->frameView()->scrollPosition();
1225 float scaleDelta = webViewImpl->fakePageScaleAnimationPageScaleForTesting() / webViewImpl->pageScaleFactor(); 1224 float scaleDelta = webViewImpl->fakePageScaleAnimationPageScaleForTesting() / webViewImpl->pageScaleFactor();
1226 webViewImpl->applyScrollAndScale(scrollDelta, scaleDelta); 1225 webViewImpl->applyScrollAndScale(scrollDelta, scaleDelta);
1227 scale = webViewImpl->pageScaleFactor(); 1226 scale = webViewImpl->pageScaleFactor();
1228 } 1227 }
1229 1228
1230 void simulateMultiTargetZoom(WebViewImpl* webViewImpl, const WebRect& rect, floa t& scale) 1229 void simulateMultiTargetZoom(WebViewImpl* webViewImpl, const WebRect& rect, floa t& scale)
1231 { 1230 {
1232 if (webViewImpl->zoomToMultipleTargetsRect(rect)) 1231 if (webViewImpl->zoomToMultipleTargetsRect(rect))
1233 simulatePageScale(webViewImpl, scale); 1232 simulatePageScale(webViewImpl, scale);
1234 } 1233 }
1235 1234
1236 void simulateDoubleTap(WebViewImpl* webViewImpl, WebPoint& point, float& scale) 1235 void simulateDoubleTap(WebViewImpl* webViewImpl, WebPoint& point, float& scale)
1237 { 1236 {
1238 webViewImpl->animateDoubleTapZoom(point); 1237 webViewImpl->animateDoubleTapZoom(point);
1239 EXPECT_TRUE(webViewImpl->fakeDoubleTapAnimationPendingForTesting()); 1238 EXPECT_TRUE(webViewImpl->fakeDoubleTapAnimationPendingForTesting());
1240 simulatePageScale(webViewImpl, scale); 1239 simulatePageScale(webViewImpl, scale);
1241 } 1240 }
1242 1241
1242 TEST_F(WebFrameTest, DivAutoZoomWideDivTest)
1243 {
1244 registerMockedHttpURLLoad("get_wide_div_for_auto_zoom_test.html");
1245
1246 const float deviceScaleFactor = 2.0f;
1247 int viewportWidth = 640 / deviceScaleFactor;
1248 int viewportHeight = 1280 / deviceScaleFactor;
1249 float doubleTapZoomAlreadyLegibleRatio = 1.2f;
1250 m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "get_wide_div _for_auto_zoom_test.html");
1251 m_webView->enableFixedLayoutMode(true);
1252 m_webView->resize(WebSize(viewportWidth, viewportHeight));
1253 m_webView->setPageScaleFactorLimits(1.0f, 4);
1254 m_webView->setDeviceScaleFactor(deviceScaleFactor);
1255 m_webView->setPageScaleFactor(1.0f, WebPoint(0, 0));
1256 m_webView->layout();
1257
1258 webViewImpl()->enableFakePageScaleAnimationForTesting(true);
1259
1260 float doubleTapZoomAlreadyLegibleScale = webViewImpl()->minimumPageScaleFact or() * doubleTapZoomAlreadyLegibleRatio;
1261
1262 WebRect div(0, 100, viewportWidth, 150);
1263 WebPoint point(div.x + 50, div.y + 50);
1264 float scale;
1265 setScaleAndScrollAndLayout(webViewImpl(), WebPoint(0, 0), (webViewImpl()->mi nimumPageScaleFactor()) * (1 + doubleTapZoomAlreadyLegibleRatio) / 2);
1266
1267 simulateDoubleTap(webViewImpl(), point, scale);
1268 EXPECT_FLOAT_EQ(doubleTapZoomAlreadyLegibleScale, scale);
1269 simulateDoubleTap(webViewImpl(), point, scale);
1270 EXPECT_FLOAT_EQ(webViewImpl()->minimumPageScaleFactor(), scale);
1271 }
1272
1243 TEST_F(WebFrameTest, DivAutoZoomMultipleDivsTest) 1273 TEST_F(WebFrameTest, DivAutoZoomMultipleDivsTest)
1244 { 1274 {
1245 registerMockedHttpURLLoad("get_multiple_divs_for_auto_zoom_test.html"); 1275 registerMockedHttpURLLoad("get_multiple_divs_for_auto_zoom_test.html");
1246 1276
1247 const float deviceScaleFactor = 2.0f; 1277 const float deviceScaleFactor = 2.0f;
1248 int viewportWidth = 640 / deviceScaleFactor; 1278 int viewportWidth = 640 / deviceScaleFactor;
1249 int viewportHeight = 1280 / deviceScaleFactor; 1279 int viewportHeight = 1280 / deviceScaleFactor;
1250 float doubleTapZoomAlreadyLegibleRatio = 1.2f; 1280 float doubleTapZoomAlreadyLegibleRatio = 1.2f;
1251 m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "get_multiple _divs_for_auto_zoom_test.html"); 1281 m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "get_multiple _divs_for_auto_zoom_test.html");
1252 m_webView->enableFixedLayoutMode(true); 1282 m_webView->enableFixedLayoutMode(true);
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
1322 EXPECT_FLOAT_EQ(1, scale); 1352 EXPECT_FLOAT_EQ(1, scale);
1323 1353
1324 // Zoom in to reset double_tap_zoom_in_effect flag. 1354 // Zoom in to reset double_tap_zoom_in_effect flag.
1325 webViewImpl()->applyScrollAndScale(WebSize(), 1.1f); 1355 webViewImpl()->applyScrollAndScale(WebSize(), 1.1f);
1326 // 1 < minimumPageScale < doubleTapZoomAlreadyLegibleScale 1356 // 1 < minimumPageScale < doubleTapZoomAlreadyLegibleScale
1327 m_webView->setPageScaleFactorLimits(1.1f, 4); 1357 m_webView->setPageScaleFactorLimits(1.1f, 4);
1328 m_webView->layout(); 1358 m_webView->layout();
1329 doubleTapZoomAlreadyLegibleScale = webViewImpl()->minimumPageScaleFactor() * doubleTapZoomAlreadyLegibleRatio; 1359 doubleTapZoomAlreadyLegibleScale = webViewImpl()->minimumPageScaleFactor() * doubleTapZoomAlreadyLegibleRatio;
1330 setScaleAndScrollAndLayout(webViewImpl(), WebPoint(0, 0), (webViewImpl()->mi nimumPageScaleFactor()) * (1 + doubleTapZoomAlreadyLegibleRatio) / 2); 1360 setScaleAndScrollAndLayout(webViewImpl(), WebPoint(0, 0), (webViewImpl()->mi nimumPageScaleFactor()) * (1 + doubleTapZoomAlreadyLegibleRatio) / 2);
1331 simulateDoubleTap(webViewImpl(), doubleTapPoint, scale); 1361 simulateDoubleTap(webViewImpl(), doubleTapPoint, scale);
1362 EXPECT_FLOAT_EQ(doubleTapZoomAlreadyLegibleScale, scale);
1363 simulateDoubleTap(webViewImpl(), doubleTapPoint, scale);
1332 EXPECT_FLOAT_EQ(webViewImpl()->minimumPageScaleFactor(), scale); 1364 EXPECT_FLOAT_EQ(webViewImpl()->minimumPageScaleFactor(), scale);
1333 simulateDoubleTap(webViewImpl(), doubleTapPoint, scale); 1365 simulateDoubleTap(webViewImpl(), doubleTapPoint, scale);
1334 EXPECT_FLOAT_EQ(doubleTapZoomAlreadyLegibleScale, scale); 1366 EXPECT_FLOAT_EQ(doubleTapZoomAlreadyLegibleScale, scale);
1335 simulateDoubleTap(webViewImpl(), doubleTapPoint, scale);
1336 EXPECT_FLOAT_EQ(webViewImpl()->minimumPageScaleFactor(), scale);
1337 1367
1338 // Zoom in to reset double_tap_zoom_in_effect flag. 1368 // Zoom in to reset double_tap_zoom_in_effect flag.
1339 webViewImpl()->applyScrollAndScale(WebSize(), 1.1f); 1369 webViewImpl()->applyScrollAndScale(WebSize(), 1.1f);
1340 // minimumPageScale < 1 < doubleTapZoomAlreadyLegibleScale 1370 // minimumPageScale < 1 < doubleTapZoomAlreadyLegibleScale
1341 m_webView->setPageScaleFactorLimits(0.95f, 4); 1371 m_webView->setPageScaleFactorLimits(0.95f, 4);
1342 m_webView->layout(); 1372 m_webView->layout();
1343 doubleTapZoomAlreadyLegibleScale = webViewImpl()->minimumPageScaleFactor() * doubleTapZoomAlreadyLegibleRatio; 1373 doubleTapZoomAlreadyLegibleScale = webViewImpl()->minimumPageScaleFactor() * doubleTapZoomAlreadyLegibleRatio;
1344 setScaleAndScrollAndLayout(webViewImpl(), WebPoint(0, 0), (webViewImpl()->mi nimumPageScaleFactor()) * (1 + doubleTapZoomAlreadyLegibleRatio) / 2); 1374 setScaleAndScrollAndLayout(webViewImpl(), WebPoint(0, 0), (webViewImpl()->mi nimumPageScaleFactor()) * (1 + doubleTapZoomAlreadyLegibleRatio) / 2);
1345 simulateDoubleTap(webViewImpl(), doubleTapPoint, scale); 1375 simulateDoubleTap(webViewImpl(), doubleTapPoint, scale);
1376 EXPECT_FLOAT_EQ(doubleTapZoomAlreadyLegibleScale, scale);
1377 simulateDoubleTap(webViewImpl(), doubleTapPoint, scale);
1346 EXPECT_FLOAT_EQ(webViewImpl()->minimumPageScaleFactor(), scale); 1378 EXPECT_FLOAT_EQ(webViewImpl()->minimumPageScaleFactor(), scale);
1347 simulateDoubleTap(webViewImpl(), doubleTapPoint, scale); 1379 simulateDoubleTap(webViewImpl(), doubleTapPoint, scale);
1348 EXPECT_FLOAT_EQ(doubleTapZoomAlreadyLegibleScale, scale); 1380 EXPECT_FLOAT_EQ(doubleTapZoomAlreadyLegibleScale, scale);
1349 simulateDoubleTap(webViewImpl(), doubleTapPoint, scale);
1350 EXPECT_FLOAT_EQ(webViewImpl()->minimumPageScaleFactor(), scale);
1351 } 1381 }
1352 1382
1353 TEST_F(WebFrameTest, DivAutoZoomScaleFontScaleFactorTest) 1383 TEST_F(WebFrameTest, DivAutoZoomScaleFontScaleFactorTest)
1354 { 1384 {
1355 registerMockedHttpURLLoad("get_scale_bounds_check_for_auto_zoom_test.html"); 1385 registerMockedHttpURLLoad("get_scale_bounds_check_for_auto_zoom_test.html");
1356 1386
1357 int viewportWidth = 320; 1387 int viewportWidth = 320;
1358 int viewportHeight = 480; 1388 int viewportHeight = 480;
1359 float doubleTapZoomAlreadyLegibleRatio = 1.2f; 1389 float doubleTapZoomAlreadyLegibleRatio = 1.2f;
1360 float textAutosizingFontScaleFactor = 1.13f; 1390 float textAutosizingFontScaleFactor = 1.13f;
1361 m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "get_scale_bo unds_check_for_auto_zoom_test.html"); 1391 m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "get_scale_bo unds_check_for_auto_zoom_test.html");
1362 m_webView->enableFixedLayoutMode(true); 1392 m_webView->enableFixedLayoutMode(true);
1363 m_webView->resize(WebSize(viewportWidth, viewportHeight)); 1393 m_webView->resize(WebSize(viewportWidth, viewportHeight));
1364 m_webView->layout(); 1394 m_webView->layout();
1365 1395
1366 webViewImpl()->enableFakePageScaleAnimationForTesting(true); 1396 webViewImpl()->enableFakePageScaleAnimationForTesting(true);
1397 webViewImpl()->page()->settings().setTextAutosizingEnabled(true);
1367 webViewImpl()->page()->settings().setTextAutosizingFontScaleFactor(textAutos izingFontScaleFactor); 1398 webViewImpl()->page()->settings().setTextAutosizingFontScaleFactor(textAutos izingFontScaleFactor);
1368 1399
1369 WebRect div(200, 100, 200, 150); 1400 WebRect div(200, 100, 200, 150);
1370 WebPoint doubleTapPoint(div.x + 50, div.y + 50); 1401 WebPoint doubleTapPoint(div.x + 50, div.y + 50);
1371 float scale; 1402 float scale;
1372 1403
1373 // Test double tap scale bounds. 1404 // Test double tap scale bounds.
1374 // minimumPageScale < doubleTapZoomAlreadyLegibleScale < 1 < textAutosizingF ontScaleFactor 1405 // minimumPageScale < doubleTapZoomAlreadyLegibleScale < 1 < textAutosizingF ontScaleFactor
1375 float legibleScale = textAutosizingFontScaleFactor; 1406 float legibleScale = textAutosizingFontScaleFactor;
1376 setScaleAndScrollAndLayout(webViewImpl(), WebPoint(0, 0), (webViewImpl()->mi nimumPageScaleFactor()) * (1 + doubleTapZoomAlreadyLegibleRatio) / 2); 1407 setScaleAndScrollAndLayout(webViewImpl(), WebPoint(0, 0), (webViewImpl()->mi nimumPageScaleFactor()) * (1 + doubleTapZoomAlreadyLegibleRatio) / 2);
1377 float doubleTapZoomAlreadyLegibleScale = webViewImpl()->minimumPageScaleFact or() * doubleTapZoomAlreadyLegibleRatio; 1408 float doubleTapZoomAlreadyLegibleScale = webViewImpl()->minimumPageScaleFact or() * doubleTapZoomAlreadyLegibleRatio;
1378 m_webView->setPageScaleFactorLimits(0.5f, 4); 1409 m_webView->setPageScaleFactorLimits(0.5f, 4);
1379 m_webView->layout(); 1410 m_webView->layout();
1380 simulateDoubleTap(webViewImpl(), doubleTapPoint, scale); 1411 simulateDoubleTap(webViewImpl(), doubleTapPoint, scale);
1381 EXPECT_FLOAT_EQ(legibleScale, scale); 1412 EXPECT_FLOAT_EQ(legibleScale, scale);
1382 simulateDoubleTap(webViewImpl(), doubleTapPoint, scale); 1413 simulateDoubleTap(webViewImpl(), doubleTapPoint, scale);
1383 EXPECT_FLOAT_EQ(webViewImpl()->minimumPageScaleFactor(), scale); 1414 EXPECT_FLOAT_EQ(webViewImpl()->minimumPageScaleFactor(), scale);
1384 simulateDoubleTap(webViewImpl(), doubleTapPoint, scale); 1415 simulateDoubleTap(webViewImpl(), doubleTapPoint, scale);
1385 EXPECT_FLOAT_EQ(legibleScale, scale); 1416 EXPECT_FLOAT_EQ(legibleScale, scale);
1386 1417
1387 // Zoom in to reset double_tap_zoom_in_effect flag. 1418 // Zoom in to reset double_tap_zoom_in_effect flag.
1388 webViewImpl()->applyScrollAndScale(WebSize(), 1.1f); 1419 webViewImpl()->applyScrollAndScale(WebSize(), 1.1f);
1389 // 1 < textAutosizingFontScaleFactor < minimumPageScale < doubleTapZoomAlrea dyLegibleScale 1420 // 1 < textAutosizingFontScaleFactor < minimumPageScale < doubleTapZoomAlrea dyLegibleScale
1390 m_webView->setPageScaleFactorLimits(1.0f, 4); 1421 m_webView->setPageScaleFactorLimits(1.0f, 4);
1391 m_webView->layout(); 1422 m_webView->layout();
1392 doubleTapZoomAlreadyLegibleScale = webViewImpl()->minimumPageScaleFactor() * doubleTapZoomAlreadyLegibleRatio; 1423 doubleTapZoomAlreadyLegibleScale = webViewImpl()->minimumPageScaleFactor() * doubleTapZoomAlreadyLegibleRatio;
1393 setScaleAndScrollAndLayout(webViewImpl(), WebPoint(0, 0), (webViewImpl()->mi nimumPageScaleFactor()) * (1 + doubleTapZoomAlreadyLegibleRatio) / 2); 1424 setScaleAndScrollAndLayout(webViewImpl(), WebPoint(0, 0), (webViewImpl()->mi nimumPageScaleFactor()) * (1 + doubleTapZoomAlreadyLegibleRatio) / 2);
1394 simulateDoubleTap(webViewImpl(), doubleTapPoint, scale); 1425 simulateDoubleTap(webViewImpl(), doubleTapPoint, scale);
1426 EXPECT_FLOAT_EQ(doubleTapZoomAlreadyLegibleScale, scale);
1427 simulateDoubleTap(webViewImpl(), doubleTapPoint, scale);
1395 EXPECT_FLOAT_EQ(webViewImpl()->minimumPageScaleFactor(), scale); 1428 EXPECT_FLOAT_EQ(webViewImpl()->minimumPageScaleFactor(), scale);
1396 simulateDoubleTap(webViewImpl(), doubleTapPoint, scale); 1429 simulateDoubleTap(webViewImpl(), doubleTapPoint, scale);
1397 EXPECT_FLOAT_EQ(doubleTapZoomAlreadyLegibleScale, scale); 1430 EXPECT_FLOAT_EQ(doubleTapZoomAlreadyLegibleScale, scale);
1398 simulateDoubleTap(webViewImpl(), doubleTapPoint, scale);
1399 EXPECT_FLOAT_EQ(webViewImpl()->minimumPageScaleFactor(), scale);
1400 1431
1401 // Zoom in to reset double_tap_zoom_in_effect flag. 1432 // Zoom in to reset double_tap_zoom_in_effect flag.
1402 webViewImpl()->applyScrollAndScale(WebSize(), 1.1f); 1433 webViewImpl()->applyScrollAndScale(WebSize(), 1.1f);
1403 // minimumPageScale < 1 < textAutosizingFontScaleFactor < doubleTapZoomAlrea dyLegibleScale 1434 // minimumPageScale < 1 < textAutosizingFontScaleFactor < doubleTapZoomAlrea dyLegibleScale
1404 m_webView->setPageScaleFactorLimits(0.95f, 4); 1435 m_webView->setPageScaleFactorLimits(0.95f, 4);
1405 m_webView->layout(); 1436 m_webView->layout();
1406 doubleTapZoomAlreadyLegibleScale = webViewImpl()->minimumPageScaleFactor() * doubleTapZoomAlreadyLegibleRatio; 1437 doubleTapZoomAlreadyLegibleScale = webViewImpl()->minimumPageScaleFactor() * doubleTapZoomAlreadyLegibleRatio;
1407 setScaleAndScrollAndLayout(webViewImpl(), WebPoint(0, 0), (webViewImpl()->mi nimumPageScaleFactor()) * (1 + doubleTapZoomAlreadyLegibleRatio) / 2); 1438 setScaleAndScrollAndLayout(webViewImpl(), WebPoint(0, 0), (webViewImpl()->mi nimumPageScaleFactor()) * (1 + doubleTapZoomAlreadyLegibleRatio) / 2);
1408 simulateDoubleTap(webViewImpl(), doubleTapPoint, scale); 1439 simulateDoubleTap(webViewImpl(), doubleTapPoint, scale);
1440 EXPECT_FLOAT_EQ(doubleTapZoomAlreadyLegibleScale, scale);
1441 simulateDoubleTap(webViewImpl(), doubleTapPoint, scale);
1409 EXPECT_FLOAT_EQ(webViewImpl()->minimumPageScaleFactor(), scale); 1442 EXPECT_FLOAT_EQ(webViewImpl()->minimumPageScaleFactor(), scale);
1410 simulateDoubleTap(webViewImpl(), doubleTapPoint, scale); 1443 simulateDoubleTap(webViewImpl(), doubleTapPoint, scale);
1411 EXPECT_FLOAT_EQ(doubleTapZoomAlreadyLegibleScale, scale); 1444 EXPECT_FLOAT_EQ(doubleTapZoomAlreadyLegibleScale, scale);
1412 simulateDoubleTap(webViewImpl(), doubleTapPoint, scale);
1413 EXPECT_FLOAT_EQ(webViewImpl()->minimumPageScaleFactor(), scale);
1414 1445
1415 // Zoom in to reset double_tap_zoom_in_effect flag. 1446 // Zoom in to reset double_tap_zoom_in_effect flag.
1416 webViewImpl()->applyScrollAndScale(WebSize(), 1.1f); 1447 webViewImpl()->applyScrollAndScale(WebSize(), 1.1f);
1417 // minimumPageScale < 1 < doubleTapZoomAlreadyLegibleScale < textAutosizingF ontScaleFactor 1448 // minimumPageScale < 1 < doubleTapZoomAlreadyLegibleScale < textAutosizingF ontScaleFactor
1418 m_webView->setPageScaleFactorLimits(0.9f, 4); 1449 m_webView->setPageScaleFactorLimits(0.9f, 4);
1419 m_webView->layout(); 1450 m_webView->layout();
1420 doubleTapZoomAlreadyLegibleScale = webViewImpl()->minimumPageScaleFactor() * doubleTapZoomAlreadyLegibleRatio; 1451 doubleTapZoomAlreadyLegibleScale = webViewImpl()->minimumPageScaleFactor() * doubleTapZoomAlreadyLegibleRatio;
1421 setScaleAndScrollAndLayout(webViewImpl(), WebPoint(0, 0), (webViewImpl()->mi nimumPageScaleFactor()) * (1 + doubleTapZoomAlreadyLegibleRatio) / 2); 1452 setScaleAndScrollAndLayout(webViewImpl(), WebPoint(0, 0), (webViewImpl()->mi nimumPageScaleFactor()) * (1 + doubleTapZoomAlreadyLegibleRatio) / 2);
1422 simulateDoubleTap(webViewImpl(), doubleTapPoint, scale); 1453 simulateDoubleTap(webViewImpl(), doubleTapPoint, scale);
1423 EXPECT_FLOAT_EQ(legibleScale, scale); 1454 EXPECT_FLOAT_EQ(legibleScale, scale);
(...skipping 2169 matching lines...) Expand 10 before | Expand all | Expand 10 after
3593 m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "push_state.h tml", true, 0, &client); 3624 m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "push_state.h tml", true, 0, &client);
3594 runPendingTasks(); 3625 runPendingTasks();
3595 3626
3596 EXPECT_EQ(client.startLoadingCount(), 2); 3627 EXPECT_EQ(client.startLoadingCount(), 2);
3597 EXPECT_EQ(client.stopLoadingCount(), 2); 3628 EXPECT_EQ(client.stopLoadingCount(), 2);
3598 m_webView->close(); 3629 m_webView->close();
3599 m_webView = 0; 3630 m_webView = 0;
3600 } 3631 }
3601 3632
3602 } // namespace 3633 } // namespace
OLDNEW
« no previous file with comments | « Source/web/WebViewImpl.cpp ('k') | Source/web/tests/data/get_wide_div_for_auto_zoom_test.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698