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

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

Issue 2493833004: InitialColumnHeightFinder needs to take all expected rows into account. (Closed)
Patch Set: Code review Created 4 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/ColumnBalancer.h
diff --git a/third_party/WebKit/Source/core/layout/ColumnBalancer.h b/third_party/WebKit/Source/core/layout/ColumnBalancer.h
index e9e724f499a7f5be31e357835019d6626eb63089..0593a6bed439a4e2200fa3c072a03f5914f819cb 100644
--- a/third_party/WebKit/Source/core/layout/ColumnBalancer.h
+++ b/third_party/WebKit/Source/core/layout/ColumnBalancer.h
@@ -150,6 +150,23 @@ class InitialColumnHeightFinder final : public ColumnBalancer {
// in order to calculate an initial column height.
void addContentRun(LayoutUnit endOffsetInFlowThread);
+ // Normally we'll just return 0 here, because in most cases we won't add more
+ // content runs than used column-count. However, if we're at the initial
+ // balancing pass for a multicol that lives inside another to-be-balanced
+ // outer multicol container, and there is a sufficient number of forced column
+ // breaks, we may exceed used column-count. In such cases, we're going to
+ // assume a minimal number of fragmentainer groups (rows) that will eventually
+ // be created, and when distributing implicit column breaks to calculate an
+ // initial balanced height, we'll only focus on content that has any chance at
+ // all to end up in the last row.
+ unsigned firstContentRunIndexInLastRow() const {
+ unsigned columnCount = columnSet().usedColumnCount();
+ if (m_contentRuns.size() <= columnCount)
+ return 0;
+ unsigned lastRunIndex = m_contentRuns.size() - 1;
+ return lastRunIndex / columnCount * columnCount;
+ }
+
// Return the index of the content run with the currently tallest columns,
// taking all implicit breaks assumed so far into account.
unsigned contentRunIndexWithTallestColumns() const;

Powered by Google App Engine
This is Rietveld 408576698