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

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

Issue 1172153004: Absolute-position the initial containing block. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 6 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/core/layout/TextAutosizer.cpp ('k') | no next file » | 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 2436 matching lines...) Expand 10 before | Expand all | Expand 10 after
2447 WebPoint point(div.x + 50, div.y + 50); 2447 WebPoint point(div.x + 50, div.y + 50);
2448 float scale; 2448 float scale;
2449 setScaleAndScrollAndLayout(webViewHelper.webViewImpl(), WebPoint(0, 0), (web ViewHelper.webViewImpl()->minimumPageScaleFactor()) * (1 + doubleTapZoomAlreadyL egibleRatio) / 2); 2449 setScaleAndScrollAndLayout(webViewHelper.webViewImpl(), WebPoint(0, 0), (web ViewHelper.webViewImpl()->minimumPageScaleFactor()) * (1 + doubleTapZoomAlreadyL egibleRatio) / 2);
2450 2450
2451 simulateDoubleTap(webViewHelper.webViewImpl(), point, scale); 2451 simulateDoubleTap(webViewHelper.webViewImpl(), point, scale);
2452 EXPECT_FLOAT_EQ(doubleTapZoomAlreadyLegibleScale, scale); 2452 EXPECT_FLOAT_EQ(doubleTapZoomAlreadyLegibleScale, scale);
2453 simulateDoubleTap(webViewHelper.webViewImpl(), point, scale); 2453 simulateDoubleTap(webViewHelper.webViewImpl(), point, scale);
2454 EXPECT_FLOAT_EQ(webViewHelper.webViewImpl()->minimumPageScaleFactor(), scale ); 2454 EXPECT_FLOAT_EQ(webViewHelper.webViewImpl()->minimumPageScaleFactor(), scale );
2455 } 2455 }
2456 2456
2457 TEST_P(ParameterizedWebFrameTest, DivAutoZoomVeryTallTest) 2457 TEST_F(WebFrameTest, DivAutoZoomVeryTallTest)
2458 { 2458 {
2459 // When a block is taller than the viewport and a zoom targets a lower part 2459 // When a block is taller than the viewport and a zoom targets a lower part
2460 // of it, then we should keep the target point onscreen instead of snapping 2460 // of it, then we should keep the target point onscreen instead of snapping
2461 // back up the top of the block. 2461 // back up the top of the block.
2462 registerMockedHttpURLLoad("very_tall_div.html"); 2462 registerMockedHttpURLLoad("very_tall_div.html");
2463 2463
2464 const float deviceScaleFactor = 2.0f; 2464 const float deviceScaleFactor = 2.0f;
2465 int viewportWidth = 640 / deviceScaleFactor; 2465 int viewportWidth = 640 / deviceScaleFactor;
2466 int viewportHeight = 1280 / deviceScaleFactor; 2466 int viewportHeight = 1280 / deviceScaleFactor;
2467 FrameTestHelpers::WebViewHelper webViewHelper(this); 2467 FrameTestHelpers::WebViewHelper webViewHelper;
2468 webViewHelper.initializeAndLoad(m_baseURL + "very_tall_div.html", true, 0, 0 , configureAndroid); 2468 webViewHelper.initializeAndLoad(m_baseURL + "very_tall_div.html", true, 0, 0 , configureAndroid);
2469 webViewHelper.webView()->resize(WebSize(viewportWidth, viewportHeight)); 2469 webViewHelper.webView()->resize(WebSize(viewportWidth, viewportHeight));
2470 webViewHelper.webView()->setDeviceScaleFactor(deviceScaleFactor); 2470 webViewHelper.webView()->setDeviceScaleFactor(deviceScaleFactor);
2471 webViewHelper.webView()->setPageScaleFactor(1.0f); 2471 webViewHelper.webView()->setPageScaleFactor(1.0f);
2472 webViewHelper.webView()->layout(); 2472 webViewHelper.webView()->layout();
2473 2473
2474 WebRect div(200, 300, 400, 5000); 2474 WebRect div(200, 300, 400, 5000);
2475 WebPoint point(div.x + 50, div.y + 3000); 2475 WebPoint point(div.x + 50, div.y + 3000);
2476 float scale; 2476 float scale;
2477 WebPoint scroll; 2477 WebPoint scroll;
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
2745 doubleTapZoomAlreadyLegibleScale = webViewHelper.webViewImpl()->minimumPageS caleFactor() * doubleTapZoomAlreadyLegibleRatio; 2745 doubleTapZoomAlreadyLegibleScale = webViewHelper.webViewImpl()->minimumPageS caleFactor() * doubleTapZoomAlreadyLegibleRatio;
2746 setScaleAndScrollAndLayout(webViewHelper.webViewImpl(), WebPoint(0, 0), (web ViewHelper.webViewImpl()->minimumPageScaleFactor()) * (1 + doubleTapZoomAlreadyL egibleRatio) / 2); 2746 setScaleAndScrollAndLayout(webViewHelper.webViewImpl(), WebPoint(0, 0), (web ViewHelper.webViewImpl()->minimumPageScaleFactor()) * (1 + doubleTapZoomAlreadyL egibleRatio) / 2);
2747 simulateDoubleTap(webViewHelper.webViewImpl(), doubleTapPoint, scale); 2747 simulateDoubleTap(webViewHelper.webViewImpl(), doubleTapPoint, scale);
2748 EXPECT_FLOAT_EQ(legibleScale, scale); 2748 EXPECT_FLOAT_EQ(legibleScale, scale);
2749 simulateDoubleTap(webViewHelper.webViewImpl(), doubleTapPoint, scale); 2749 simulateDoubleTap(webViewHelper.webViewImpl(), doubleTapPoint, scale);
2750 EXPECT_FLOAT_EQ(webViewHelper.webViewImpl()->minimumPageScaleFactor(), scale ); 2750 EXPECT_FLOAT_EQ(webViewHelper.webViewImpl()->minimumPageScaleFactor(), scale );
2751 simulateDoubleTap(webViewHelper.webViewImpl(), doubleTapPoint, scale); 2751 simulateDoubleTap(webViewHelper.webViewImpl(), doubleTapPoint, scale);
2752 EXPECT_FLOAT_EQ(legibleScale, scale); 2752 EXPECT_FLOAT_EQ(legibleScale, scale);
2753 } 2753 }
2754 2754
2755 TEST_P(ParameterizedWebFrameTest, BlockBoundTest) 2755 TEST_F(WebFrameTest, BlockBoundTest)
2756 { 2756 {
2757 registerMockedHttpURLLoad("block_bound.html"); 2757 registerMockedHttpURLLoad("block_bound.html");
2758 2758
2759 FrameTestHelpers::WebViewHelper webViewHelper(this); 2759 FrameTestHelpers::WebViewHelper webViewHelper;
2760 webViewHelper.initializeAndLoad(m_baseURL + "block_bound.html", false, 0, 0, configureAndroid); 2760 webViewHelper.initializeAndLoad(m_baseURL + "block_bound.html", false, 0, 0, configureAndroid);
2761 2761
2762 IntRect rectBack = IntRect(0, 0, 200, 200); 2762 IntRect rectBack = IntRect(0, 0, 200, 200);
2763 IntRect rectLeftTop = IntRect(10, 10, 80, 80); 2763 IntRect rectLeftTop = IntRect(10, 10, 80, 80);
2764 IntRect rectRightBottom = IntRect(110, 110, 80, 80); 2764 IntRect rectRightBottom = IntRect(110, 110, 80, 80);
2765 IntRect blockBound; 2765 IntRect blockBound;
2766 2766
2767 blockBound = IntRect(webViewHelper.webViewImpl()->computeBlockBound(WebPoint (9, 9), true)); 2767 blockBound = IntRect(webViewHelper.webViewImpl()->computeBlockBound(WebPoint (9, 9), true));
2768 EXPECT_RECT_EQ(rectBack, blockBound); 2768 EXPECT_RECT_EQ(rectBack, blockBound);
2769 2769
(...skipping 4695 matching lines...) Expand 10 before | Expand all | Expand 10 after
7465 7465
7466 EXPECT_EQ(parent, firstFrame->parent()); 7466 EXPECT_EQ(parent, firstFrame->parent());
7467 EXPECT_EQ(parent, secondFrame->parent()); 7467 EXPECT_EQ(parent, secondFrame->parent());
7468 EXPECT_EQ(parent, thirdFrame->parent()); 7468 EXPECT_EQ(parent, thirdFrame->parent());
7469 EXPECT_EQ(parent, fourthFrame->parent()); 7469 EXPECT_EQ(parent, fourthFrame->parent());
7470 7470
7471 view->close(); 7471 view->close();
7472 } 7472 }
7473 7473
7474 } // namespace blink 7474 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/layout/TextAutosizer.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698