| 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 continue; | 45 continue; |
| 46 if (lineTopInFlowThread >= logicalBottomInFlowThread()) | 46 if (lineTopInFlowThread >= logicalBottomInFlowThread()) |
| 47 break; | 47 break; |
| 48 examineLine(*line); | 48 examineLine(*line); |
| 49 } | 49 } |
| 50 } | 50 } |
| 51 | 51 |
| 52 void ColumnBalancer::traverseChildren(const LayoutObject& object) { | 52 void ColumnBalancer::traverseChildren(const LayoutObject& object) { |
| 53 // The break-after value from the previous in-flow block-level object to be | 53 // The break-after value from the previous in-flow block-level object to be |
| 54 // joined with the break-before value of the next in-flow block-level sibling. | 54 // joined with the break-before value of the next in-flow block-level sibling. |
| 55 EBreak previousBreakAfterValue = BreakAuto; | 55 EBreakBetween previousBreakAfterValue = EBreakBetween::kAuto; |
| 56 | 56 |
| 57 for (const LayoutObject* child = object.slowFirstChild(); child; | 57 for (const LayoutObject* child = object.slowFirstChild(); child; |
| 58 child = child->nextSibling()) { | 58 child = child->nextSibling()) { |
| 59 if (!child->isBox()) { | 59 if (!child->isBox()) { |
| 60 // Keep traversing inside inlines. There may be floats there. | 60 // Keep traversing inside inlines. There may be floats there. |
| 61 if (child->isLayoutInline()) | 61 if (child->isLayoutInline()) |
| 62 traverseChildren(*child); | 62 traverseChildren(*child); |
| 63 continue; | 63 continue; |
| 64 } | 64 } |
| 65 | 65 |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 unsigned index = contentRunIndexWithTallestColumns(); | 165 unsigned index = contentRunIndexWithTallestColumns(); |
| 166 LayoutUnit startOffset = index > 0 ? m_contentRuns[index - 1].breakOffset() | 166 LayoutUnit startOffset = index > 0 ? m_contentRuns[index - 1].breakOffset() |
| 167 : logicalTopInFlowThread(); | 167 : logicalTopInFlowThread(); |
| 168 LayoutUnit height = m_contentRuns[index].columnLogicalHeight(startOffset); | 168 LayoutUnit height = m_contentRuns[index].columnLogicalHeight(startOffset); |
| 169 return rowLogicalTop + std::max(height, m_tallestUnbreakableLogicalHeight); | 169 return rowLogicalTop + std::max(height, m_tallestUnbreakableLogicalHeight); |
| 170 } | 170 } |
| 171 | 171 |
| 172 void InitialColumnHeightFinder::examineBoxAfterEntering( | 172 void InitialColumnHeightFinder::examineBoxAfterEntering( |
| 173 const LayoutBox& box, | 173 const LayoutBox& box, |
| 174 LayoutUnit childLogicalHeight, | 174 LayoutUnit childLogicalHeight, |
| 175 EBreak previousBreakAfterValue) { | 175 EBreakBetween previousBreakAfterValue) { |
| 176 if (m_lastBreakSeen > flowThreadOffset()) { | 176 if (m_lastBreakSeen > flowThreadOffset()) { |
| 177 // We have moved backwards. We're probably in a parallel flow, caused by | 177 // We have moved backwards. We're probably in a parallel flow, caused by |
| 178 // floats, sibling table cells, etc. | 178 // floats, sibling table cells, etc. |
| 179 m_lastBreakSeen = LayoutUnit(); | 179 m_lastBreakSeen = LayoutUnit(); |
| 180 } | 180 } |
| 181 if (isLogicalTopWithinBounds(flowThreadOffset() - box.paginationStrut())) { | 181 if (isLogicalTopWithinBounds(flowThreadOffset() - box.paginationStrut())) { |
| 182 if (box.needsForcedBreakBefore(previousBreakAfterValue)) { | 182 if (box.needsForcedBreakBefore(previousBreakAfterValue)) { |
| 183 addContentRun(flowThreadOffset()); | 183 addContentRun(flowThreadOffset()); |
| 184 } else if (isFirstAfterBreak(flowThreadOffset()) && | 184 } else if (isFirstAfterBreak(flowThreadOffset()) && |
| 185 m_lastBreakSeen != flowThreadOffset()) { | 185 m_lastBreakSeen != flowThreadOffset()) { |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 354 logicalBottomInFlowThread), | 354 logicalBottomInFlowThread), |
| 355 m_minimumSpaceShortage(LayoutUnit::max()), | 355 m_minimumSpaceShortage(LayoutUnit::max()), |
| 356 m_pendingStrut(LayoutUnit::min()), | 356 m_pendingStrut(LayoutUnit::min()), |
| 357 m_forcedBreaksCount(0) { | 357 m_forcedBreaksCount(0) { |
| 358 traverse(); | 358 traverse(); |
| 359 } | 359 } |
| 360 | 360 |
| 361 void MinimumSpaceShortageFinder::examineBoxAfterEntering( | 361 void MinimumSpaceShortageFinder::examineBoxAfterEntering( |
| 362 const LayoutBox& box, | 362 const LayoutBox& box, |
| 363 LayoutUnit childLogicalHeight, | 363 LayoutUnit childLogicalHeight, |
| 364 EBreak previousBreakAfterValue) { | 364 EBreakBetween previousBreakAfterValue) { |
| 365 LayoutBox::PaginationBreakability breakability = | 365 LayoutBox::PaginationBreakability breakability = |
| 366 box.getPaginationBreakability(); | 366 box.getPaginationBreakability(); |
| 367 | 367 |
| 368 // Look for breaks before the child box. | 368 // Look for breaks before the child box. |
| 369 if (isLogicalTopWithinBounds(flowThreadOffset() - box.paginationStrut())) { | 369 if (isLogicalTopWithinBounds(flowThreadOffset() - box.paginationStrut())) { |
| 370 if (box.needsForcedBreakBefore(previousBreakAfterValue)) { | 370 if (box.needsForcedBreakBefore(previousBreakAfterValue)) { |
| 371 m_forcedBreaksCount++; | 371 m_forcedBreaksCount++; |
| 372 } else { | 372 } else { |
| 373 if (isFirstAfterBreak(flowThreadOffset())) { | 373 if (isFirstAfterBreak(flowThreadOffset())) { |
| 374 // This box is first after a soft break. | 374 // This box is first after a soft break. |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 482 if (group.columnLogicalTopForOffset(lineTopInFlowThread) != | 482 if (group.columnLogicalTopForOffset(lineTopInFlowThread) != |
| 483 group.columnLogicalTopForOffset(lineBottomWithOverflow)) { | 483 group.columnLogicalTopForOffset(lineBottomWithOverflow)) { |
| 484 LayoutUnit shortage = | 484 LayoutUnit shortage = |
| 485 lineBottomWithOverflow - | 485 lineBottomWithOverflow - |
| 486 group.columnLogicalTopForOffset(lineBottomWithOverflow); | 486 group.columnLogicalTopForOffset(lineBottomWithOverflow); |
| 487 recordSpaceShortage(shortage); | 487 recordSpaceShortage(shortage); |
| 488 } | 488 } |
| 489 } | 489 } |
| 490 | 490 |
| 491 } // namespace blink | 491 } // namespace blink |
| OLD | NEW |