Index: Source/core/rendering/RenderBlockFlow.cpp |
diff --git a/Source/core/rendering/RenderBlockFlow.cpp b/Source/core/rendering/RenderBlockFlow.cpp |
index 1e5e7fd046b940073b8555b2fc13061822a561cd..7e1806454ed73e3d3bdf72ce01d3917d374d03d6 100644 |
--- a/Source/core/rendering/RenderBlockFlow.cpp |
+++ b/Source/core/rendering/RenderBlockFlow.cpp |
@@ -228,8 +228,20 @@ void RenderBlockFlow::checkForPaginationLogicalHeightChange(LayoutUnit& pageLogi |
if (!hasSpecifiedPageLogicalHeight && !pageLogicalHeight) |
colInfo->clearForcedBreaks(); |
} else if (isRenderFlowThread()) { |
- pageLogicalHeight = 1; // This is just a hack to always make sure we have a page logical height. |
- pageLogicalHeightChanged = toRenderFlowThread(this)->pageLogicalSizeChanged(); |
+ RenderFlowThread* flowThread = toRenderFlowThread(this); |
+ |
+ // FIXME: This is a hack to always make sure we have a page logical height, if said height |
+ // is known. The page logical height thing in LayoutState is meaningless for flow |
+ // thread-based pagination (page height isn't necessarily uniform throughout the flow |
+ // thread), but as long as it is used universally as a means to determine whether page |
+ // height is known or not, we need this. Page height is unknown when column balancing is |
+ // enabled and flow thread height is still unknown (i.e. during the first layout pass). When |
+ // it's unknown, we need to prevent the pagination code from assuming page breaks everywhere |
+ // and thereby eating every top margin. It should be trivial to clean up and get rid of this |
+ // hack once the old multicol implementation is gone. |
+ pageLogicalHeight = flowThread->isPageLogicalHeightKnown() ? LayoutUnit(1) : LayoutUnit(0); |
+ |
+ pageLogicalHeightChanged = flowThread->pageLogicalSizeChanged(); |
} |
} |