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 "config.h" | 5 #include "config.h" |
6 | 6 |
7 #include "core/layout/ColumnBalancer.h" | 7 #include "core/layout/ColumnBalancer.h" |
8 | 8 |
9 #include "core/layout/LayoutMultiColumnFlowThread.h" | 9 #include "core/layout/LayoutMultiColumnFlowThread.h" |
10 #include "core/layout/LayoutMultiColumnSet.h" | 10 #include "core/layout/LayoutMultiColumnSet.h" |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 } | 107 } |
108 | 108 |
109 if (box.hasForcedBreakAfter()) | 109 if (box.hasForcedBreakAfter()) |
110 addContentRun(flowThreadOffset() + box.logicalHeight()); | 110 addContentRun(flowThreadOffset() + box.logicalHeight()); |
111 | 111 |
112 if (box.paginationBreakability() != LayoutBox::AllowAnyBreaks) { | 112 if (box.paginationBreakability() != LayoutBox::AllowAnyBreaks) { |
113 LayoutUnit unsplittableLogicalHeight = box.logicalHeight(); | 113 LayoutUnit unsplittableLogicalHeight = box.logicalHeight(); |
114 if (box.isFloating()) | 114 if (box.isFloating()) |
115 unsplittableLogicalHeight += box.marginBefore() + box.marginAfter(); | 115 unsplittableLogicalHeight += box.marginBefore() + box.marginAfter(); |
116 m_tallestUnbreakableLogicalHeight = std::max(m_tallestUnbreakableLogical
Height, unsplittableLogicalHeight); | 116 m_tallestUnbreakableLogicalHeight = std::max(m_tallestUnbreakableLogical
Height, unsplittableLogicalHeight); |
117 } else if (box.isLayoutBlockFlow()) { | 117 return; |
118 if (LayoutMultiColumnFlowThread* innerFlowThread = toLayoutBlockFlow(box
).multiColumnFlowThread()) { | |
119 LayoutUnit offsetInInnerFlowThread = flowThreadOffset() - innerFlowT
hread->blockOffsetInEnclosingFragmentationContext(); | |
120 LayoutUnit innerUnbreakableHeight = innerFlowThread->tallestUnbreaka
bleLogicalHeight(offsetInInnerFlowThread); | |
121 m_tallestUnbreakableLogicalHeight = std::max(m_tallestUnbreakableLog
icalHeight, innerUnbreakableHeight); | |
122 } | |
123 } | 118 } |
| 119 // Need to examine inner multicol containers to find their tallest unbreakab
le piece of content. |
| 120 if (!box.isLayoutBlockFlow()) |
| 121 return; |
| 122 LayoutMultiColumnFlowThread* innerFlowThread = toLayoutBlockFlow(box).multiC
olumnFlowThread(); |
| 123 if (!innerFlowThread || innerFlowThread->isLayoutPagedFlowThread()) |
| 124 return; |
| 125 LayoutUnit offsetInInnerFlowThread = flowThreadOffset() - innerFlowThread->b
lockOffsetInEnclosingFragmentationContext(); |
| 126 LayoutUnit innerUnbreakableHeight = innerFlowThread->tallestUnbreakableLogic
alHeight(offsetInInnerFlowThread); |
| 127 m_tallestUnbreakableLogicalHeight = std::max(m_tallestUnbreakableLogicalHeig
ht, innerUnbreakableHeight); |
124 } | 128 } |
125 | 129 |
126 void InitialColumnHeightFinder::examineBoxBeforeLeaving(const LayoutBox& box) | 130 void InitialColumnHeightFinder::examineBoxBeforeLeaving(const LayoutBox& box) |
127 { | 131 { |
128 } | 132 } |
129 | 133 |
130 static inline LayoutUnit columnLogicalHeightRequirementForLine(const ComputedSty
le& style, const RootInlineBox& lastLine) | 134 static inline LayoutUnit columnLogicalHeightRequirementForLine(const ComputedSty
le& style, const RootInlineBox& lastLine) |
131 { | 135 { |
132 // We may require a certain minimum number of lines per page in order to sat
isfy | 136 // We may require a certain minimum number of lines per page in order to sat
isfy |
133 // orphans and widows, and that may affect the minimum page height. | 137 // orphans and widows, and that may affect the minimum page height. |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 // last column boundary, in case it crosses more than one. | 274 // last column boundary, in case it crosses more than one. |
271 LayoutUnit spaceUsedInLastColumn = bottomInFlowThread - group().colu
mnLogicalTopForOffset(bottomInFlowThread); | 275 LayoutUnit spaceUsedInLastColumn = bottomInFlowThread - group().colu
mnLogicalTopForOffset(bottomInFlowThread); |
272 recordSpaceShortage(spaceUsedInLastColumn); | 276 recordSpaceShortage(spaceUsedInLastColumn); |
273 } | 277 } |
274 } | 278 } |
275 | 279 |
276 // If this is an inner multicol container, look for space shortage inside it
. | 280 // If this is an inner multicol container, look for space shortage inside it
. |
277 if (!box.isLayoutBlockFlow()) | 281 if (!box.isLayoutBlockFlow()) |
278 return; | 282 return; |
279 LayoutMultiColumnFlowThread* flowThread = toLayoutBlockFlow(box).multiColumn
FlowThread(); | 283 LayoutMultiColumnFlowThread* flowThread = toLayoutBlockFlow(box).multiColumn
FlowThread(); |
280 if (!flowThread) | 284 if (!flowThread || flowThread->isLayoutPagedFlowThread()) |
281 return; | 285 return; |
282 for (const LayoutMultiColumnSet* columnSet = flowThread->firstMultiColumnSet
(); columnSet; columnSet = columnSet->nextSiblingMultiColumnSet()) { | 286 for (const LayoutMultiColumnSet* columnSet = flowThread->firstMultiColumnSet
(); columnSet; columnSet = columnSet->nextSiblingMultiColumnSet()) { |
283 for (const MultiColumnFragmentainerGroup& row : columnSet->fragmentainer
Groups()) { | 287 for (const MultiColumnFragmentainerGroup& row : columnSet->fragmentainer
Groups()) { |
284 MinimumSpaceShortageFinder innerFinder(row); | 288 MinimumSpaceShortageFinder innerFinder(row); |
285 recordSpaceShortage(innerFinder.minimumSpaceShortage()); | 289 recordSpaceShortage(innerFinder.minimumSpaceShortage()); |
286 } | 290 } |
287 } | 291 } |
288 } | 292 } |
289 | 293 |
290 void MinimumSpaceShortageFinder::examineBoxBeforeLeaving(const LayoutBox& box) | 294 void MinimumSpaceShortageFinder::examineBoxBeforeLeaving(const LayoutBox& box) |
(...skipping 22 matching lines...) Expand all Loading... |
313 recordSpaceShortage(logicalOffsetFromCurrentColumn + lineHeight - m_pend
ingStrut); | 317 recordSpaceShortage(logicalOffsetFromCurrentColumn + lineHeight - m_pend
ingStrut); |
314 m_pendingStrut = LayoutUnit::min(); | 318 m_pendingStrut = LayoutUnit::min(); |
315 return; | 319 return; |
316 } | 320 } |
317 ASSERT(isFirstAfterBreak(lineTopInFlowThread) || !line.paginationStrut()); | 321 ASSERT(isFirstAfterBreak(lineTopInFlowThread) || !line.paginationStrut()); |
318 if (isFirstAfterBreak(lineTopInFlowThread)) | 322 if (isFirstAfterBreak(lineTopInFlowThread)) |
319 recordSpaceShortage(lineHeight - line.paginationStrut()); | 323 recordSpaceShortage(lineHeight - line.paginationStrut()); |
320 } | 324 } |
321 | 325 |
322 } // namespace blink | 326 } // namespace blink |
OLD | NEW |