| OLD | NEW |
| 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 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 , m_assumedImplicitBreaks(0) { } | 133 , m_assumedImplicitBreaks(0) { } |
| 134 | 134 |
| 135 unsigned assumedImplicitBreaks() const { return m_assumedImplicitBreaks;
} | 135 unsigned assumedImplicitBreaks() const { return m_assumedImplicitBreaks;
} |
| 136 void assumeAnotherImplicitBreak() { m_assumedImplicitBreaks++; } | 136 void assumeAnotherImplicitBreak() { m_assumedImplicitBreaks++; } |
| 137 LayoutUnit breakOffset() const { return m_breakOffset; } | 137 LayoutUnit breakOffset() const { return m_breakOffset; } |
| 138 | 138 |
| 139 // Return the column height that this content run would require, conside
ring the implicit | 139 // Return the column height that this content run would require, conside
ring the implicit |
| 140 // breaks assumed so far. | 140 // breaks assumed so far. |
| 141 LayoutUnit columnLogicalHeight(LayoutUnit startOffset) const | 141 LayoutUnit columnLogicalHeight(LayoutUnit startOffset) const |
| 142 { | 142 { |
| 143 // TODO(leviw): This should probably be fromFloatCeil. | 143 return LayoutUnit::fromFloatCeil(float(m_breakOffset - startOffset)
/ float(m_assumedImplicitBreaks + 1)); |
| 144 return LayoutUnit(ceilf((m_breakOffset - startOffset) / float(m_assu
medImplicitBreaks + 1))); | |
| 145 } | 144 } |
| 146 | 145 |
| 147 private: | 146 private: |
| 148 LayoutUnit m_breakOffset; // Flow thread offset where this run ends. | 147 LayoutUnit m_breakOffset; // Flow thread offset where this run ends. |
| 149 unsigned m_assumedImplicitBreaks; // Number of implicit breaks in this r
un assumed so far. | 148 unsigned m_assumedImplicitBreaks; // Number of implicit breaks in this r
un assumed so far. |
| 150 }; | 149 }; |
| 151 Vector<ContentRun, 32> m_contentRuns; | 150 Vector<ContentRun, 32> m_contentRuns; |
| 152 | 151 |
| 153 // Shortest strut found at each column boundary (index 0 being the boundary
between the first | 152 // Shortest strut found at each column boundary (index 0 being the boundary
between the first |
| 154 // and the second column, index 1 being the one between the second and the t
hird boundary, and | 153 // and the second column, index 1 being the one between the second and the t
hird boundary, and |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 LayoutUnit m_minimumSpaceShortage; | 194 LayoutUnit m_minimumSpaceShortage; |
| 196 | 195 |
| 197 // Set when breaking before a block, and we're looking for the first unbreak
able descendant, in | 196 // Set when breaking before a block, and we're looking for the first unbreak
able descendant, in |
| 198 // order to report correct space shortage for that one. | 197 // order to report correct space shortage for that one. |
| 199 LayoutUnit m_pendingStrut; | 198 LayoutUnit m_pendingStrut; |
| 200 | 199 |
| 201 unsigned m_forcedBreaksCount; | 200 unsigned m_forcedBreaksCount; |
| 202 }; | 201 }; |
| 203 | 202 |
| 204 } // namespace blink | 203 } // namespace blink |
| OLD | NEW |