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

Unified Diff: Source/core/rendering/RenderMultiColumnBlock.cpp

Issue 147233002: Remove internal recursion for RenderBlockFlow and RenderMultiColumnBlock layout (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase to apply on latest trunk Created 6 years, 11 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/RenderMultiColumnBlock.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/rendering/RenderMultiColumnBlock.cpp
diff --git a/Source/core/rendering/RenderMultiColumnBlock.cpp b/Source/core/rendering/RenderMultiColumnBlock.cpp
index 53c1fe86a66c5df918107f3922f3ffc85aac4933..70a194a79009d806f03823e2a92d542ebf46e4bc 100644
--- a/Source/core/rendering/RenderMultiColumnBlock.cpp
+++ b/Source/core/rendering/RenderMultiColumnBlock.cpp
@@ -95,45 +95,33 @@ void RenderMultiColumnBlock::checkForPaginationLogicalHeightChange(LayoutUnit& /
setLogicalHeight(0);
}
-bool RenderMultiColumnBlock::relayoutForPagination(bool, LayoutUnit, LayoutStateMaintainer& statePusher)
+bool RenderMultiColumnBlock::shouldRelayoutMultiColumnBlock() const
{
- if (m_inBalancingPass || !requiresBalancing())
+ if (!requiresBalancing())
return false;
- m_inBalancingPass = true; // Prevent re-entering this method (and recursion into layout).
-
- bool needsRelayout;
- bool neededRelayout = false;
- bool firstPass = true;
- do {
- // Column heights may change here because of balancing. We may have to do multiple layout
- // passes, depending on how the contents is fitted to the changed column heights. In most
- // cases, laying out again twice or even just once will suffice. Sometimes we need more
- // passes than that, though, but the number of retries should not exceed the number of
- // columns, unless we have a bug.
- needsRelayout = false;
- for (RenderBox* childBox = firstChildBox(); childBox; childBox = childBox->nextSiblingBox()) {
- if (childBox != m_flowThread && childBox->isRenderMultiColumnSet()) {
- RenderMultiColumnSet* multicolSet = toRenderMultiColumnSet(childBox);
- if (multicolSet->calculateBalancedHeight(firstPass)) {
- multicolSet->setChildNeedsLayout(MarkOnlyThis);
- needsRelayout = true;
- }
+
+ // Column heights may change here because of balancing. We may have to do multiple layout
+ // passes, depending on how the contents is fitted to the changed column heights. In most
+ // cases, laying out again twice or even just once will suffice. Sometimes we need more
+ // passes than that, though, but the number of retries should not exceed the number of
+ // columns, unless we have a bug.
+ bool needsRelayout = false;
+ for (RenderBox* childBox = firstChildBox(); childBox; childBox = childBox->nextSiblingBox()) {
+ if (childBox != m_flowThread && childBox->isRenderMultiColumnSet()) {
+ RenderMultiColumnSet* multicolSet = toRenderMultiColumnSet(childBox);
+ if (multicolSet->calculateBalancedHeight(!m_inBalancingPass)) {
+ multicolSet->setChildNeedsLayout(MarkOnlyThis);
+ needsRelayout = true;
}
}
+ }
- if (needsRelayout) {
- // Layout again. Column balancing resulted in a new height.
- neededRelayout = true;
- m_flowThread->setChildNeedsLayout(MarkOnlyThis);
- setChildNeedsLayout(MarkOnlyThis);
- if (firstPass)
- statePusher.pop();
- layoutBlock(false);
- }
- firstPass = false;
- } while (needsRelayout);
- m_inBalancingPass = false;
- return neededRelayout;
+ if (needsRelayout)
+ m_flowThread->setChildNeedsLayout(MarkOnlyThis);
+
+
+ m_inBalancingPass = needsRelayout;
+ return needsRelayout;
}
void RenderMultiColumnBlock::addChild(RenderObject* newChild, RenderObject* beforeChild)
« no previous file with comments | « Source/core/rendering/RenderMultiColumnBlock.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698