Chromium Code Reviews| 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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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 return LayoutUnit(ceilf((m_breakOffset - startOffset).toFloat() / fl oat(m_assumedImplicitBreaks + 1))); | |
|
eae
2016/01/29 23:57:42
return LayoutUnit::fromFloatCeil((m_breakOffset -
| |
| 138 } | |
| 136 | 139 |
| 137 private: | 140 private: |
| 138 LayoutUnit m_breakOffset; // Flow thread offset where this run ends. | 141 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. | 142 unsigned m_assumedImplicitBreaks; // Number of implicit breaks in this r un assumed so far. |
| 140 }; | 143 }; |
| 141 Vector<ContentRun, 32> m_contentRuns; | 144 Vector<ContentRun, 32> m_contentRuns; |
| 142 | 145 |
| 143 // Shortest strut found at each column boundary (index 0 being the boundary between the first | 146 // 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 | 147 // 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 | 148 // 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 Loading... | |
| 185 LayoutUnit m_minimumSpaceShortage; | 188 LayoutUnit m_minimumSpaceShortage; |
| 186 | 189 |
| 187 // Set when breaking before a block, and we're looking for the first unbreak able descendant, in | 190 // 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. | 191 // order to report correct space shortage for that one. |
| 189 LayoutUnit m_pendingStrut; | 192 LayoutUnit m_pendingStrut; |
| 190 | 193 |
| 191 unsigned m_forcedBreaksCount; | 194 unsigned m_forcedBreaksCount; |
| 192 }; | 195 }; |
| 193 | 196 |
| 194 } // namespace blink | 197 } // namespace blink |
| OLD | NEW |