Index: Source/core/layout/LayoutPagedFlowThread.cpp |
diff --git a/Source/core/layout/LayoutPagedFlowThread.cpp b/Source/core/layout/LayoutPagedFlowThread.cpp |
index f43233e9143cdf268ce84e2809cb31cb5c9415d1..43105d001bc2e2daa969ca01a0d9fa6d4922b733 100644 |
--- a/Source/core/layout/LayoutPagedFlowThread.cpp |
+++ b/Source/core/layout/LayoutPagedFlowThread.cpp |
@@ -5,6 +5,8 @@ |
#include "config.h" |
#include "core/layout/LayoutPagedFlowThread.h" |
+#include "core/layout/LayoutMultiColumnSet.h" |
+ |
namespace blink { |
LayoutPagedFlowThread* LayoutPagedFlowThread::createAnonymous(Document& document, const ComputedStyle& parentStyle) |
@@ -15,6 +17,13 @@ LayoutPagedFlowThread* LayoutPagedFlowThread::createAnonymous(Document& document |
return LayoutObject; |
} |
+int LayoutPagedFlowThread::pageCount() |
+{ |
+ if (LayoutMultiColumnSet* columnSet = firstMultiColumnSet()) |
+ return columnSet->actualColumnCount(); |
+ return 1; |
+} |
+ |
bool LayoutPagedFlowThread::needsNewWidth() const |
{ |
return progressionIsInline() != pagedBlockFlow()->style()->hasInlinePaginationAxis(); |
@@ -30,8 +39,21 @@ void LayoutPagedFlowThread::updateLogicalWidth() |
void LayoutPagedFlowThread::layout() |
{ |
+ ASSERT(firstMultiColumnBox() == lastMultiColumnBox()); // There should either be zero or one of those for paged layout. |
setProgressionIsInline(pagedBlockFlow()->style()->hasInlinePaginationAxis()); |
LayoutMultiColumnFlowThread::layout(); |
+ |
+ LayoutMultiColumnSet* columnSet = firstMultiColumnSet(); |
+ if (!columnSet) |
+ return; |
+ LayoutUnit pageLogicalHeight = columnSet->pageLogicalHeight(); |
+ if (!pageLogicalHeight) |
+ return; // Page height not calculated yet. Happens in the first layout pass when height is auto. |
+ // Ensure uniform page height. We don't want the last page to be shorter than the others, |
+ // or it'll be impossible to scroll that whole page into view. |
+ LayoutUnit paddedLogicalBottomInFlowThread = pageLogicalHeight * pageCount(); |
+ ASSERT(paddedLogicalBottomInFlowThread >= columnSet->logicalBottomInFlowThread()); |
+ columnSet->endFlow(paddedLogicalBottomInFlowThread); |
} |
} // namespace blink |