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

Unified Diff: Source/web/tests/WebFrameTest.cpp

Issue 23819019: Refactor fixed layout mode (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 side-by-side diff with in-line comments
Download patch
Index: Source/web/tests/WebFrameTest.cpp
diff --git a/Source/web/tests/WebFrameTest.cpp b/Source/web/tests/WebFrameTest.cpp
index e60297a38762379674687cb860d2faf4a682c0af..d5646f363baedeff01b9c60547a2f2359e06b96e 100644
--- a/Source/web/tests/WebFrameTest.cpp
+++ b/Source/web/tests/WebFrameTest.cpp
@@ -314,6 +314,9 @@ class FixedLayoutTestWebViewClient : public WebViewClient {
TEST_F(WebFrameTest, FrameViewNeedsLayoutOnFixedLayoutResize)
{
+ // FIXME: This test currently fails because we assumed layout() wouldn't be called
kenneth.r.christiansen 2013/09/05 08:03:07 So how will that affect say chrome for android on
bokan 2013/09/05 20:03:36 It shouldn't affect behavior since the orientation
+ // on resizes in fixed layout mode. Now that we've ripped out fixed layout mode,
+ // that assumption is no longer true when we're trying to emulate that behavior
registerMockedHttpURLLoad("fixed_layout.html");
FixedLayoutTestWebViewClient client;
@@ -324,11 +327,12 @@ TEST_F(WebFrameTest, FrameViewNeedsLayoutOnFixedLayoutResize)
// only becomes available after the load begins.
m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "fixed_layout.html", true, 0, &client);
m_webView->enableFixedLayoutMode(true);
+ m_webView->setLayoutSize(WebSize(viewportWidth, viewportHeight));
m_webView->settings()->setViewportEnabled(true);
m_webView->resize(WebSize(viewportWidth, viewportHeight));
m_webView->layout();
- webViewImpl()->mainFrameImpl()->frameView()->setFixedLayoutSize(WebCore::IntSize(100, 100));
+ webViewImpl()->mainFrameImpl()->frameView()->setLayoutSize(WebCore::IntSize(100, 100));
EXPECT_TRUE(webViewImpl()->mainFrameImpl()->frameView()->needsLayout());
int prevLayoutCount = webViewImpl()->mainFrameImpl()->frameView()->layoutCount();
@@ -710,7 +714,7 @@ TEST_F(WebFrameTest, WideViewportInitialScaleDoesNotExpandFixedLayoutWidth)
m_webView->resize(WebSize(viewportWidth, viewportHeight));
WebViewImpl* webViewImpl = static_cast<WebViewImpl*>(m_webView);
- EXPECT_EQ(viewportWidth, webViewImpl->mainFrameImpl()->frameView()->fixedLayoutSize().width());
+ EXPECT_EQ(viewportWidth, webViewImpl->mainFrameImpl()->frameView()->layoutSize().width());
}
TEST_F(WebFrameTest, ZeroValuesQuirk)
@@ -724,6 +728,7 @@ TEST_F(WebFrameTest, ZeroValuesQuirk)
m_webView = FrameTestHelpers::createWebView(true, 0, &client);
m_webView->enableFixedLayoutMode(true);
+ m_webView->setFixedLayoutSize(WebSize(viewportWidth, viewportHeight));
kenneth.r.christiansen 2013/09/05 08:03:07 I thought you were getting rid of fixed layout
bokan 2013/09/05 20:03:36 Yes, sorry, this should be setLayoutSize. Fixed.
m_webView->settings()->setViewportEnabled(true);
m_webView->settings()->setSupportDeprecatedTargetDensityDPI(true);
m_webView->settings()->setViewportMetaZeroValuesQuirk(true);
@@ -732,12 +737,12 @@ TEST_F(WebFrameTest, ZeroValuesQuirk)
m_webView->resize(WebSize(viewportWidth, viewportHeight));
WebViewImpl* webViewImpl = static_cast<WebViewImpl*>(m_webView);
- EXPECT_EQ(viewportWidth, webViewImpl->mainFrameImpl()->frameView()->fixedLayoutSize().width());
+ EXPECT_EQ(viewportWidth, webViewImpl->mainFrameImpl()->frameView()->layoutSize().width());
EXPECT_EQ(1.0f, m_webView->pageScaleFactor());
m_webView->settings()->setUseWideViewport(true);
m_webView->layout();
- EXPECT_EQ(viewportWidth, webViewImpl->mainFrameImpl()->frameView()->fixedLayoutSize().width());
+ EXPECT_EQ(viewportWidth, webViewImpl->mainFrameImpl()->frameView()->layoutSize().width());
EXPECT_EQ(1.0f, m_webView->pageScaleFactor());
}
@@ -855,6 +860,7 @@ TEST_F(WebFrameTest, pageScaleFactorShrinksViewport)
m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "fixed_layout.html", true, 0, &client);
m_webView->enableFixedLayoutMode(true);
+ m_webView->setLayoutSize(WebSize(viewportWidth, viewportHeight));
m_webView->settings()->setViewportEnabled(true);
m_webView->resize(WebSize(viewportWidth, viewportHeight));
m_webView->layout();
@@ -880,6 +886,9 @@ TEST_F(WebFrameTest, pageScaleFactorShrinksViewport)
TEST_F(WebFrameTest, pageScaleFactorDoesNotApplyCssTransform)
{
+ // FIXME: This test currently fails because we assumed layout() wouldn't be called
+ // on resizes in fixed layout mode. Now that we've ripped out fixed layout mode,
+ // that assumption is no longer true when we're trying to emulate that behavior
registerMockedHttpURLLoad("fixed_layout.html");
FixedLayoutTestWebViewClient client;
@@ -926,8 +935,9 @@ TEST_F(WebFrameTest, targetDensityDpiHigh)
// We need to account for the fact that logical pixels are unconditionally multiplied by deviceScaleFactor to produce
// physical pixels.
float densityDpiScaleRatio = deviceScaleFactor * targetDpi / deviceDpi;
- EXPECT_NEAR(viewportWidth * densityDpiScaleRatio, m_webView->fixedLayoutSize().width, 1.0f);
- EXPECT_NEAR(viewportHeight * densityDpiScaleRatio, m_webView->fixedLayoutSize().height, 1.0f);
+ WebCore::FrameView* view = webViewImpl()->mainFrameImpl()->frameView();
+ EXPECT_NEAR(viewportWidth * densityDpiScaleRatio, view->layoutSize().width(), 1.0f);
+ EXPECT_NEAR(viewportHeight * densityDpiScaleRatio, view->layoutSize().height(), 1.0f);
EXPECT_NEAR(1.0f / densityDpiScaleRatio, m_webView->pageScaleFactor(), 0.01f);
m_webView->close();
@@ -956,8 +966,9 @@ TEST_F(WebFrameTest, targetDensityDpiDevice)
m_webView->settings()->setSupportDeprecatedTargetDensityDPI(true);
m_webView->resize(WebSize(viewportWidth, viewportHeight));
- EXPECT_NEAR(viewportWidth * client.m_screenInfo.deviceScaleFactor, m_webView->fixedLayoutSize().width, 1.0f);
- EXPECT_NEAR(viewportHeight * client.m_screenInfo.deviceScaleFactor, m_webView->fixedLayoutSize().height, 1.0f);
+ WebCore::FrameView* view = webViewImpl()->mainFrameImpl()->frameView();
+ EXPECT_NEAR(viewportWidth * client.m_screenInfo.deviceScaleFactor, view->layoutSize().width(), 1.0f);
+ EXPECT_NEAR(viewportHeight * client.m_screenInfo.deviceScaleFactor, view->layoutSize().height(), 1.0f);
EXPECT_NEAR(1.0f / client.m_screenInfo.deviceScaleFactor, m_webView->pageScaleFactor(), 0.01f);
m_webView->close();
@@ -1303,6 +1314,7 @@ TEST_F(WebFrameTest, DivAutoZoomWideDivTest)
float doubleTapZoomAlreadyLegibleRatio = 1.2f;
m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "get_wide_div_for_auto_zoom_test.html");
m_webView->enableFixedLayoutMode(true);
+ m_webView->setFixedLayoutSize(WebSize(viewportWidth, viewportHeight));
m_webView->resize(WebSize(viewportWidth, viewportHeight));
m_webView->setPageScaleFactorLimits(1.0f, 4);
m_webView->setDeviceScaleFactor(deviceScaleFactor);

Powered by Google App Engine
This is Rietveld 408576698