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

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

Issue 201153008: Fix RenderBlock::percentHeightDescendants() (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 9 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
« no previous file with comments | « Source/core/rendering/svg/RenderSVGRoot.cpp ('k') | Source/web/tests/data/percent-height-descendants.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/web/tests/WebFrameTest.cpp
diff --git a/Source/web/tests/WebFrameTest.cpp b/Source/web/tests/WebFrameTest.cpp
index d39bc920fd639a006c07ef4aee8d6e911ac4ea86..cfc5ff32446fd87aec4be11cb682b4e30b829fba 100644
--- a/Source/web/tests/WebFrameTest.cpp
+++ b/Source/web/tests/WebFrameTest.cpp
@@ -5243,4 +5243,33 @@ TEST_F(WebFrameTest, FrameViewSetFrameRect)
EXPECT_EQ_RECT(WebCore::IntRect(100, 100, 200, 200), frameView->frameRect());
}
+TEST_F(WebFrameTest, RenderBlockPercentHeightDescendants)
+{
+ registerMockedHttpURLLoad("percent-height-descendants.html");
+ FrameTestHelpers::WebViewHelper webViewHelper;
+ webViewHelper.initializeAndLoad(m_baseURL + "percent-height-descendants.html");
+
+ WebView* webView = webViewHelper.webView();
+ webView->resize(WebSize(800, 800));
+ webView->layout();
+
+ Document* document = toWebFrameImpl(webView->mainFrame())->frame()->document();
+ WebCore::RenderBlock* container = WebCore::toRenderBlock(document->getElementById("container")->renderer());
+ WebCore::RenderBox* percentHeightInAnonymous = WebCore::toRenderBox(document->getElementById("percent-height-in-anonymous")->renderer());
+ WebCore::RenderBox* percentHeightDirectChild = WebCore::toRenderBox(document->getElementById("percent-height-direct-child")->renderer());
+
+ EXPECT_TRUE(WebCore::RenderBlock::hasPercentHeightDescendant(percentHeightInAnonymous));
+ EXPECT_TRUE(WebCore::RenderBlock::hasPercentHeightDescendant(percentHeightDirectChild));
+
+ ASSERT_TRUE(container->percentHeightDescendants());
+ ASSERT_TRUE(container->hasPercentHeightDescendants());
+ EXPECT_EQ(2U, container->percentHeightDescendants()->size());
+ EXPECT_TRUE(container->percentHeightDescendants()->contains(percentHeightInAnonymous));
+ EXPECT_TRUE(container->percentHeightDescendants()->contains(percentHeightDirectChild));
+
+ WebCore::RenderBlock* anonymousBlock = percentHeightInAnonymous->containingBlock();
+ EXPECT_TRUE(anonymousBlock->isAnonymous());
+ EXPECT_FALSE(anonymousBlock->hasPercentHeightDescendants());
+}
+
} // namespace
« no previous file with comments | « Source/core/rendering/svg/RenderSVGRoot.cpp ('k') | Source/web/tests/data/percent-height-descendants.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698