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

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

Issue 1647313003: Continue converting to explicit LayoutUnit constructors (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@explicitContstructors
Patch Set: Add TODO Created 4 years, 10 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
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/MultiColumnFragmentainerGroup.h" 5 #include "core/layout/MultiColumnFragmentainerGroup.h"
6 6
7 namespace blink { 7 namespace blink {
8 8
9 // A column balancer traverses the portion of the subtree of a flow thread that belongs to a given 9 // A column balancer traverses the portion of the subtree of a flow thread that belongs to a given
10 // fragmentainer group, in order to collect certain data to be used for column b alancing. This is an 10 // fragmentainer group, in order to collect certain data to be used for column b alancing. This is an
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 ContentRun(LayoutUnit breakOffset) 125 ContentRun(LayoutUnit breakOffset)
126 : m_breakOffset(breakOffset) 126 : m_breakOffset(breakOffset)
127 , m_assumedImplicitBreaks(0) { } 127 , m_assumedImplicitBreaks(0) { }
128 128
129 unsigned assumedImplicitBreaks() const { return m_assumedImplicitBreaks; } 129 unsigned assumedImplicitBreaks() const { return m_assumedImplicitBreaks; }
130 void assumeAnotherImplicitBreak() { m_assumedImplicitBreaks++; } 130 void assumeAnotherImplicitBreak() { m_assumedImplicitBreaks++; }
131 LayoutUnit breakOffset() const { return m_breakOffset; } 131 LayoutUnit breakOffset() const { return m_breakOffset; }
132 132
133 // Return the column height that this content run would require, conside ring the implicit 133 // Return the column height that this content run would require, conside ring the implicit
134 // breaks assumed so far. 134 // breaks assumed so far.
135 LayoutUnit columnLogicalHeight(LayoutUnit startOffset) const { return ce ilf((m_breakOffset - startOffset).toFloat() / float(m_assumedImplicitBreaks + 1) ); } 135 LayoutUnit columnLogicalHeight(LayoutUnit startOffset) const
136 {
137 // TODO(leviw): This should probably be fromFloatCeil.
138 return LayoutUnit(ceilf((m_breakOffset - startOffset) / float(m_assu medImplicitBreaks + 1)));
139 }
136 140
137 private: 141 private:
138 LayoutUnit m_breakOffset; // Flow thread offset where this run ends. 142 LayoutUnit m_breakOffset; // Flow thread offset where this run ends.
139 unsigned m_assumedImplicitBreaks; // Number of implicit breaks in this r un assumed so far. 143 unsigned m_assumedImplicitBreaks; // Number of implicit breaks in this r un assumed so far.
140 }; 144 };
141 Vector<ContentRun, 32> m_contentRuns; 145 Vector<ContentRun, 32> m_contentRuns;
142 146
143 // Shortest strut found at each column boundary (index 0 being the boundary between the first 147 // Shortest strut found at each column boundary (index 0 being the boundary between the first
144 // and the second column, index 1 being the one between the second and the t hird boundary, and 148 // and the second column, index 1 being the one between the second and the t hird boundary, and
145 // so on). There may be several objects that cross the same column boundary, and we're only 149 // so on). There may be several objects that cross the same column boundary, and we're only
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 LayoutUnit m_minimumSpaceShortage; 189 LayoutUnit m_minimumSpaceShortage;
186 190
187 // Set when breaking before a block, and we're looking for the first unbreak able descendant, in 191 // Set when breaking before a block, and we're looking for the first unbreak able descendant, in
188 // order to report correct space shortage for that one. 192 // order to report correct space shortage for that one.
189 LayoutUnit m_pendingStrut; 193 LayoutUnit m_pendingStrut;
190 194
191 unsigned m_forcedBreaksCount; 195 unsigned m_forcedBreaksCount;
192 }; 196 };
193 197
194 } // namespace blink 198 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698