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

Side by Side Diff: Source/core/rendering/RenderMultiColumnSet.cpp

Issue 264773018: [New Multicolumn] Remove the term "balancing" from some member names. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Code review. Created 6 years, 7 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 unified diff | Download patch
« no previous file with comments | « Source/core/rendering/RenderMultiColumnSet.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Apple Inc. All rights reserved. 2 * Copyright (C) 2012 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 // column count by one and shrink its columns' height. Repeat until we have the desired total 136 // column count by one and shrink its columns' height. Repeat until we have the desired total
137 // number of breaks. The largest column height among the runs will then be t he initial column 137 // number of breaks. The largest column height among the runs will then be t he initial column
138 // height for the balancer to use. 138 // height for the balancer to use.
139 while (breakCount < m_computedColumnCount) { 139 while (breakCount < m_computedColumnCount) {
140 unsigned index = findRunWithTallestColumns(); 140 unsigned index = findRunWithTallestColumns();
141 m_contentRuns[index].assumeAnotherImplicitBreak(); 141 m_contentRuns[index].assumeAnotherImplicitBreak();
142 breakCount++; 142 breakCount++;
143 } 143 }
144 } 144 }
145 145
146 LayoutUnit RenderMultiColumnSet::calculateBalancedHeight(bool initial) const 146 LayoutUnit RenderMultiColumnSet::calculateColumnHeight(bool initial) const
147 { 147 {
148 if (initial) { 148 if (initial) {
149 // Start with the lowest imaginable column height. 149 // Start with the lowest imaginable column height.
150 unsigned index = findRunWithTallestColumns(); 150 unsigned index = findRunWithTallestColumns();
151 LayoutUnit startOffset = index > 0 ? m_contentRuns[index - 1].breakOffse t() : LayoutUnit(); 151 LayoutUnit startOffset = index > 0 ? m_contentRuns[index - 1].breakOffse t() : LayoutUnit();
152 return std::max<LayoutUnit>(m_contentRuns[index].columnLogicalHeight(sta rtOffset), m_minimumColumnHeight); 152 return std::max<LayoutUnit>(m_contentRuns[index].columnLogicalHeight(sta rtOffset), m_minimumColumnHeight);
153 } 153 }
154 154
155 if (columnCount() <= computedColumnCount()) { 155 if (columnCount() <= computedColumnCount()) {
156 // With the current column height, the content fits without creating ove rflowing columns. We're done. 156 // With the current column height, the content fits without creating ove rflowing columns. We're done.
(...skipping 27 matching lines...) Expand all
184 if (!multiColumnFlowThread()->requiresBalancing()) 184 if (!multiColumnFlowThread()->requiresBalancing())
185 return; 185 return;
186 if (!m_contentRuns.isEmpty() && offsetFromFirstPage <= m_contentRuns.last(). breakOffset()) 186 if (!m_contentRuns.isEmpty() && offsetFromFirstPage <= m_contentRuns.last(). breakOffset())
187 return; 187 return;
188 // Append another item as long as we haven't exceeded used column count. Wha t ends up in the 188 // Append another item as long as we haven't exceeded used column count. Wha t ends up in the
189 // overflow area shouldn't affect column balancing. 189 // overflow area shouldn't affect column balancing.
190 if (m_contentRuns.size() < m_computedColumnCount) 190 if (m_contentRuns.size() < m_computedColumnCount)
191 m_contentRuns.append(ContentRun(offsetFromFirstPage)); 191 m_contentRuns.append(ContentRun(offsetFromFirstPage));
192 } 192 }
193 193
194 bool RenderMultiColumnSet::recalculateBalancedHeight(bool initial) 194 bool RenderMultiColumnSet::recalculateColumnHeight(bool initial)
195 { 195 {
196 ASSERT(multiColumnFlowThread()->requiresBalancing()); 196 ASSERT(multiColumnFlowThread()->requiresBalancing());
197 197
198 LayoutUnit oldColumnHeight = m_computedColumnHeight; 198 LayoutUnit oldColumnHeight = m_computedColumnHeight;
199 if (initial) 199 if (initial)
200 distributeImplicitBreaks(); 200 distributeImplicitBreaks();
201 LayoutUnit newColumnHeight = calculateBalancedHeight(initial); 201 LayoutUnit newColumnHeight = calculateColumnHeight(initial);
202 setAndConstrainColumnHeight(newColumnHeight); 202 setAndConstrainColumnHeight(newColumnHeight);
203 203
204 // After having calculated an initial column height, the multicol container typically needs at 204 // After having calculated an initial column height, the multicol container typically needs at
205 // least one more layout pass with a new column height, but if a height was specified, we only 205 // least one more layout pass with a new column height, but if a height was specified, we only
206 // need to do this if we think that we need less space than specified. Conve rsely, if we 206 // need to do this if we think that we need less space than specified. Conve rsely, if we
207 // determined that the columns need to be as tall as the specified height of the container, we 207 // determined that the columns need to be as tall as the specified height of the container, we
208 // have already laid it out correctly, and there's no need for another pass. 208 // have already laid it out correctly, and there's no need for another pass.
209 209
210 if (m_computedColumnHeight == oldColumnHeight) 210 if (m_computedColumnHeight == oldColumnHeight)
211 return false; // No change. We're done. 211 return false; // No change. We're done.
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after
604 fragments.append(fragment); 604 fragments.append(fragment);
605 } 605 }
606 } 606 }
607 607
608 const char* RenderMultiColumnSet::renderName() const 608 const char* RenderMultiColumnSet::renderName() const
609 { 609 {
610 return "RenderMultiColumnSet"; 610 return "RenderMultiColumnSet";
611 } 611 }
612 612
613 } 613 }
OLDNEW
« no previous file with comments | « Source/core/rendering/RenderMultiColumnSet.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698