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

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

Issue 143383002: Region based multicol: support explicit column breaks (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Code review. Created 6 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
« no previous file with comments | « Source/core/rendering/RenderMultiColumnBlock.h ('k') | Source/core/rendering/RenderMultiColumnFlowThread.h » ('j') | 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 70a194a79009d806f03823e2a92d542ebf46e4bc..71a72de8be43d4f4efad0a111e002932b20596b6 100644
--- a/Source/core/rendering/RenderMultiColumnBlock.cpp
+++ b/Source/core/rendering/RenderMultiColumnBlock.cpp
@@ -41,6 +41,7 @@ RenderMultiColumnBlock::RenderMultiColumnBlock(Element* element)
, m_columnWidth(0)
, m_columnHeightAvailable(0)
, m_inBalancingPass(false)
+ , m_needsRebalancing(false)
{
}
@@ -95,9 +96,9 @@ void RenderMultiColumnBlock::checkForPaginationLogicalHeightChange(LayoutUnit& /
setLogicalHeight(0);
}
-bool RenderMultiColumnBlock::shouldRelayoutMultiColumnBlock() const
+bool RenderMultiColumnBlock::shouldRelayoutMultiColumnBlock()
{
- if (!requiresBalancing())
+ if (!m_needsRebalancing)
return false;
// Column heights may change here because of balancing. We may have to do multiple layout
@@ -109,7 +110,7 @@ bool RenderMultiColumnBlock::shouldRelayoutMultiColumnBlock() const
for (RenderBox* childBox = firstChildBox(); childBox; childBox = childBox->nextSiblingBox()) {
if (childBox != m_flowThread && childBox->isRenderMultiColumnSet()) {
RenderMultiColumnSet* multicolSet = toRenderMultiColumnSet(childBox);
- if (multicolSet->calculateBalancedHeight(!m_inBalancingPass)) {
+ if (multicolSet->recalculateBalancedHeight(!m_inBalancingPass)) {
multicolSet->setChildNeedsLayout(MarkOnlyThis);
needsRelayout = true;
}
@@ -119,7 +120,6 @@ bool RenderMultiColumnBlock::shouldRelayoutMultiColumnBlock() const
if (needsRelayout)
m_flowThread->setChildNeedsLayout(MarkOnlyThis);
-
m_inBalancingPass = needsRelayout;
return needsRelayout;
}
@@ -160,6 +160,18 @@ RenderObject* RenderMultiColumnBlock::layoutSpecialExcludedChild(bool relayoutCh
if (relayoutChildren)
layoutScope.setChildNeedsLayout(m_flowThread);
+ if (requiresBalancing()) {
+ // At the end of multicol layout, relayoutForPagination() is called unconditionally, but if
+ // no children are to be laid out (e.g. fixed width with layout already being up-to-date),
+ // we want to prevent it from doing any work, so that the column balancing machinery doesn't
+ // kick in and trigger additional unnecessary layout passes. Actually, it's not just a good
+ // idea in general to not waste time on balancing content that hasn't been re-laid out; we
+ // are actually required to guarantee this. The calculation of implicit breaks needs to be
+ // preceded by a proper layout pass, since it's layout that sets up content runs, and the
+ // runs get deleted right after every pass.
+ m_needsRebalancing = shouldInvalidateRegions || m_flowThread->needsLayout();
+ }
+
setLogicalTopForChild(m_flowThread, borderBefore() + paddingBefore());
m_flowThread->layoutIfNeeded();
determineLogicalLeftPositionForChild(m_flowThread);
« no previous file with comments | « Source/core/rendering/RenderMultiColumnBlock.h ('k') | Source/core/rendering/RenderMultiColumnFlowThread.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698