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

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

Issue 1880283006: ColumnBalancer: Count line box overflow as space shortage. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 months 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/ColumnBalancer.cpp
diff --git a/third_party/WebKit/Source/core/layout/ColumnBalancer.cpp b/third_party/WebKit/Source/core/layout/ColumnBalancer.cpp
index 3023993789bdeda86e8e50571691a2fda2d9f2e5..45607bdde8b166eb4b9092b18e8d059939e91489 100644
--- a/third_party/WebKit/Source/core/layout/ColumnBalancer.cpp
+++ b/third_party/WebKit/Source/core/layout/ColumnBalancer.cpp
@@ -325,6 +325,15 @@ void MinimumSpaceShortageFinder::examineLine(const RootInlineBox& line)
ASSERT(isFirstAfterBreak(lineTopInFlowThread) || !line.paginationStrut() || !isLogicalTopWithinBounds(lineTopInFlowThread - line.paginationStrut()));
if (isFirstAfterBreak(lineTopInFlowThread))
recordSpaceShortage(lineHeight - line.paginationStrut());
+
+ // Even if the line box itself fits fine inside a column, some content may overflow the line
+ // box bottom (due to restrictive line-height, for instance). We should check if some portion
+ // of said overflow ends up in the next column. That counts as space shortage.
+ LayoutUnit lineBottomWithOverflow = lineTopInFlowThread + line.lineBottom() - lineTop;
+ if (group().columnLogicalTopForOffset(lineTopInFlowThread) != group().columnLogicalTopForOffset(lineBottomWithOverflow)) {
+ LayoutUnit shortage = lineBottomWithOverflow - group().columnLogicalTopForOffset(lineBottomWithOverflow);
+ recordSpaceShortage(shortage);
+ }
}
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698