| 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 2454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2465 WebPoint point(div.x + 50, div.y + 50); | 2465 WebPoint point(div.x + 50, div.y + 50); |
| 2466 float scale; | 2466 float scale; |
| 2467 setScaleAndScrollAndLayout(webViewHelper.webViewImpl(), WebPoint(0, 0), (web
ViewHelper.webViewImpl()->minimumPageScaleFactor()) * (1 + doubleTapZoomAlreadyL
egibleRatio) / 2); | 2467 setScaleAndScrollAndLayout(webViewHelper.webViewImpl(), WebPoint(0, 0), (web
ViewHelper.webViewImpl()->minimumPageScaleFactor()) * (1 + doubleTapZoomAlreadyL
egibleRatio) / 2); |
| 2468 | 2468 |
| 2469 simulateDoubleTap(webViewHelper.webViewImpl(), point, scale); | 2469 simulateDoubleTap(webViewHelper.webViewImpl(), point, scale); |
| 2470 EXPECT_FLOAT_EQ(doubleTapZoomAlreadyLegibleScale, scale); | 2470 EXPECT_FLOAT_EQ(doubleTapZoomAlreadyLegibleScale, scale); |
| 2471 simulateDoubleTap(webViewHelper.webViewImpl(), point, scale); | 2471 simulateDoubleTap(webViewHelper.webViewImpl(), point, scale); |
| 2472 EXPECT_FLOAT_EQ(webViewHelper.webViewImpl()->minimumPageScaleFactor(), scale
); | 2472 EXPECT_FLOAT_EQ(webViewHelper.webViewImpl()->minimumPageScaleFactor(), scale
); |
| 2473 } | 2473 } |
| 2474 | 2474 |
| 2475 TEST_F(WebFrameTest, DivAutoZoomVeryTallTest) | 2475 TEST_P(ParameterizedWebFrameTest, DivAutoZoomVeryTallTest) |
| 2476 { | 2476 { |
| 2477 // When a block is taller than the viewport and a zoom targets a lower part | 2477 // When a block is taller than the viewport and a zoom targets a lower part |
| 2478 // of it, then we should keep the target point onscreen instead of snapping | 2478 // of it, then we should keep the target point onscreen instead of snapping |
| 2479 // back up the top of the block. | 2479 // back up the top of the block. |
| 2480 registerMockedHttpURLLoad("very_tall_div.html"); | 2480 registerMockedHttpURLLoad("very_tall_div.html"); |
| 2481 | 2481 |
| 2482 const float deviceScaleFactor = 2.0f; | 2482 const float deviceScaleFactor = 2.0f; |
| 2483 int viewportWidth = 640 / deviceScaleFactor; | 2483 int viewportWidth = 640 / deviceScaleFactor; |
| 2484 int viewportHeight = 1280 / deviceScaleFactor; | 2484 int viewportHeight = 1280 / deviceScaleFactor; |
| 2485 FrameTestHelpers::WebViewHelper webViewHelper; | 2485 FrameTestHelpers::WebViewHelper webViewHelper(this); |
| 2486 webViewHelper.initializeAndLoad(m_baseURL + "very_tall_div.html", true, 0, 0
, configureAndroid); | 2486 webViewHelper.initializeAndLoad(m_baseURL + "very_tall_div.html", true, 0, 0
, configureAndroid); |
| 2487 webViewHelper.webView()->resize(WebSize(viewportWidth, viewportHeight)); | 2487 webViewHelper.webView()->resize(WebSize(viewportWidth, viewportHeight)); |
| 2488 webViewHelper.webView()->setDeviceScaleFactor(deviceScaleFactor); | 2488 webViewHelper.webView()->setDeviceScaleFactor(deviceScaleFactor); |
| 2489 webViewHelper.webView()->setPageScaleFactor(1.0f); | 2489 webViewHelper.webView()->setPageScaleFactor(1.0f); |
| 2490 webViewHelper.webView()->layout(); | 2490 webViewHelper.webView()->layout(); |
| 2491 | 2491 |
| 2492 WebRect div(200, 300, 400, 5000); | 2492 WebRect div(200, 300, 400, 5000); |
| 2493 WebPoint point(div.x + 50, div.y + 3000); | 2493 WebPoint point(div.x + 50, div.y + 3000); |
| 2494 float scale; | 2494 float scale; |
| 2495 WebPoint scroll; | 2495 WebPoint scroll; |
| (...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2763 doubleTapZoomAlreadyLegibleScale = webViewHelper.webViewImpl()->minimumPageS
caleFactor() * doubleTapZoomAlreadyLegibleRatio; | 2763 doubleTapZoomAlreadyLegibleScale = webViewHelper.webViewImpl()->minimumPageS
caleFactor() * doubleTapZoomAlreadyLegibleRatio; |
| 2764 setScaleAndScrollAndLayout(webViewHelper.webViewImpl(), WebPoint(0, 0), (web
ViewHelper.webViewImpl()->minimumPageScaleFactor()) * (1 + doubleTapZoomAlreadyL
egibleRatio) / 2); | 2764 setScaleAndScrollAndLayout(webViewHelper.webViewImpl(), WebPoint(0, 0), (web
ViewHelper.webViewImpl()->minimumPageScaleFactor()) * (1 + doubleTapZoomAlreadyL
egibleRatio) / 2); |
| 2765 simulateDoubleTap(webViewHelper.webViewImpl(), doubleTapPoint, scale); | 2765 simulateDoubleTap(webViewHelper.webViewImpl(), doubleTapPoint, scale); |
| 2766 EXPECT_FLOAT_EQ(legibleScale, scale); | 2766 EXPECT_FLOAT_EQ(legibleScale, scale); |
| 2767 simulateDoubleTap(webViewHelper.webViewImpl(), doubleTapPoint, scale); | 2767 simulateDoubleTap(webViewHelper.webViewImpl(), doubleTapPoint, scale); |
| 2768 EXPECT_FLOAT_EQ(webViewHelper.webViewImpl()->minimumPageScaleFactor(), scale
); | 2768 EXPECT_FLOAT_EQ(webViewHelper.webViewImpl()->minimumPageScaleFactor(), scale
); |
| 2769 simulateDoubleTap(webViewHelper.webViewImpl(), doubleTapPoint, scale); | 2769 simulateDoubleTap(webViewHelper.webViewImpl(), doubleTapPoint, scale); |
| 2770 EXPECT_FLOAT_EQ(legibleScale, scale); | 2770 EXPECT_FLOAT_EQ(legibleScale, scale); |
| 2771 } | 2771 } |
| 2772 | 2772 |
| 2773 TEST_F(WebFrameTest, BlockBoundTest) | 2773 TEST_P(ParameterizedWebFrameTest, BlockBoundTest) |
| 2774 { | 2774 { |
| 2775 registerMockedHttpURLLoad("block_bound.html"); | 2775 registerMockedHttpURLLoad("block_bound.html"); |
| 2776 | 2776 |
| 2777 FrameTestHelpers::WebViewHelper webViewHelper; | 2777 FrameTestHelpers::WebViewHelper webViewHelper(this); |
| 2778 webViewHelper.initializeAndLoad(m_baseURL + "block_bound.html", false, 0, 0,
configureAndroid); | 2778 webViewHelper.initializeAndLoad(m_baseURL + "block_bound.html", false, 0, 0,
configureAndroid); |
| 2779 | 2779 |
| 2780 IntRect rectBack = IntRect(0, 0, 200, 200); | 2780 IntRect rectBack = IntRect(0, 0, 200, 200); |
| 2781 IntRect rectLeftTop = IntRect(10, 10, 80, 80); | 2781 IntRect rectLeftTop = IntRect(10, 10, 80, 80); |
| 2782 IntRect rectRightBottom = IntRect(110, 110, 80, 80); | 2782 IntRect rectRightBottom = IntRect(110, 110, 80, 80); |
| 2783 IntRect blockBound; | 2783 IntRect blockBound; |
| 2784 | 2784 |
| 2785 blockBound = IntRect(webViewHelper.webViewImpl()->computeBlockBound(WebPoint
(9, 9), true)); | 2785 blockBound = IntRect(webViewHelper.webViewImpl()->computeBlockBound(WebPoint
(9, 9), true)); |
| 2786 EXPECT_RECT_EQ(rectBack, blockBound); | 2786 EXPECT_RECT_EQ(rectBack, blockBound); |
| 2787 | 2787 |
| (...skipping 4947 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7735 | 7735 |
| 7736 TEST_F(WebFrameTest, MaxFramesDetach) | 7736 TEST_F(WebFrameTest, MaxFramesDetach) |
| 7737 { | 7737 { |
| 7738 registerMockedHttpURLLoad("max-frames-detach.html"); | 7738 registerMockedHttpURLLoad("max-frames-detach.html"); |
| 7739 FrameTestHelpers::WebViewHelper webViewHelper; | 7739 FrameTestHelpers::WebViewHelper webViewHelper; |
| 7740 WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad(m_baseURL + "max-
frames-detach.html", true); | 7740 WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad(m_baseURL + "max-
frames-detach.html", true); |
| 7741 webViewImpl->mainFrameImpl()->collectGarbage(); | 7741 webViewImpl->mainFrameImpl()->collectGarbage(); |
| 7742 } | 7742 } |
| 7743 | 7743 |
| 7744 } // namespace blink | 7744 } // namespace blink |
| OLD | NEW |