Index: Source/core/layout/LayoutBlockFlow.cpp |
diff --git a/Source/core/layout/LayoutBlockFlow.cpp b/Source/core/layout/LayoutBlockFlow.cpp |
index 4a61c42bd3e755cbc2d2aee165a938c4d64d2172..92339397838f5d5798dd85b13e38564c4f5a490b 100644 |
--- a/Source/core/layout/LayoutBlockFlow.cpp |
+++ b/Source/core/layout/LayoutBlockFlow.cpp |
@@ -209,11 +209,23 @@ bool LayoutBlockFlow::updateLogicalWidthAndColumnWidth() |
void LayoutBlockFlow::checkForPaginationLogicalHeightChange(LayoutUnit& pageLogicalHeight, bool& pageLogicalHeightChanged, bool& hasSpecifiedPageLogicalHeight) |
{ |
if (LayoutMultiColumnFlowThread* flowThread = multiColumnFlowThread()) { |
- LogicalExtentComputedValues computedValues; |
- computeLogicalHeight(LayoutUnit(), logicalTop(), computedValues); |
- LayoutUnit columnHeight = computedValues.m_extent - borderAndPaddingLogicalHeight() - scrollbarLogicalHeight(); |
+ // Calculate the non-auto content box height, or set it to 0 if it's auto. We need to know |
+ // this before layout, so that we can figure out where to insert column breaks. We also |
+ // treat LayoutView (which may be paginated, which uses the multicol implmentation) as |
+ // having non-auto height, since its height is deduced from the viewport height. We use |
+ // computeLogicalHeight() to calculate the content box height. That method will clamp |
+ // against max-height and min-height. Since we're now at the beginning of layout, and we |
+ // don't know the actual height of the content yet, only call that method when height is |
+ // definite, or we might fool ourselves into believing that columns have a definite height |
+ // when they in fact don't. |
+ LayoutUnit columnHeight; |
+ if (hasDefiniteLogicalHeight() || isLayoutView()) { |
+ LogicalExtentComputedValues computedValues; |
+ computeLogicalHeight(LayoutUnit(), logicalTop(), computedValues); |
+ columnHeight = computedValues.m_extent - borderAndPaddingLogicalHeight() - scrollbarLogicalHeight(); |
+ } |
pageLogicalHeightChanged = columnHeight != flowThread->columnHeightAvailable(); |
- flowThread->setColumnHeightAvailable(std::max<LayoutUnit>(columnHeight, 0)); |
+ flowThread->setColumnHeightAvailable(std::max(columnHeight, LayoutUnit())); |
} else if (isLayoutFlowThread()) { |
LayoutFlowThread* flowThread = toLayoutFlowThread(this); |