| 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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 return m_contentRuns[index].columnLogicalHeight(startOffset); | 119 return m_contentRuns[index].columnLogicalHeight(startOffset); |
| 120 } | 120 } |
| 121 | 121 |
| 122 void InitialColumnHeightFinder::examineBoxAfterEntering( | 122 void InitialColumnHeightFinder::examineBoxAfterEntering( |
| 123 const LayoutBox& box, | 123 const LayoutBox& box, |
| 124 EBreak previousBreakAfterValue) { | 124 EBreak previousBreakAfterValue) { |
| 125 if (isLogicalTopWithinBounds(flowThreadOffset() - box.paginationStrut())) { | 125 if (isLogicalTopWithinBounds(flowThreadOffset() - box.paginationStrut())) { |
| 126 if (box.needsForcedBreakBefore(previousBreakAfterValue)) { | 126 if (box.needsForcedBreakBefore(previousBreakAfterValue)) { |
| 127 addContentRun(flowThreadOffset()); | 127 addContentRun(flowThreadOffset()); |
| 128 } else { | 128 } else { |
| 129 ASSERT(isFirstAfterBreak(flowThreadOffset()) || !box.paginationStrut()); | |
| 130 if (isFirstAfterBreak(flowThreadOffset())) { | 129 if (isFirstAfterBreak(flowThreadOffset())) { |
| 131 // This box is first after a soft break. | 130 // This box is first after a soft break. |
| 132 recordStrutBeforeOffset(flowThreadOffset(), box.paginationStrut()); | 131 recordStrutBeforeOffset(flowThreadOffset(), box.paginationStrut()); |
| 133 } | 132 } |
| 134 } | 133 } |
| 135 } | 134 } |
| 136 | 135 |
| 137 if (box.getPaginationBreakability() != LayoutBox::AllowAnyBreaks) { | 136 if (box.getPaginationBreakability() != LayoutBox::AllowAnyBreaks) { |
| 138 LayoutUnit unsplittableLogicalHeight = box.logicalHeight(); | 137 LayoutUnit unsplittableLogicalHeight = box.logicalHeight(); |
| 139 if (box.isFloating()) | 138 if (box.isFloating()) |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 286 const LayoutBox& box, | 285 const LayoutBox& box, |
| 287 EBreak previousBreakAfterValue) { | 286 EBreak previousBreakAfterValue) { |
| 288 LayoutBox::PaginationBreakability breakability = | 287 LayoutBox::PaginationBreakability breakability = |
| 289 box.getPaginationBreakability(); | 288 box.getPaginationBreakability(); |
| 290 | 289 |
| 291 // Look for breaks before the child box. | 290 // Look for breaks before the child box. |
| 292 if (isLogicalTopWithinBounds(flowThreadOffset() - box.paginationStrut())) { | 291 if (isLogicalTopWithinBounds(flowThreadOffset() - box.paginationStrut())) { |
| 293 if (box.needsForcedBreakBefore(previousBreakAfterValue)) { | 292 if (box.needsForcedBreakBefore(previousBreakAfterValue)) { |
| 294 m_forcedBreaksCount++; | 293 m_forcedBreaksCount++; |
| 295 } else { | 294 } else { |
| 296 ASSERT(isFirstAfterBreak(flowThreadOffset()) || !box.paginationStrut()); | |
| 297 if (isFirstAfterBreak(flowThreadOffset())) { | 295 if (isFirstAfterBreak(flowThreadOffset())) { |
| 298 // This box is first after a soft break. | 296 // This box is first after a soft break. |
| 299 LayoutUnit strut = box.paginationStrut(); | 297 LayoutUnit strut = box.paginationStrut(); |
| 300 // Figure out how much more space we would need to prevent it from being | 298 // Figure out how much more space we would need to prevent it from being |
| 301 // pushed to the next column. | 299 // pushed to the next column. |
| 302 recordSpaceShortage(box.logicalHeight() - strut); | 300 recordSpaceShortage(box.logicalHeight() - strut); |
| 303 if (breakability != LayoutBox::ForbidBreaks && | 301 if (breakability != LayoutBox::ForbidBreaks && |
| 304 m_pendingStrut == LayoutUnit::min()) { | 302 m_pendingStrut == LayoutUnit::min()) { |
| 305 // We now want to look for the first piece of unbreakable content | 303 // We now want to look for the first piece of unbreakable content |
| 306 // (e.g. a line or a block-displayed image) inside this block. That | 304 // (e.g. a line or a block-displayed image) inside this block. That |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 404 if (group.columnLogicalTopForOffset(lineTopInFlowThread) != | 402 if (group.columnLogicalTopForOffset(lineTopInFlowThread) != |
| 405 group.columnLogicalTopForOffset(lineBottomWithOverflow)) { | 403 group.columnLogicalTopForOffset(lineBottomWithOverflow)) { |
| 406 LayoutUnit shortage = | 404 LayoutUnit shortage = |
| 407 lineBottomWithOverflow - | 405 lineBottomWithOverflow - |
| 408 group.columnLogicalTopForOffset(lineBottomWithOverflow); | 406 group.columnLogicalTopForOffset(lineBottomWithOverflow); |
| 409 recordSpaceShortage(shortage); | 407 recordSpaceShortage(shortage); |
| 410 } | 408 } |
| 411 } | 409 } |
| 412 | 410 |
| 413 } // namespace blink | 411 } // namespace blink |
| OLD | NEW |