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

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

Issue 911083002: Carry out a resize even if no layout has been performed. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Made needsLayout() true when forcing zero-height and added unit test Created 5 years, 10 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 ed37af9ec251f6c0a1fff35466be1896532ba67b..e4d163e4ceda2739939cb020d9908ad29cf3710a 100644
--- a/Source/web/tests/WebFrameTest.cpp
+++ b/Source/web/tests/WebFrameTest.cpp
@@ -1317,7 +1317,6 @@ TEST_F(WebFrameTest, SetForceZeroLayoutHeightWorksWithWrapContentsMode)
EXPECT_EQ(viewportWidth, webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->layoutSize().width());
EXPECT_EQ(0, webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->layoutSize().height());
EXPECT_EQ(viewportWidth, compositor->containerLayer()->size().width());
- EXPECT_EQ(0.0, compositor->containerLayer()->size().height());
LocalFrame* frame = webViewHelper.webViewImpl()->mainFrameImpl()->frame();
PinchViewport& pinchViewport = frame->page()->frameHost().pinchViewport();
@@ -1360,6 +1359,34 @@ TEST_F(WebFrameTest, SetForceZeroLayoutHeight)
EXPECT_LE(viewportHeight, webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->layoutSize().height());
}
+TEST_F(WebFrameTest, SetForceZeroLayoutHeightWorksWithRelayoutsWhenHeightChanged)
+{
+ UseMockScrollbarSettings mockScrollbarSettings;
+ registerMockedHttpURLLoad("button.html");
+
+ FixedLayoutTestWebViewClient client;
+ client.m_screenInfo.deviceScaleFactor = 1;
+ int viewportWidth = 640;
+ int viewportHeight = 480;
+
+ FrameTestHelpers::WebViewHelper webViewHelper;
+
+ webViewHelper.initializeAndLoad(m_baseURL + "button.html", true, 0, &client, configurePinchVirtualViewport);
+ 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.
+ webViewHelper.webView()->layout();
+
+ webViewHelper.webView()->settings()->setForceZeroLayoutHeight(true);
+ EXPECT_TRUE(webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->needsLayout());
+
+ webViewHelper.webView()->resize(WebSize(viewportWidth, viewportHeight));
+
+ IntPoint hitPoint = IntPoint(30, 30); // button size is 100x100
+
+ RefPtrWillBeRawPtr<Node> hitNode = webViewHelper.webViewImpl()->mainFrameImpl()->frame()->eventHandler().hitTestResultAtPoint(hitPoint, HitTestRequest::ReadOnly | 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.
+ EXPECT_NE(nullptr, hitNode.get());
+ EXPECT_EQ(String("BUTTON"), hitNode->nodeName());
+}
+
TEST_F(WebFrameTest, SetForceZeroLayoutHeightWorksAcrossNavigations)
{
UseMockScrollbarSettings mockScrollbarSettings;

Powered by Google App Engine
This is Rietveld 408576698