| 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 2348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2359 // Test for Non-doubletap scaling | 2359 // Test for Non-doubletap scaling |
| 2360 // Test zooming into div. | 2360 // Test zooming into div. |
| 2361 webViewHelper.webViewImpl()->computeScaleAndScrollForBlockRect(WebPoint(250,
250), webViewHelper.webViewImpl()->computeBlockBounds(WebRect(250, 250, 10, 10)
, true), 0, doubleTapZoomAlreadyLegibleScale, scale, scroll); | 2361 webViewHelper.webViewImpl()->computeScaleAndScrollForBlockRect(WebPoint(250,
250), webViewHelper.webViewImpl()->computeBlockBounds(WebRect(250, 250, 10, 10)
, true), 0, doubleTapZoomAlreadyLegibleScale, scale, scroll); |
| 2362 EXPECT_NEAR(viewportWidth / (float) wideDiv.width, scale, 0.1); | 2362 EXPECT_NEAR(viewportWidth / (float) wideDiv.width, scale, 0.1); |
| 2363 } | 2363 } |
| 2364 | 2364 |
| 2365 void simulatePageScale(WebViewImpl* webViewImpl, float& scale) | 2365 void simulatePageScale(WebViewImpl* webViewImpl, float& scale) |
| 2366 { | 2366 { |
| 2367 IntSize scrollDelta = webViewImpl->fakePageScaleAnimationTargetPositionForTe
sting() - webViewImpl->mainFrameImpl()->frameView()->scrollPosition(); | 2367 IntSize scrollDelta = webViewImpl->fakePageScaleAnimationTargetPositionForTe
sting() - webViewImpl->mainFrameImpl()->frameView()->scrollPosition(); |
| 2368 float scaleDelta = webViewImpl->fakePageScaleAnimationPageScaleForTesting()
/ webViewImpl->pageScaleFactor(); | 2368 float scaleDelta = webViewImpl->fakePageScaleAnimationPageScaleForTesting()
/ webViewImpl->pageScaleFactor(); |
| 2369 webViewImpl->applyScrollAndScale(scrollDelta, scaleDelta); | 2369 webViewImpl->applyViewportDeltas(scrollDelta, scaleDelta, 0); |
| 2370 scale = webViewImpl->pageScaleFactor(); | 2370 scale = webViewImpl->pageScaleFactor(); |
| 2371 } | 2371 } |
| 2372 | 2372 |
| 2373 void simulateMultiTargetZoom(WebViewImpl* webViewImpl, const WebRect& rect, floa
t& scale) | 2373 void simulateMultiTargetZoom(WebViewImpl* webViewImpl, const WebRect& rect, floa
t& scale) |
| 2374 { | 2374 { |
| 2375 if (webViewImpl->zoomToMultipleTargetsRect(rect)) | 2375 if (webViewImpl->zoomToMultipleTargetsRect(rect)) |
| 2376 simulatePageScale(webViewImpl, scale); | 2376 simulatePageScale(webViewImpl, scale); |
| 2377 } | 2377 } |
| 2378 | 2378 |
| 2379 void simulateDoubleTap(WebViewImpl* webViewImpl, WebPoint& point, float& scale) | 2379 void simulateDoubleTap(WebViewImpl* webViewImpl, WebPoint& point, float& scale) |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2471 // Test double tap on two different divs | 2471 // Test double tap on two different divs |
| 2472 // After first zoom, we should go back to minimum page scale with a second d
ouble tap. | 2472 // After first zoom, we should go back to minimum page scale with a second d
ouble tap. |
| 2473 simulateDoubleTap(webViewHelper.webViewImpl(), topPoint, scale); | 2473 simulateDoubleTap(webViewHelper.webViewImpl(), topPoint, scale); |
| 2474 EXPECT_FLOAT_EQ(1, scale); | 2474 EXPECT_FLOAT_EQ(1, scale); |
| 2475 simulateDoubleTap(webViewHelper.webViewImpl(), bottomPoint, scale); | 2475 simulateDoubleTap(webViewHelper.webViewImpl(), bottomPoint, scale); |
| 2476 EXPECT_FLOAT_EQ(webViewHelper.webViewImpl()->minimumPageScaleFactor(), scale
); | 2476 EXPECT_FLOAT_EQ(webViewHelper.webViewImpl()->minimumPageScaleFactor(), scale
); |
| 2477 | 2477 |
| 2478 // If the user pinch zooms after double tap, a second double tap should zoom
back to the div. | 2478 // If the user pinch zooms after double tap, a second double tap should zoom
back to the div. |
| 2479 simulateDoubleTap(webViewHelper.webViewImpl(), topPoint, scale); | 2479 simulateDoubleTap(webViewHelper.webViewImpl(), topPoint, scale); |
| 2480 EXPECT_FLOAT_EQ(1, scale); | 2480 EXPECT_FLOAT_EQ(1, scale); |
| 2481 webViewHelper.webViewImpl()->applyScrollAndScale(WebSize(), 0.6f); | 2481 webViewHelper.webViewImpl()->applyViewportDeltas(WebSize(), 0.6f, 0); |
| 2482 simulateDoubleTap(webViewHelper.webViewImpl(), bottomPoint, scale); | 2482 simulateDoubleTap(webViewHelper.webViewImpl(), bottomPoint, scale); |
| 2483 EXPECT_FLOAT_EQ(1, scale); | 2483 EXPECT_FLOAT_EQ(1, scale); |
| 2484 simulateDoubleTap(webViewHelper.webViewImpl(), bottomPoint, scale); | 2484 simulateDoubleTap(webViewHelper.webViewImpl(), bottomPoint, scale); |
| 2485 EXPECT_FLOAT_EQ(webViewHelper.webViewImpl()->minimumPageScaleFactor(), scale
); | 2485 EXPECT_FLOAT_EQ(webViewHelper.webViewImpl()->minimumPageScaleFactor(), scale
); |
| 2486 | 2486 |
| 2487 // If we didn't yet get an auto-zoom update and a second double-tap arrives,
should go back to minimum scale. | 2487 // If we didn't yet get an auto-zoom update and a second double-tap arrives,
should go back to minimum scale. |
| 2488 webViewHelper.webViewImpl()->applyScrollAndScale(WebSize(), 1.1f); | 2488 webViewHelper.webViewImpl()->applyViewportDeltas(WebSize(), 1.1f, 0); |
| 2489 webViewHelper.webViewImpl()->animateDoubleTapZoom(topPoint); | 2489 webViewHelper.webViewImpl()->animateDoubleTapZoom(topPoint); |
| 2490 EXPECT_TRUE(webViewHelper.webViewImpl()->fakeDoubleTapAnimationPendingForTes
ting()); | 2490 EXPECT_TRUE(webViewHelper.webViewImpl()->fakeDoubleTapAnimationPendingForTes
ting()); |
| 2491 simulateDoubleTap(webViewHelper.webViewImpl(), bottomPoint, scale); | 2491 simulateDoubleTap(webViewHelper.webViewImpl(), bottomPoint, scale); |
| 2492 EXPECT_FLOAT_EQ(webViewHelper.webViewImpl()->minimumPageScaleFactor(), scale
); | 2492 EXPECT_FLOAT_EQ(webViewHelper.webViewImpl()->minimumPageScaleFactor(), scale
); |
| 2493 } | 2493 } |
| 2494 | 2494 |
| 2495 TEST_F(WebFrameTest, DivAutoZoomScaleBoundsTest) | 2495 TEST_F(WebFrameTest, DivAutoZoomScaleBoundsTest) |
| 2496 { | 2496 { |
| 2497 registerMockedHttpURLLoad("get_scale_bounds_check_for_auto_zoom_test.html"); | 2497 registerMockedHttpURLLoad("get_scale_bounds_check_for_auto_zoom_test.html"); |
| 2498 | 2498 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 2518 float doubleTapZoomAlreadyLegibleScale = webViewHelper.webViewImpl()->minimu
mPageScaleFactor() * doubleTapZoomAlreadyLegibleRatio; | 2518 float doubleTapZoomAlreadyLegibleScale = webViewHelper.webViewImpl()->minimu
mPageScaleFactor() * doubleTapZoomAlreadyLegibleRatio; |
| 2519 setScaleAndScrollAndLayout(webViewHelper.webViewImpl(), WebPoint(0, 0), (web
ViewHelper.webViewImpl()->minimumPageScaleFactor()) * (1 + doubleTapZoomAlreadyL
egibleRatio) / 2); | 2519 setScaleAndScrollAndLayout(webViewHelper.webViewImpl(), WebPoint(0, 0), (web
ViewHelper.webViewImpl()->minimumPageScaleFactor()) * (1 + doubleTapZoomAlreadyL
egibleRatio) / 2); |
| 2520 simulateDoubleTap(webViewHelper.webViewImpl(), doubleTapPoint, scale); | 2520 simulateDoubleTap(webViewHelper.webViewImpl(), doubleTapPoint, scale); |
| 2521 EXPECT_FLOAT_EQ(1, scale); | 2521 EXPECT_FLOAT_EQ(1, scale); |
| 2522 simulateDoubleTap(webViewHelper.webViewImpl(), doubleTapPoint, scale); | 2522 simulateDoubleTap(webViewHelper.webViewImpl(), doubleTapPoint, scale); |
| 2523 EXPECT_FLOAT_EQ(webViewHelper.webViewImpl()->minimumPageScaleFactor(), scale
); | 2523 EXPECT_FLOAT_EQ(webViewHelper.webViewImpl()->minimumPageScaleFactor(), scale
); |
| 2524 simulateDoubleTap(webViewHelper.webViewImpl(), doubleTapPoint, scale); | 2524 simulateDoubleTap(webViewHelper.webViewImpl(), doubleTapPoint, scale); |
| 2525 EXPECT_FLOAT_EQ(1, scale); | 2525 EXPECT_FLOAT_EQ(1, scale); |
| 2526 | 2526 |
| 2527 // Zoom in to reset double_tap_zoom_in_effect flag. | 2527 // Zoom in to reset double_tap_zoom_in_effect flag. |
| 2528 webViewHelper.webViewImpl()->applyScrollAndScale(WebSize(), 1.1f); | 2528 webViewHelper.webViewImpl()->applyViewportDeltas(WebSize(), 1.1f, 0); |
| 2529 // 1 < minimumPageScale < doubleTapZoomAlreadyLegibleScale | 2529 // 1 < minimumPageScale < doubleTapZoomAlreadyLegibleScale |
| 2530 webViewHelper.webView()->setPageScaleFactorLimits(1.1f, 4); | 2530 webViewHelper.webView()->setPageScaleFactorLimits(1.1f, 4); |
| 2531 webViewHelper.webView()->layout(); | 2531 webViewHelper.webView()->layout(); |
| 2532 doubleTapZoomAlreadyLegibleScale = webViewHelper.webViewImpl()->minimumPageS
caleFactor() * doubleTapZoomAlreadyLegibleRatio; | 2532 doubleTapZoomAlreadyLegibleScale = webViewHelper.webViewImpl()->minimumPageS
caleFactor() * doubleTapZoomAlreadyLegibleRatio; |
| 2533 setScaleAndScrollAndLayout(webViewHelper.webViewImpl(), WebPoint(0, 0), (web
ViewHelper.webViewImpl()->minimumPageScaleFactor()) * (1 + doubleTapZoomAlreadyL
egibleRatio) / 2); | 2533 setScaleAndScrollAndLayout(webViewHelper.webViewImpl(), WebPoint(0, 0), (web
ViewHelper.webViewImpl()->minimumPageScaleFactor()) * (1 + doubleTapZoomAlreadyL
egibleRatio) / 2); |
| 2534 simulateDoubleTap(webViewHelper.webViewImpl(), doubleTapPoint, scale); | 2534 simulateDoubleTap(webViewHelper.webViewImpl(), doubleTapPoint, scale); |
| 2535 EXPECT_FLOAT_EQ(doubleTapZoomAlreadyLegibleScale, scale); | 2535 EXPECT_FLOAT_EQ(doubleTapZoomAlreadyLegibleScale, scale); |
| 2536 simulateDoubleTap(webViewHelper.webViewImpl(), doubleTapPoint, scale); | 2536 simulateDoubleTap(webViewHelper.webViewImpl(), doubleTapPoint, scale); |
| 2537 EXPECT_FLOAT_EQ(webViewHelper.webViewImpl()->minimumPageScaleFactor(), scale
); | 2537 EXPECT_FLOAT_EQ(webViewHelper.webViewImpl()->minimumPageScaleFactor(), scale
); |
| 2538 simulateDoubleTap(webViewHelper.webViewImpl(), doubleTapPoint, scale); | 2538 simulateDoubleTap(webViewHelper.webViewImpl(), doubleTapPoint, scale); |
| 2539 EXPECT_FLOAT_EQ(doubleTapZoomAlreadyLegibleScale, scale); | 2539 EXPECT_FLOAT_EQ(doubleTapZoomAlreadyLegibleScale, scale); |
| 2540 | 2540 |
| 2541 // Zoom in to reset double_tap_zoom_in_effect flag. | 2541 // Zoom in to reset double_tap_zoom_in_effect flag. |
| 2542 webViewHelper.webViewImpl()->applyScrollAndScale(WebSize(), 1.1f); | 2542 webViewHelper.webViewImpl()->applyViewportDeltas(WebSize(), 1.1f, 0); |
| 2543 // minimumPageScale < 1 < doubleTapZoomAlreadyLegibleScale | 2543 // minimumPageScale < 1 < doubleTapZoomAlreadyLegibleScale |
| 2544 webViewHelper.webView()->setPageScaleFactorLimits(0.95f, 4); | 2544 webViewHelper.webView()->setPageScaleFactorLimits(0.95f, 4); |
| 2545 webViewHelper.webView()->layout(); | 2545 webViewHelper.webView()->layout(); |
| 2546 doubleTapZoomAlreadyLegibleScale = webViewHelper.webViewImpl()->minimumPageS
caleFactor() * doubleTapZoomAlreadyLegibleRatio; | 2546 doubleTapZoomAlreadyLegibleScale = webViewHelper.webViewImpl()->minimumPageS
caleFactor() * doubleTapZoomAlreadyLegibleRatio; |
| 2547 setScaleAndScrollAndLayout(webViewHelper.webViewImpl(), WebPoint(0, 0), (web
ViewHelper.webViewImpl()->minimumPageScaleFactor()) * (1 + doubleTapZoomAlreadyL
egibleRatio) / 2); | 2547 setScaleAndScrollAndLayout(webViewHelper.webViewImpl(), WebPoint(0, 0), (web
ViewHelper.webViewImpl()->minimumPageScaleFactor()) * (1 + doubleTapZoomAlreadyL
egibleRatio) / 2); |
| 2548 simulateDoubleTap(webViewHelper.webViewImpl(), doubleTapPoint, scale); | 2548 simulateDoubleTap(webViewHelper.webViewImpl(), doubleTapPoint, scale); |
| 2549 EXPECT_FLOAT_EQ(doubleTapZoomAlreadyLegibleScale, scale); | 2549 EXPECT_FLOAT_EQ(doubleTapZoomAlreadyLegibleScale, scale); |
| 2550 simulateDoubleTap(webViewHelper.webViewImpl(), doubleTapPoint, scale); | 2550 simulateDoubleTap(webViewHelper.webViewImpl(), doubleTapPoint, scale); |
| 2551 EXPECT_FLOAT_EQ(webViewHelper.webViewImpl()->minimumPageScaleFactor(), scale
); | 2551 EXPECT_FLOAT_EQ(webViewHelper.webViewImpl()->minimumPageScaleFactor(), scale
); |
| 2552 simulateDoubleTap(webViewHelper.webViewImpl(), doubleTapPoint, scale); | 2552 simulateDoubleTap(webViewHelper.webViewImpl(), doubleTapPoint, scale); |
| (...skipping 29 matching lines...) Expand all Loading... |
| 2582 webViewHelper.webView()->setPageScaleFactorLimits(0.5f, 4); | 2582 webViewHelper.webView()->setPageScaleFactorLimits(0.5f, 4); |
| 2583 webViewHelper.webView()->layout(); | 2583 webViewHelper.webView()->layout(); |
| 2584 simulateDoubleTap(webViewHelper.webViewImpl(), doubleTapPoint, scale); | 2584 simulateDoubleTap(webViewHelper.webViewImpl(), doubleTapPoint, scale); |
| 2585 EXPECT_FLOAT_EQ(legibleScale, scale); | 2585 EXPECT_FLOAT_EQ(legibleScale, scale); |
| 2586 simulateDoubleTap(webViewHelper.webViewImpl(), doubleTapPoint, scale); | 2586 simulateDoubleTap(webViewHelper.webViewImpl(), doubleTapPoint, scale); |
| 2587 EXPECT_FLOAT_EQ(webViewHelper.webViewImpl()->minimumPageScaleFactor(), scale
); | 2587 EXPECT_FLOAT_EQ(webViewHelper.webViewImpl()->minimumPageScaleFactor(), scale
); |
| 2588 simulateDoubleTap(webViewHelper.webViewImpl(), doubleTapPoint, scale); | 2588 simulateDoubleTap(webViewHelper.webViewImpl(), doubleTapPoint, scale); |
| 2589 EXPECT_FLOAT_EQ(legibleScale, scale); | 2589 EXPECT_FLOAT_EQ(legibleScale, scale); |
| 2590 | 2590 |
| 2591 // Zoom in to reset double_tap_zoom_in_effect flag. | 2591 // Zoom in to reset double_tap_zoom_in_effect flag. |
| 2592 webViewHelper.webViewImpl()->applyScrollAndScale(WebSize(), 1.1f); | 2592 webViewHelper.webViewImpl()->applyViewportDeltas(WebSize(), 1.1f, 0); |
| 2593 // 1 < accessibilityFontScaleFactor < minimumPageScale < doubleTapZoomAlread
yLegibleScale | 2593 // 1 < accessibilityFontScaleFactor < minimumPageScale < doubleTapZoomAlread
yLegibleScale |
| 2594 webViewHelper.webView()->setPageScaleFactorLimits(1.0f, 4); | 2594 webViewHelper.webView()->setPageScaleFactorLimits(1.0f, 4); |
| 2595 webViewHelper.webView()->layout(); | 2595 webViewHelper.webView()->layout(); |
| 2596 doubleTapZoomAlreadyLegibleScale = webViewHelper.webViewImpl()->minimumPageS
caleFactor() * doubleTapZoomAlreadyLegibleRatio; | 2596 doubleTapZoomAlreadyLegibleScale = webViewHelper.webViewImpl()->minimumPageS
caleFactor() * doubleTapZoomAlreadyLegibleRatio; |
| 2597 setScaleAndScrollAndLayout(webViewHelper.webViewImpl(), WebPoint(0, 0), (web
ViewHelper.webViewImpl()->minimumPageScaleFactor()) * (1 + doubleTapZoomAlreadyL
egibleRatio) / 2); | 2597 setScaleAndScrollAndLayout(webViewHelper.webViewImpl(), WebPoint(0, 0), (web
ViewHelper.webViewImpl()->minimumPageScaleFactor()) * (1 + doubleTapZoomAlreadyL
egibleRatio) / 2); |
| 2598 simulateDoubleTap(webViewHelper.webViewImpl(), doubleTapPoint, scale); | 2598 simulateDoubleTap(webViewHelper.webViewImpl(), doubleTapPoint, scale); |
| 2599 EXPECT_FLOAT_EQ(doubleTapZoomAlreadyLegibleScale, scale); | 2599 EXPECT_FLOAT_EQ(doubleTapZoomAlreadyLegibleScale, scale); |
| 2600 simulateDoubleTap(webViewHelper.webViewImpl(), doubleTapPoint, scale); | 2600 simulateDoubleTap(webViewHelper.webViewImpl(), doubleTapPoint, scale); |
| 2601 EXPECT_FLOAT_EQ(webViewHelper.webViewImpl()->minimumPageScaleFactor(), scale
); | 2601 EXPECT_FLOAT_EQ(webViewHelper.webViewImpl()->minimumPageScaleFactor(), scale
); |
| 2602 simulateDoubleTap(webViewHelper.webViewImpl(), doubleTapPoint, scale); | 2602 simulateDoubleTap(webViewHelper.webViewImpl(), doubleTapPoint, scale); |
| 2603 EXPECT_FLOAT_EQ(doubleTapZoomAlreadyLegibleScale, scale); | 2603 EXPECT_FLOAT_EQ(doubleTapZoomAlreadyLegibleScale, scale); |
| 2604 | 2604 |
| 2605 // Zoom in to reset double_tap_zoom_in_effect flag. | 2605 // Zoom in to reset double_tap_zoom_in_effect flag. |
| 2606 webViewHelper.webViewImpl()->applyScrollAndScale(WebSize(), 1.1f); | 2606 webViewHelper.webViewImpl()->applyViewportDeltas(WebSize(), 1.1f, 0); |
| 2607 // minimumPageScale < 1 < accessibilityFontScaleFactor < doubleTapZoomAlread
yLegibleScale | 2607 // minimumPageScale < 1 < accessibilityFontScaleFactor < doubleTapZoomAlread
yLegibleScale |
| 2608 webViewHelper.webView()->setPageScaleFactorLimits(0.95f, 4); | 2608 webViewHelper.webView()->setPageScaleFactorLimits(0.95f, 4); |
| 2609 webViewHelper.webView()->layout(); | 2609 webViewHelper.webView()->layout(); |
| 2610 doubleTapZoomAlreadyLegibleScale = webViewHelper.webViewImpl()->minimumPageS
caleFactor() * doubleTapZoomAlreadyLegibleRatio; | 2610 doubleTapZoomAlreadyLegibleScale = webViewHelper.webViewImpl()->minimumPageS
caleFactor() * doubleTapZoomAlreadyLegibleRatio; |
| 2611 setScaleAndScrollAndLayout(webViewHelper.webViewImpl(), WebPoint(0, 0), (web
ViewHelper.webViewImpl()->minimumPageScaleFactor()) * (1 + doubleTapZoomAlreadyL
egibleRatio) / 2); | 2611 setScaleAndScrollAndLayout(webViewHelper.webViewImpl(), WebPoint(0, 0), (web
ViewHelper.webViewImpl()->minimumPageScaleFactor()) * (1 + doubleTapZoomAlreadyL
egibleRatio) / 2); |
| 2612 simulateDoubleTap(webViewHelper.webViewImpl(), doubleTapPoint, scale); | 2612 simulateDoubleTap(webViewHelper.webViewImpl(), doubleTapPoint, scale); |
| 2613 EXPECT_FLOAT_EQ(doubleTapZoomAlreadyLegibleScale, scale); | 2613 EXPECT_FLOAT_EQ(doubleTapZoomAlreadyLegibleScale, scale); |
| 2614 simulateDoubleTap(webViewHelper.webViewImpl(), doubleTapPoint, scale); | 2614 simulateDoubleTap(webViewHelper.webViewImpl(), doubleTapPoint, scale); |
| 2615 EXPECT_FLOAT_EQ(webViewHelper.webViewImpl()->minimumPageScaleFactor(), scale
); | 2615 EXPECT_FLOAT_EQ(webViewHelper.webViewImpl()->minimumPageScaleFactor(), scale
); |
| 2616 simulateDoubleTap(webViewHelper.webViewImpl(), doubleTapPoint, scale); | 2616 simulateDoubleTap(webViewHelper.webViewImpl(), doubleTapPoint, scale); |
| 2617 EXPECT_FLOAT_EQ(doubleTapZoomAlreadyLegibleScale, scale); | 2617 EXPECT_FLOAT_EQ(doubleTapZoomAlreadyLegibleScale, scale); |
| 2618 | 2618 |
| 2619 // Zoom in to reset double_tap_zoom_in_effect flag. | 2619 // Zoom in to reset double_tap_zoom_in_effect flag. |
| 2620 webViewHelper.webViewImpl()->applyScrollAndScale(WebSize(), 1.1f); | 2620 webViewHelper.webViewImpl()->applyViewportDeltas(WebSize(), 1.1f, 0); |
| 2621 // minimumPageScale < 1 < doubleTapZoomAlreadyLegibleScale < accessibilityFo
ntScaleFactor | 2621 // minimumPageScale < 1 < doubleTapZoomAlreadyLegibleScale < accessibilityFo
ntScaleFactor |
| 2622 webViewHelper.webView()->setPageScaleFactorLimits(0.9f, 4); | 2622 webViewHelper.webView()->setPageScaleFactorLimits(0.9f, 4); |
| 2623 webViewHelper.webView()->layout(); | 2623 webViewHelper.webView()->layout(); |
| 2624 doubleTapZoomAlreadyLegibleScale = webViewHelper.webViewImpl()->minimumPageS
caleFactor() * doubleTapZoomAlreadyLegibleRatio; | 2624 doubleTapZoomAlreadyLegibleScale = webViewHelper.webViewImpl()->minimumPageS
caleFactor() * doubleTapZoomAlreadyLegibleRatio; |
| 2625 setScaleAndScrollAndLayout(webViewHelper.webViewImpl(), WebPoint(0, 0), (web
ViewHelper.webViewImpl()->minimumPageScaleFactor()) * (1 + doubleTapZoomAlreadyL
egibleRatio) / 2); | 2625 setScaleAndScrollAndLayout(webViewHelper.webViewImpl(), WebPoint(0, 0), (web
ViewHelper.webViewImpl()->minimumPageScaleFactor()) * (1 + doubleTapZoomAlreadyL
egibleRatio) / 2); |
| 2626 simulateDoubleTap(webViewHelper.webViewImpl(), doubleTapPoint, scale); | 2626 simulateDoubleTap(webViewHelper.webViewImpl(), doubleTapPoint, scale); |
| 2627 EXPECT_FLOAT_EQ(legibleScale, scale); | 2627 EXPECT_FLOAT_EQ(legibleScale, scale); |
| 2628 simulateDoubleTap(webViewHelper.webViewImpl(), doubleTapPoint, scale); | 2628 simulateDoubleTap(webViewHelper.webViewImpl(), doubleTapPoint, scale); |
| 2629 EXPECT_FLOAT_EQ(webViewHelper.webViewImpl()->minimumPageScaleFactor(), scale
); | 2629 EXPECT_FLOAT_EQ(webViewHelper.webViewImpl()->minimumPageScaleFactor(), scale
); |
| 2630 simulateDoubleTap(webViewHelper.webViewImpl(), doubleTapPoint, scale); | 2630 simulateDoubleTap(webViewHelper.webViewImpl(), doubleTapPoint, scale); |
| (...skipping 2324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4955 // only becomes available after the load begins. | 4955 // only becomes available after the load begins. |
| 4956 FrameTestHelpers::WebViewHelper webViewHelper; | 4956 FrameTestHelpers::WebViewHelper webViewHelper; |
| 4957 webViewHelper.initializeAndLoad(m_baseURL + "long_scroll.html", true, &clien
t); | 4957 webViewHelper.initializeAndLoad(m_baseURL + "long_scroll.html", true, &clien
t); |
| 4958 webViewHelper.webView()->resize(WebSize(1000, 1000)); | 4958 webViewHelper.webView()->resize(WebSize(1000, 1000)); |
| 4959 webViewHelper.webView()->layout(); | 4959 webViewHelper.webView()->layout(); |
| 4960 | 4960 |
| 4961 EXPECT_FALSE(client.wasUserScroll()); | 4961 EXPECT_FALSE(client.wasUserScroll()); |
| 4962 EXPECT_FALSE(client.wasProgrammaticScroll()); | 4962 EXPECT_FALSE(client.wasProgrammaticScroll()); |
| 4963 | 4963 |
| 4964 // Do a compositor scroll, verify that this is counted as a user scroll. | 4964 // Do a compositor scroll, verify that this is counted as a user scroll. |
| 4965 webViewHelper.webViewImpl()->applyScrollAndScale(WebSize(0, 1), 1.1f); | 4965 webViewHelper.webViewImpl()->applyViewportDeltas(WebSize(0, 1), 1.1f, 0); |
| 4966 EXPECT_TRUE(client.wasUserScroll()); | 4966 EXPECT_TRUE(client.wasUserScroll()); |
| 4967 client.reset(); | 4967 client.reset(); |
| 4968 | 4968 |
| 4969 EXPECT_FALSE(client.wasUserScroll()); | 4969 EXPECT_FALSE(client.wasUserScroll()); |
| 4970 EXPECT_FALSE(client.wasProgrammaticScroll()); | 4970 EXPECT_FALSE(client.wasProgrammaticScroll()); |
| 4971 | 4971 |
| 4972 // The page scale 1.0f and scroll. | 4972 // The page scale 1.0f and scroll. |
| 4973 webViewHelper.webViewImpl()->applyScrollAndScale(WebSize(0, 1), 1.0f); | 4973 webViewHelper.webViewImpl()->applyViewportDeltas(WebSize(0, 1), 1.0f, 0); |
| 4974 EXPECT_TRUE(client.wasUserScroll()); | 4974 EXPECT_TRUE(client.wasUserScroll()); |
| 4975 client.reset(); | 4975 client.reset(); |
| 4976 | 4976 |
| 4977 // No scroll event if there is no scroll delta. | 4977 // No scroll event if there is no scroll delta. |
| 4978 webViewHelper.webViewImpl()->applyScrollAndScale(WebSize(), 1.0f); | 4978 webViewHelper.webViewImpl()->applyViewportDeltas(WebSize(), 1.0f, 0); |
| 4979 EXPECT_FALSE(client.wasUserScroll()); | 4979 EXPECT_FALSE(client.wasUserScroll()); |
| 4980 EXPECT_FALSE(client.wasProgrammaticScroll()); | 4980 EXPECT_FALSE(client.wasProgrammaticScroll()); |
| 4981 client.reset(); | 4981 client.reset(); |
| 4982 | 4982 |
| 4983 // Non zero page scale and scroll. | 4983 // Non zero page scale and scroll. |
| 4984 webViewHelper.webViewImpl()->applyScrollAndScale(WebSize(9, 13), 0.6f); | 4984 webViewHelper.webViewImpl()->applyViewportDeltas(WebSize(9, 13), 0.6f, 0); |
| 4985 EXPECT_TRUE(client.wasUserScroll()); | 4985 EXPECT_TRUE(client.wasUserScroll()); |
| 4986 client.reset(); | 4986 client.reset(); |
| 4987 | 4987 |
| 4988 // Programmatic scroll. | 4988 // Programmatic scroll. |
| 4989 WebLocalFrameImpl* frameImpl = webViewHelper.webViewImpl()->mainFrameImpl(); | 4989 WebLocalFrameImpl* frameImpl = webViewHelper.webViewImpl()->mainFrameImpl(); |
| 4990 frameImpl->executeScript(WebScriptSource("window.scrollTo(0, 20);")); | 4990 frameImpl->executeScript(WebScriptSource("window.scrollTo(0, 20);")); |
| 4991 EXPECT_FALSE(client.wasUserScroll()); | 4991 EXPECT_FALSE(client.wasUserScroll()); |
| 4992 EXPECT_TRUE(client.wasProgrammaticScroll()); | 4992 EXPECT_TRUE(client.wasProgrammaticScroll()); |
| 4993 client.reset(); | 4993 client.reset(); |
| 4994 | 4994 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 5009 FrameTestHelpers::WebViewHelper webViewHelper; | 5009 FrameTestHelpers::WebViewHelper webViewHelper; |
| 5010 webViewHelper.initializeAndLoad(m_baseURL + "short_scroll.html", true, &clie
nt); | 5010 webViewHelper.initializeAndLoad(m_baseURL + "short_scroll.html", true, &clie
nt); |
| 5011 | 5011 |
| 5012 webViewHelper.webView()->resize(WebSize(1000, 1000)); | 5012 webViewHelper.webView()->resize(WebSize(1000, 1000)); |
| 5013 webViewHelper.webView()->layout(); | 5013 webViewHelper.webView()->layout(); |
| 5014 | 5014 |
| 5015 EXPECT_FALSE(client.wasUserScroll()); | 5015 EXPECT_FALSE(client.wasUserScroll()); |
| 5016 EXPECT_FALSE(client.wasProgrammaticScroll()); | 5016 EXPECT_FALSE(client.wasProgrammaticScroll()); |
| 5017 | 5017 |
| 5018 // Non zero page scale and scroll. | 5018 // Non zero page scale and scroll. |
| 5019 webViewHelper.webViewImpl()->applyScrollAndScale(WebSize(9, 13), 2.0f); | 5019 webViewHelper.webViewImpl()->applyViewportDeltas(WebSize(9, 13), 2.0f, 0); |
| 5020 EXPECT_FALSE(client.wasProgrammaticScroll()); | 5020 EXPECT_FALSE(client.wasProgrammaticScroll()); |
| 5021 EXPECT_TRUE(client.wasUserScroll()); | 5021 EXPECT_TRUE(client.wasUserScroll()); |
| 5022 client.reset(); | 5022 client.reset(); |
| 5023 } | 5023 } |
| 5024 | 5024 |
| 5025 TEST_F(WebFrameTest, FirstPartyForCookiesForRedirect) | 5025 TEST_F(WebFrameTest, FirstPartyForCookiesForRedirect) |
| 5026 { | 5026 { |
| 5027 WTF::String filePath = Platform::current()->unitTestSupport()->webKitRootDir
(); | 5027 WTF::String filePath = Platform::current()->unitTestSupport()->webKitRootDir
(); |
| 5028 filePath.append("/Source/web/tests/data/first_party.html"); | 5028 filePath.append("/Source/web/tests/data/first_party.html"); |
| 5029 | 5029 |
| (...skipping 1143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6173 EXPECT_EQ(1u, frameClient.navigationalDataReceivedCount()); | 6173 EXPECT_EQ(1u, frameClient.navigationalDataReceivedCount()); |
| 6174 | 6174 |
| 6175 // Neither should a page reload. | 6175 // Neither should a page reload. |
| 6176 localFrame->reload(); | 6176 localFrame->reload(); |
| 6177 EXPECT_EQ(4u, frameClient.provisionalLoadCount()); | 6177 EXPECT_EQ(4u, frameClient.provisionalLoadCount()); |
| 6178 EXPECT_FALSE(frameClient.wasLastProvisionalLoadATransition()); | 6178 EXPECT_FALSE(frameClient.wasLastProvisionalLoadATransition()); |
| 6179 EXPECT_EQ(1u, frameClient.navigationalDataReceivedCount()); | 6179 EXPECT_EQ(1u, frameClient.navigationalDataReceivedCount()); |
| 6180 } | 6180 } |
| 6181 | 6181 |
| 6182 } // namespace | 6182 } // namespace |
| OLD | NEW |