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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
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 5225 matching lines...) Expand 10 before | Expand all | Expand 10 after
5236 FrameTestHelpers::WebViewHelper webViewHelper; 5236 FrameTestHelpers::WebViewHelper webViewHelper;
5237 webViewHelper.initializeAndLoad("about:blank"); 5237 webViewHelper.initializeAndLoad("about:blank");
5238 5238
5239 WebCore::FrameView* frameView = webViewHelper.webViewImpl()->mainFrameImpl() ->frameView(); 5239 WebCore::FrameView* frameView = webViewHelper.webViewImpl()->mainFrameImpl() ->frameView();
5240 frameView->setFrameRect(WebCore::IntRect(0, 0, 200, 200)); 5240 frameView->setFrameRect(WebCore::IntRect(0, 0, 200, 200));
5241 EXPECT_EQ_RECT(WebCore::IntRect(0, 0, 200, 200), frameView->frameRect()); 5241 EXPECT_EQ_RECT(WebCore::IntRect(0, 0, 200, 200), frameView->frameRect());
5242 frameView->setFrameRect(WebCore::IntRect(100, 100, 200, 200)); 5242 frameView->setFrameRect(WebCore::IntRect(100, 100, 200, 200));
5243 EXPECT_EQ_RECT(WebCore::IntRect(100, 100, 200, 200), frameView->frameRect()) ; 5243 EXPECT_EQ_RECT(WebCore::IntRect(100, 100, 200, 200), frameView->frameRect()) ;
5244 } 5244 }
5245 5245
5246 TEST_F(WebFrameTest, RenderBlockPercentHeightDescendants)
5247 {
5248 registerMockedHttpURLLoad("percent-height-descendants.html");
5249 FrameTestHelpers::WebViewHelper webViewHelper;
5250 webViewHelper.initializeAndLoad(m_baseURL + "percent-height-descendants.html ");
5251
5252 WebView* webView = webViewHelper.webView();
5253 webView->resize(WebSize(800, 800));
5254 webView->layout();
5255
5256 Document* document = toWebFrameImpl(webView->mainFrame())->frame()->document ();
5257 WebCore::RenderBlock* container = WebCore::toRenderBlock(document->getElemen tById("container")->renderer());
5258 WebCore::RenderBox* percentHeightInAnonymous = WebCore::toRenderBox(document ->getElementById("percent-height-in-anonymous")->renderer());
5259 WebCore::RenderBox* percentHeightDirectChild = WebCore::toRenderBox(document ->getElementById("percent-height-direct-child")->renderer());
5260
5261 EXPECT_TRUE(WebCore::RenderBlock::hasPercentHeightDescendant(percentHeightIn Anonymous));
5262 EXPECT_TRUE(WebCore::RenderBlock::hasPercentHeightDescendant(percentHeightDi rectChild));
5263
5264 ASSERT_TRUE(container->percentHeightDescendants());
5265 ASSERT_TRUE(container->hasPercentHeightDescendants());
5266 EXPECT_EQ(2U, container->percentHeightDescendants()->size());
5267 EXPECT_TRUE(container->percentHeightDescendants()->contains(percentHeightInA nonymous));
5268 EXPECT_TRUE(container->percentHeightDescendants()->contains(percentHeightDir ectChild));
5269
5270 WebCore::RenderBlock* anonymousBlock = percentHeightInAnonymous->containingB lock();
5271 EXPECT_TRUE(anonymousBlock->isAnonymous());
5272 EXPECT_FALSE(anonymousBlock->hasPercentHeightDescendants());
5273 }
5274
5246 } // namespace 5275 } // namespace
OLDNEW
« 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