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 1299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1310 EXPECT_EQ(0.0, compositor->containerLayer()->size().height()); | 1310 EXPECT_EQ(0.0, compositor->containerLayer()->size().height()); |
1311 | 1311 |
1312 // Two flags PinchVirtualViewportEnabled and ForceZeroLayoutHeight will caus e the following | 1312 // Two flags PinchVirtualViewportEnabled and ForceZeroLayoutHeight will caus e the following |
1313 // resize of viewport height to be ignored by the outer viewport (the contai ner layer of | 1313 // resize of viewport height to be ignored by the outer viewport (the contai ner layer of |
1314 // LayerCompositor). The height of the pinchViewport, however, is not affect ed. | 1314 // LayerCompositor). The height of the pinchViewport, however, is not affect ed. |
1315 webViewHelper.webView()->resize(WebSize(viewportWidth, viewportHeight)); | 1315 webViewHelper.webView()->resize(WebSize(viewportWidth, viewportHeight)); |
1316 EXPECT_FALSE(webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->need sLayout()); | 1316 EXPECT_FALSE(webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->need sLayout()); |
1317 EXPECT_EQ(viewportWidth, webViewHelper.webViewImpl()->mainFrameImpl()->frame View()->layoutSize().width()); | 1317 EXPECT_EQ(viewportWidth, webViewHelper.webViewImpl()->mainFrameImpl()->frame View()->layoutSize().width()); |
1318 EXPECT_EQ(0, webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->layo utSize().height()); | 1318 EXPECT_EQ(0, webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->layo utSize().height()); |
1319 EXPECT_EQ(viewportWidth, compositor->containerLayer()->size().width()); | 1319 EXPECT_EQ(viewportWidth, compositor->containerLayer()->size().width()); |
1320 EXPECT_EQ(0.0, compositor->containerLayer()->size().height()); | |
1321 | 1320 |
1322 LocalFrame* frame = webViewHelper.webViewImpl()->mainFrameImpl()->frame(); | 1321 LocalFrame* frame = webViewHelper.webViewImpl()->mainFrameImpl()->frame(); |
1323 PinchViewport& pinchViewport = frame->page()->frameHost().pinchViewport(); | 1322 PinchViewport& pinchViewport = frame->page()->frameHost().pinchViewport(); |
1324 EXPECT_EQ(viewportHeight, pinchViewport.containerLayer()->size().height()); | 1323 EXPECT_EQ(viewportHeight, pinchViewport.containerLayer()->size().height()); |
1325 EXPECT_TRUE(pinchViewport.containerLayer()->platformLayer()->masksToBounds() ); | 1324 EXPECT_TRUE(pinchViewport.containerLayer()->platformLayer()->masksToBounds() ); |
1326 EXPECT_FALSE(compositor->containerLayer()->platformLayer()->masksToBounds()) ; | 1325 EXPECT_FALSE(compositor->containerLayer()->platformLayer()->masksToBounds()) ; |
1327 } | 1326 } |
1328 | 1327 |
1329 TEST_F(WebFrameTest, SetForceZeroLayoutHeight) | 1328 TEST_F(WebFrameTest, SetForceZeroLayoutHeight) |
1330 { | 1329 { |
(...skipping 22 matching lines...) Expand all Loading... | |
1353 EXPECT_EQ(0, webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->layo utSize().height()); | 1352 EXPECT_EQ(0, webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->layo utSize().height()); |
1354 | 1353 |
1355 webViewHelper.webView()->resize(WebSize(viewportWidth * 2, viewportHeight)); | 1354 webViewHelper.webView()->resize(WebSize(viewportWidth * 2, viewportHeight)); |
1356 webViewHelper.webView()->layout(); | 1355 webViewHelper.webView()->layout(); |
1357 EXPECT_EQ(0, webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->layo utSize().height()); | 1356 EXPECT_EQ(0, webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->layo utSize().height()); |
1358 | 1357 |
1359 webViewHelper.webView()->settings()->setForceZeroLayoutHeight(false); | 1358 webViewHelper.webView()->settings()->setForceZeroLayoutHeight(false); |
1360 EXPECT_LE(viewportHeight, webViewHelper.webViewImpl()->mainFrameImpl()->fram eView()->layoutSize().height()); | 1359 EXPECT_LE(viewportHeight, webViewHelper.webViewImpl()->mainFrameImpl()->fram eView()->layoutSize().height()); |
1361 } | 1360 } |
1362 | 1361 |
1362 TEST_F(WebFrameTest, SetForceZeroLayoutHeightWorksWithRelayoutsWhenHeightChanged ) | |
1363 { | |
1364 UseMockScrollbarSettings mockScrollbarSettings; | |
1365 registerMockedHttpURLLoad("button.html"); | |
1366 | |
1367 FixedLayoutTestWebViewClient client; | |
1368 client.m_screenInfo.deviceScaleFactor = 1; | |
1369 int viewportWidth = 640; | |
1370 int viewportHeight = 480; | |
1371 | |
1372 FrameTestHelpers::WebViewHelper webViewHelper; | |
1373 | |
1374 webViewHelper.initializeAndLoad(m_baseURL + "button.html", true, 0, &client, configurePinchVirtualViewport); | |
1375 webViewHelper.webView()->resize(WebSize(viewportWidth, 0)); | |
aelias_OOO_until_Jul13
2015/02/12 19:49:17
I don't think we should be setting 0 viewport heig
boliu
2015/02/12 20:04:43
It does happen in reality. Some apps with wrap-con
aelias_OOO_until_Jul13
2015/02/12 20:08:37
OK then, fine to leave as is, thanks for the clari
boliu
2015/02/12 20:10:27
Should add some comments explaining this. No one w
gsennton
2015/02/13 19:11:15
Done.
| |
1376 webViewHelper.webView()->layout(); | |
1377 | |
1378 webViewHelper.webView()->settings()->setForceZeroLayoutHeight(true); | |
1379 EXPECT_TRUE(webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->needs Layout()); | |
1380 | |
1381 webViewHelper.webView()->resize(WebSize(viewportWidth, viewportHeight)); | |
1382 | |
1383 IntPoint hitPoint = IntPoint(30, 30); // button size is 100x100 | |
1384 | |
1385 RefPtrWillBeRawPtr<Node> hitNode = webViewHelper.webViewImpl()->mainFrameImp l()->frame()->eventHandler().hitTestResultAtPoint(hitPoint, HitTestRequest::Read Only | HitTestRequest::Active).innerNode(); | |
aelias_OOO_until_Jul13
2015/02/12 19:49:17
Could you send down an input event via handleGestu
gsennton
2015/02/13 19:11:15
Done.
| |
1386 EXPECT_NE(nullptr, hitNode.get()); | |
1387 EXPECT_EQ(String("BUTTON"), hitNode->nodeName()); | |
1388 } | |
1389 | |
1363 TEST_F(WebFrameTest, SetForceZeroLayoutHeightWorksAcrossNavigations) | 1390 TEST_F(WebFrameTest, SetForceZeroLayoutHeightWorksAcrossNavigations) |
1364 { | 1391 { |
1365 UseMockScrollbarSettings mockScrollbarSettings; | 1392 UseMockScrollbarSettings mockScrollbarSettings; |
1366 registerMockedHttpURLLoad("200-by-300.html"); | 1393 registerMockedHttpURLLoad("200-by-300.html"); |
1367 registerMockedHttpURLLoad("large-div.html"); | 1394 registerMockedHttpURLLoad("large-div.html"); |
1368 | 1395 |
1369 FixedLayoutTestWebViewClient client; | 1396 FixedLayoutTestWebViewClient client; |
1370 client.m_screenInfo.deviceScaleFactor = 1; | 1397 client.m_screenInfo.deviceScaleFactor = 1; |
1371 int viewportWidth = 640; | 1398 int viewportWidth = 640; |
1372 int viewportHeight = 480; | 1399 int viewportHeight = 480; |
(...skipping 5691 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
7064 EXPECT_EQ(1u, frameClient.navigationalDataReceivedCount()); | 7091 EXPECT_EQ(1u, frameClient.navigationalDataReceivedCount()); |
7065 | 7092 |
7066 // Neither should a page reload. | 7093 // Neither should a page reload. |
7067 localFrame->reload(); | 7094 localFrame->reload(); |
7068 EXPECT_EQ(4u, frameClient.provisionalLoadCount()); | 7095 EXPECT_EQ(4u, frameClient.provisionalLoadCount()); |
7069 EXPECT_FALSE(frameClient.wasLastProvisionalLoadATransition()); | 7096 EXPECT_FALSE(frameClient.wasLastProvisionalLoadATransition()); |
7070 EXPECT_EQ(1u, frameClient.navigationalDataReceivedCount()); | 7097 EXPECT_EQ(1u, frameClient.navigationalDataReceivedCount()); |
7071 } | 7098 } |
7072 | 7099 |
7073 } // namespace | 7100 } // namespace |
OLD | NEW |