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

Side by Side Diff: third_party/WebKit/Source/core/layout/ColumnBalancer.h

Issue 2493833004: InitialColumnHeightFinder needs to take all expected rows into account. (Closed)
Patch Set: 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/layout/LayoutMultiColumnSet.h" 5 #include "core/layout/LayoutMultiColumnSet.h"
6 6
7 namespace blink { 7 namespace blink {
8 8
9 // A column balancer traverses a portion of the subtree of a flow thread that 9 // A column balancer traverses a portion of the subtree of a flow thread that
10 // belongs to one or more fragmentainer groups within one column set, in order 10 // belongs to one or more fragmentainer groups within one column set, in order
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 // Return the accumulated space used by struts at all column boundaries 143 // Return the accumulated space used by struts at all column boundaries
144 // preceding the specified flowthread offset. 144 // preceding the specified flowthread offset.
145 LayoutUnit spaceUsedByStrutsAt(LayoutUnit offsetInFlowThread) const; 145 LayoutUnit spaceUsedByStrutsAt(LayoutUnit offsetInFlowThread) const;
146 146
147 // Add a content run, specified by its end position. A content run is appended 147 // Add a content run, specified by its end position. A content run is appended
148 // at every forced/explicit break and at the end of the column set. The 148 // at every forced/explicit break and at the end of the column set. The
149 // content runs are used to determine where implicit/soft breaks will occur, 149 // content runs are used to determine where implicit/soft breaks will occur,
150 // in order to calculate an initial column height. 150 // in order to calculate an initial column height.
151 void addContentRun(LayoutUnit endOffsetInFlowThread); 151 void addContentRun(LayoutUnit endOffsetInFlowThread);
152 152
153 // Normally we'll just return 0 here, because in most cases we won't add more
154 // content runs than used column-count. However, if we're at the initial
155 // balancing pass for a multicol that lives inside another to-be-balanced
156 // outer multicol container, and there is a sufficient number of forced column
157 // breaks, we may exceed used column-count. In such cases, we're going to
158 // assume a minimal number of fragmentainer groups (rows) that will eventually
159 // be created, and when distributing implicit column breaks to calculate an
160 // initial balanced height, we'll only focus on content that has any chance at
161 // all to end up in the last row.
162 unsigned firstContentRunIndexInLastRow() const {
163 unsigned columnCount = columnSet().usedColumnCount();
164 if (m_contentRuns.size() <= columnCount)
165 return 0;
166 unsigned lastRunIndex = m_contentRuns.size() - 1;
eae 2016/11/10 23:37:12 Is columnCount guaranteed to be at least one? If
mstensho (USE GERRIT) 2016/11/11 08:47:46 There should be no way for it to be 0, or we'd be
167 return lastRunIndex / columnCount * columnCount;
168 }
169
153 // Return the index of the content run with the currently tallest columns, 170 // Return the index of the content run with the currently tallest columns,
154 // taking all implicit breaks assumed so far into account. 171 // taking all implicit breaks assumed so far into account.
155 unsigned contentRunIndexWithTallestColumns() const; 172 unsigned contentRunIndexWithTallestColumns() const;
156 173
157 // Given the current list of content runs, make assumptions about where we 174 // Given the current list of content runs, make assumptions about where we
158 // need to insert implicit breaks (if there's room for any at all; depending 175 // need to insert implicit breaks (if there's room for any at all; depending
159 // on the number of explicit breaks), and store the results. This is needed in 176 // on the number of explicit breaks), and store the results. This is needed in
160 // order to balance the columns. 177 // order to balance the columns.
161 void distributeImplicitBreaks(); 178 void distributeImplicitBreaks();
162 179
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 261
245 // Set when breaking before a block, and we're looking for the first 262 // Set when breaking before a block, and we're looking for the first
246 // unbreakable descendant, in order to report correct space shortage for that 263 // unbreakable descendant, in order to report correct space shortage for that
247 // one. 264 // one.
248 LayoutUnit m_pendingStrut; 265 LayoutUnit m_pendingStrut;
249 266
250 unsigned m_forcedBreaksCount; 267 unsigned m_forcedBreaksCount;
251 }; 268 };
252 269
253 } // namespace blink 270 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698