Index: third_party/WebKit/Source/core/layout/LayoutMultiColumnFlowThread.cpp |
diff --git a/third_party/WebKit/Source/core/layout/LayoutMultiColumnFlowThread.cpp b/third_party/WebKit/Source/core/layout/LayoutMultiColumnFlowThread.cpp |
index 4731477579ec2afa4d170a3d00e8a856ae78947f..88dc399fb1500e19036e636afa4c79ae83b9cd3f 100644 |
--- a/third_party/WebKit/Source/core/layout/LayoutMultiColumnFlowThread.cpp |
+++ b/third_party/WebKit/Source/core/layout/LayoutMultiColumnFlowThread.cpp |
@@ -452,7 +452,7 @@ FragmentationContext* LayoutMultiColumnFlowThread::enclosingFragmentationContext |
return view()->fragmentationContext(); |
} |
-void LayoutMultiColumnFlowThread::appendNewFragmentainerGroupIfNeeded(LayoutUnit offsetInFlowThread) |
+void LayoutMultiColumnFlowThread::appendNewFragmentainerGroupIfNeeded(LayoutUnit bottomOffsetInFlowThread) |
{ |
if (!isPageLogicalHeightKnown()) { |
// If we have no clue about the height of the multicol container, bail. This situation |
@@ -462,7 +462,11 @@ void LayoutMultiColumnFlowThread::appendNewFragmentainerGroupIfNeeded(LayoutUnit |
// Its height is indefinite for now. |
return; |
} |
- LayoutMultiColumnSet* columnSet = columnSetAtBlockOffset(offsetInFlowThread); |
+ // TODO(mstensho): bottomOffsetInFlowThread is an endpoint-exclusive offset, i.e. the offset |
+ // just after the bottom of some object. So, ideally, columnSetAtBlockOffset() should be |
+ // informed about this (i.e. take a PageBoundaryRule argument). This is not the only place with |
+ // this issue; see also pageRemainingLogicalHeightForOffset(). |
+ LayoutMultiColumnSet* columnSet = columnSetAtBlockOffset(bottomOffsetInFlowThread); |
if (columnSet->isInitialHeightCalculated()) { |
// We only insert additional fragmentainer groups in the initial layout pass. We only want |
// to balance columns in the last fragmentainer group (if we need to balance at all), so we |
@@ -470,7 +474,7 @@ void LayoutMultiColumnFlowThread::appendNewFragmentainerGroupIfNeeded(LayoutUnit |
return; |
} |
- if (!columnSet->hasFragmentainerGroupForColumnAt(offsetInFlowThread)) { |
+ if (!columnSet->hasFragmentainerGroupForColumnAt(bottomOffsetInFlowThread)) { |
FragmentationContext* enclosingFragmentationContext = this->enclosingFragmentationContext(); |
if (!enclosingFragmentationContext) |
return; // Not nested. We'll never need more rows than the one we already have then. |
@@ -480,7 +484,7 @@ void LayoutMultiColumnFlowThread::appendNewFragmentainerGroupIfNeeded(LayoutUnit |
// multicol container. That in turn may mean that we've run out of columns there too. |
const MultiColumnFragmentainerGroup& newRow = columnSet->appendNewFragmentainerGroup(); |
if (LayoutMultiColumnFlowThread* enclosingFlowThread = enclosingFragmentationContext->associatedFlowThread()) |
- enclosingFlowThread->appendNewFragmentainerGroupIfNeeded(newRow.blockOffsetInEnclosingFragmentationContext()); |
+ enclosingFlowThread->appendNewFragmentainerGroupIfNeeded(newRow.blockOffsetInEnclosingFragmentationContext() + newRow.logicalHeight()); |
} |
} |
@@ -936,7 +940,7 @@ void LayoutMultiColumnFlowThread::layout() |
m_lastSetWorkedOn = nullptr; |
} |
-void LayoutMultiColumnFlowThread::contentWasLaidOut(LayoutUnit logicalTopInFlowThreadAfterPagination) |
+void LayoutMultiColumnFlowThread::contentWasLaidOut(LayoutUnit logicalBottomInFlowThreadAfterPagination) |
{ |
// Check if we need another fragmentainer group. If we've run out of columns in the last |
// fragmentainer group (column row), we need to insert another fragmentainer group to hold more |
@@ -952,7 +956,7 @@ void LayoutMultiColumnFlowThread::contentWasLaidOut(LayoutUnit logicalTopInFlowT |
bool mayBeNested = multiColumnBlockFlow()->isInsideFlowThread() || view()->fragmentationContext(); |
if (!mayBeNested) |
return; |
- appendNewFragmentainerGroupIfNeeded(logicalTopInFlowThreadAfterPagination); |
+ appendNewFragmentainerGroupIfNeeded(logicalBottomInFlowThreadAfterPagination); |
} |
} |