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

Unified Diff: third_party/WebKit/Source/core/layout/ColumnBalancer.cpp

Issue 1461923005: When balancing columns, we must check inner multicols for unbreakable content. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: code review - std::max FTW Created 5 years, 1 month 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: third_party/WebKit/Source/core/layout/ColumnBalancer.cpp
diff --git a/third_party/WebKit/Source/core/layout/ColumnBalancer.cpp b/third_party/WebKit/Source/core/layout/ColumnBalancer.cpp
index 989f2d8d0d04ee35211470212a40d4bf7c8780ec..3de1e264d6c82d0d4b2cccf9a02f19e79ed3eb83 100644
--- a/third_party/WebKit/Source/core/layout/ColumnBalancer.cpp
+++ b/third_party/WebKit/Source/core/layout/ColumnBalancer.cpp
@@ -92,8 +92,7 @@ LayoutUnit InitialColumnHeightFinder::initialMinimalBalancedHeight() const
{
unsigned index = contentRunIndexWithTallestColumns();
LayoutUnit startOffset = index > 0 ? m_contentRuns[index - 1].breakOffset() : group().logicalTopInFlowThread();
- LayoutUnit logicalHeightEstimate = m_contentRuns[index].columnLogicalHeight(startOffset);
- return std::max(logicalHeightEstimate, m_minimumColumnLogicalHeight);
+ return m_contentRuns[index].columnLogicalHeight(startOffset);
}
void InitialColumnHeightFinder::examineBoxAfterEntering(const LayoutBox& box)
@@ -113,8 +112,13 @@ void InitialColumnHeightFinder::examineBoxAfterEntering(const LayoutBox& box)
LayoutUnit unsplittableLogicalHeight = box.logicalHeight();
if (box.isFloating())
unsplittableLogicalHeight += box.marginBefore() + box.marginAfter();
- if (m_minimumColumnLogicalHeight < unsplittableLogicalHeight)
- m_minimumColumnLogicalHeight = unsplittableLogicalHeight;
+ m_tallestUnbreakableLogicalHeight = std::max(m_tallestUnbreakableLogicalHeight, unsplittableLogicalHeight);
+ } else if (box.isLayoutBlockFlow()) {
+ if (LayoutMultiColumnFlowThread* innerFlowThread = toLayoutBlockFlow(box).multiColumnFlowThread()) {
+ LayoutUnit offsetInInnerFlowThread = flowThreadOffset() - innerFlowThread->blockOffsetInEnclosingFlowThread();
+ LayoutUnit innerUnbreakableHeight = innerFlowThread->tallestUnbreakableLogicalHeight(offsetInInnerFlowThread);
+ m_tallestUnbreakableLogicalHeight = std::max(m_tallestUnbreakableLogicalHeight, innerUnbreakableHeight);
+ }
}
}
@@ -138,8 +142,7 @@ void InitialColumnHeightFinder::examineLine(const RootInlineBox& line)
LayoutUnit lineTop = line.lineTopWithLeading();
LayoutUnit lineTopInFlowThread = flowThreadOffset() + lineTop;
LayoutUnit minimumLogialHeight = columnLogicalHeightRequirementForLine(line.block().styleRef(), line);
- if (m_minimumColumnLogicalHeight < minimumLogialHeight)
- m_minimumColumnLogicalHeight = minimumLogialHeight;
+ m_tallestUnbreakableLogicalHeight = std::max(m_tallestUnbreakableLogicalHeight, minimumLogialHeight);
ASSERT(isFirstAfterBreak(lineTopInFlowThread) || !line.paginationStrut());
if (isFirstAfterBreak(lineTopInFlowThread))
recordStrutBeforeOffset(lineTopInFlowThread, line.paginationStrut());

Powered by Google App Engine
This is Rietveld 408576698