Index: Source/core/rendering/RenderBlockFlow.cpp |
diff --git a/Source/core/rendering/RenderBlockFlow.cpp b/Source/core/rendering/RenderBlockFlow.cpp |
index 1e5e7fd046b940073b8555b2fc13061822a561cd..b43d5e271053c7f5773953cd644851c66238a36c 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); |
+ |
+ // 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(); |
} |
} |