| 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/ColumnBalancer.h" | 5 #include "core/layout/ColumnBalancer.h" |
| 6 | 6 |
| 7 #include "core/layout/LayoutMultiColumnFlowThread.h" | 7 #include "core/layout/LayoutMultiColumnFlowThread.h" |
| 8 #include "core/layout/LayoutMultiColumnSet.h" | 8 #include "core/layout/LayoutMultiColumnSet.h" |
| 9 #include "core/layout/api/LineLayoutBlockFlow.h" | 9 #include "core/layout/api/LineLayoutBlockFlow.h" |
| 10 | 10 |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 ASSERT(isFirstAfterBreak(lineTopInFlowThread) || !line.paginationStrut() ||
!isLogicalTopWithinBounds(lineTopInFlowThread - line.paginationStrut())); | 158 ASSERT(isFirstAfterBreak(lineTopInFlowThread) || !line.paginationStrut() ||
!isLogicalTopWithinBounds(lineTopInFlowThread - line.paginationStrut())); |
| 159 if (isFirstAfterBreak(lineTopInFlowThread)) | 159 if (isFirstAfterBreak(lineTopInFlowThread)) |
| 160 recordStrutBeforeOffset(lineTopInFlowThread, line.paginationStrut()); | 160 recordStrutBeforeOffset(lineTopInFlowThread, line.paginationStrut()); |
| 161 } | 161 } |
| 162 | 162 |
| 163 void InitialColumnHeightFinder::recordStrutBeforeOffset(LayoutUnit offsetInFlowT
hread, LayoutUnit strut) | 163 void InitialColumnHeightFinder::recordStrutBeforeOffset(LayoutUnit offsetInFlowT
hread, LayoutUnit strut) |
| 164 { | 164 { |
| 165 ASSERT(columnSet().usedColumnCount() >= 1); | 165 ASSERT(columnSet().usedColumnCount() >= 1); |
| 166 unsigned columnCount = columnSet().usedColumnCount(); | 166 unsigned columnCount = columnSet().usedColumnCount(); |
| 167 ASSERT(m_shortestStruts.size() == columnCount); | 167 ASSERT(m_shortestStruts.size() == columnCount); |
| 168 unsigned index = groupAtOffset(offsetInFlowThread).columnIndexAtOffset(offse
tInFlowThread - strut, MultiColumnFragmentainerGroup::AssumeNewColumns); | 168 unsigned index = groupAtOffset(offsetInFlowThread).columnIndexAtOffset(offse
tInFlowThread - strut, LayoutBox::AssociateWithLatterPage); |
| 169 if (index >= columnCount) | 169 if (index >= columnCount) |
| 170 return; | 170 return; |
| 171 m_shortestStruts[index] = std::min(m_shortestStruts[index], strut); | 171 m_shortestStruts[index] = std::min(m_shortestStruts[index], strut); |
| 172 } | 172 } |
| 173 | 173 |
| 174 LayoutUnit InitialColumnHeightFinder::spaceUsedByStrutsAt(LayoutUnit offsetInFlo
wThread) const | 174 LayoutUnit InitialColumnHeightFinder::spaceUsedByStrutsAt(LayoutUnit offsetInFlo
wThread) const |
| 175 { | 175 { |
| 176 unsigned stopBeforeColumn = groupAtOffset(offsetInFlowThread).columnIndexAtO
ffset(offsetInFlowThread, MultiColumnFragmentainerGroup::AssumeNewColumns) + 1; | 176 unsigned stopBeforeColumn = groupAtOffset(offsetInFlowThread).columnIndexAtO
ffset(offsetInFlowThread, LayoutBox::AssociateWithLatterPage) + 1; |
| 177 stopBeforeColumn = std::min(stopBeforeColumn, columnSet().usedColumnCount())
; | 177 stopBeforeColumn = std::min(stopBeforeColumn, columnSet().usedColumnCount())
; |
| 178 ASSERT(stopBeforeColumn <= m_shortestStruts.size()); | 178 ASSERT(stopBeforeColumn <= m_shortestStruts.size()); |
| 179 LayoutUnit totalStrutSpace; | 179 LayoutUnit totalStrutSpace; |
| 180 for (unsigned i = 0; i < stopBeforeColumn; i++) { | 180 for (unsigned i = 0; i < stopBeforeColumn; i++) { |
| 181 if (m_shortestStruts[i] != LayoutUnit::max()) | 181 if (m_shortestStruts[i] != LayoutUnit::max()) |
| 182 totalStrutSpace += m_shortestStruts[i]; | 182 totalStrutSpace += m_shortestStruts[i]; |
| 183 } | 183 } |
| 184 return totalStrutSpace; | 184 return totalStrutSpace; |
| 185 } | 185 } |
| 186 | 186 |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 338 // of said overflow ends up in the next column. That counts as space shortag
e. | 338 // of said overflow ends up in the next column. That counts as space shortag
e. |
| 339 const MultiColumnFragmentainerGroup& group = groupAtOffset(lineTopInFlowThre
ad); | 339 const MultiColumnFragmentainerGroup& group = groupAtOffset(lineTopInFlowThre
ad); |
| 340 LayoutUnit lineBottomWithOverflow = lineTopInFlowThread + line.lineBottom()
- lineTop; | 340 LayoutUnit lineBottomWithOverflow = lineTopInFlowThread + line.lineBottom()
- lineTop; |
| 341 if (group.columnLogicalTopForOffset(lineTopInFlowThread) != group.columnLogi
calTopForOffset(lineBottomWithOverflow)) { | 341 if (group.columnLogicalTopForOffset(lineTopInFlowThread) != group.columnLogi
calTopForOffset(lineBottomWithOverflow)) { |
| 342 LayoutUnit shortage = lineBottomWithOverflow - group.columnLogicalTopFor
Offset(lineBottomWithOverflow); | 342 LayoutUnit shortage = lineBottomWithOverflow - group.columnLogicalTopFor
Offset(lineBottomWithOverflow); |
| 343 recordSpaceShortage(shortage); | 343 recordSpaceShortage(shortage); |
| 344 } | 344 } |
| 345 } | 345 } |
| 346 | 346 |
| 347 } // namespace blink | 347 } // namespace blink |
| OLD | NEW |