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/MultiColumnFragmentainerGroup.h" | 7 #include "core/layout/MultiColumnFragmentainerGroup.h" |
8 | 8 |
9 #include "core/layout/ColumnBalancer.h" | 9 #include "core/layout/ColumnBalancer.h" |
10 #include "core/layout/LayoutMultiColumnSet.h" | 10 #include "core/layout/LayoutMultiColumnSet.h" |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 // this MultiColumnFragmentainerGroup can hold, and when we need to
append a new one. | 51 // this MultiColumnFragmentainerGroup can hold, and when we need to
append a new one. |
52 m_columnHeight = m_maxColumnHeight; | 52 m_columnHeight = m_maxColumnHeight; |
53 } else { | 53 } else { |
54 m_columnHeight = LayoutUnit(); | 54 m_columnHeight = LayoutUnit(); |
55 } | 55 } |
56 } else { | 56 } else { |
57 setAndConstrainColumnHeight(heightAdjustedForRowOffset(flowThread->colum
nHeightAvailable())); | 57 setAndConstrainColumnHeight(heightAdjustedForRowOffset(flowThread->colum
nHeightAvailable())); |
58 } | 58 } |
59 } | 59 } |
60 | 60 |
61 bool MultiColumnFragmentainerGroup::recalculateColumnHeight(BalancedColumnHeight
Calculation calculationMode) | 61 bool MultiColumnFragmentainerGroup::recalculateColumnHeight() |
62 { | 62 { |
63 LayoutUnit oldColumnHeight = m_columnHeight; | 63 LayoutUnit oldColumnHeight = m_columnHeight; |
64 | 64 |
65 m_maxColumnHeight = calculateMaxColumnHeight(); | 65 m_maxColumnHeight = calculateMaxColumnHeight(); |
66 | 66 |
67 // Only the last row may have auto height, and thus be balanced. There are n
o good reasons to | 67 // Only the last row may have auto height, and thus be balanced. There are n
o good reasons to |
68 // balance the preceding rows, and that could potentially lead to an insane
number of layout | 68 // balance the preceding rows, and that could potentially lead to an insane
number of layout |
69 // passes as well. | 69 // passes as well. |
70 if (isLastGroup() && m_columnSet.heightIsAuto()) { | 70 if (isLastGroup() && m_columnSet.heightIsAuto()) { |
71 LayoutUnit newColumnHeight; | 71 LayoutUnit newColumnHeight; |
72 if (calculationMode == GuessFromFlowThreadPortion) { | 72 if (!m_columnSet.isInitialHeightCalculated()) { |
73 // Initial balancing: Start with the lowest imaginable column height
. Also calculate the | 73 // Initial balancing: Start with the lowest imaginable column height
. Also calculate the |
74 // height of the tallest piece of unbreakable content. Columns shoul
d never get any | 74 // height of the tallest piece of unbreakable content. Columns shoul
d never get any |
75 // shorter than that (unless constrained by max-height). Propagate t
his to our | 75 // shorter than that (unless constrained by max-height). Propagate t
his to our |
76 // containing column set, in case there is an outer multicol contain
er that also needs | 76 // containing column set, in case there is an outer multicol contain
er that also needs |
77 // to balance. After having calculated the initial column height, th
e multicol container | 77 // to balance. After having calculated the initial column height, th
e multicol container |
78 // needs another layout pass with the column height that we just cal
culated. | 78 // needs another layout pass with the column height that we just cal
culated. |
79 InitialColumnHeightFinder initialHeightFinder(*this); | 79 InitialColumnHeightFinder initialHeightFinder(*this); |
80 LayoutUnit tallestUnbreakableLogicalHeight = initialHeightFinder.tal
lestUnbreakableLogicalHeight(); | 80 LayoutUnit tallestUnbreakableLogicalHeight = initialHeightFinder.tal
lestUnbreakableLogicalHeight(); |
81 m_columnSet.propagateTallestUnbreakableLogicalHeight(tallestUnbreaka
bleLogicalHeight); | 81 m_columnSet.propagateTallestUnbreakableLogicalHeight(tallestUnbreaka
bleLogicalHeight); |
82 newColumnHeight = std::max(initialHeightFinder.initialMinimalBalance
dHeight(), tallestUnbreakableLogicalHeight); | 82 newColumnHeight = std::max(initialHeightFinder.initialMinimalBalance
dHeight(), tallestUnbreakableLogicalHeight); |
(...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
553 append(MultiColumnFragmentainerGroup(m_columnSet)); | 553 append(MultiColumnFragmentainerGroup(m_columnSet)); |
554 return last(); | 554 return last(); |
555 } | 555 } |
556 | 556 |
557 void MultiColumnFragmentainerGroupList::deleteExtraGroups() | 557 void MultiColumnFragmentainerGroupList::deleteExtraGroups() |
558 { | 558 { |
559 shrink(1); | 559 shrink(1); |
560 } | 560 } |
561 | 561 |
562 } // namespace blink | 562 } // namespace blink |
OLD | NEW |