Index: Source/core/layout/LayoutBlockFlow.cpp |
diff --git a/Source/core/layout/LayoutBlockFlow.cpp b/Source/core/layout/LayoutBlockFlow.cpp |
index aadf77050085befb9e4b45132a7b5d0a17cb1119..c9aaf9d18baabbfc115ff8696bef66f54b525fc8 100644 |
--- a/Source/core/layout/LayoutBlockFlow.cpp |
+++ b/Source/core/layout/LayoutBlockFlow.cpp |
@@ -854,7 +854,9 @@ LayoutUnit LayoutBlockFlow::adjustForUnsplittableChild(LayoutBox& child, LayoutU |
if (!pageLogicalHeight) |
return logicalOffset; |
LayoutUnit remainingLogicalHeight = pageRemainingLogicalHeightForOffset(logicalOffset, AssociateWithLatterPage); |
- if (remainingLogicalHeight < childLogicalHeight) |
+ // Break if there's not enough space left for us, but only as long as we're not already at the |
+ // top of a page. No point in leaving a page completely blank. |
+ if (remainingLogicalHeight < childLogicalHeight && remainingLogicalHeight < pageLogicalHeight) |
return logicalOffset + remainingLogicalHeight; |
return logicalOffset; |
} |