Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(601)

Unified Diff: third_party/WebKit/Source/core/layout/LayoutBlock.cpp

Issue 1472053002: Jump to the next outer column when an inner column is too short. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: code review Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/layout/LayoutBlock.cpp
diff --git a/third_party/WebKit/Source/core/layout/LayoutBlock.cpp b/third_party/WebKit/Source/core/layout/LayoutBlock.cpp
index 787e482c7748bf02e6f52753bd3a675e4571a292..2155f0fb821d12c15e88232f0b100bd6df333086 100644
--- a/third_party/WebKit/Source/core/layout/LayoutBlock.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutBlock.cpp
@@ -2653,6 +2653,27 @@ LayoutUnit LayoutBlock::pageRemainingLogicalHeightForOffset(LayoutUnit offset, P
return flowThread->pageRemainingLogicalHeightForOffset(offset, pageBoundaryRule);
}
+LayoutUnit LayoutBlock::calculatePaginationStrutToFitContent(LayoutUnit offset, LayoutUnit strutToNextPage, LayoutUnit contentLogicalHeight) const
+{
+ ASSERT(strutToNextPage == pageRemainingLogicalHeightForOffset(offset, AssociateWithLatterPage));
+ LayoutUnit nextPageLogicalTop = offset + strutToNextPage;
+ if (pageLogicalHeightForOffset(nextPageLogicalTop) >= contentLogicalHeight)
+ return strutToNextPage; // Content fits just fine in the next page or column.
+
+ // Moving to the top of the next page or column doesn't result in enough space for the content
+ // that we're trying to fit. If we're in a nested fragmentation context, we may find enough
+ // space if we move to a column further ahead, by effectively breaking to the next outer
+ // fragmentainer.
+ LayoutFlowThread* flowThread = flowThreadContainingBlock();
+ if (!flowThread) {
+ // If there's no flow thread, we're not nested. All pages have the same height. Give up.
+ return strutToNextPage;
+ }
+ // Start searching for a suitable offset at the top of the next page or column.
+ LayoutUnit flowThreadOffset = offsetFromLogicalTopOfFirstPage() + nextPageLogicalTop;
+ return strutToNextPage + flowThread->nextLogicalTopForUnbreakableContent(flowThreadOffset, contentLogicalHeight) - flowThreadOffset;
+}
+
void LayoutBlock::paginatedContentWasLaidOut(LayoutUnit logicalTopOffsetAfterPagination)
{
if (LayoutFlowThread* flowThread = flowThreadContainingBlock())
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutBlock.h ('k') | third_party/WebKit/Source/core/layout/LayoutBlockFlow.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698