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/MultiColumnFragmentainerGroup.h" | 5 #include "core/layout/MultiColumnFragmentainerGroup.h" |
6 | 6 |
7 #include "core/layout/ColumnBalancer.h" | 7 #include "core/layout/ColumnBalancer.h" |
8 #include "core/layout/FragmentationContext.h" | 8 #include "core/layout/FragmentationContext.h" |
9 #include "core/layout/LayoutMultiColumnSet.h" | 9 #include "core/layout/LayoutMultiColumnSet.h" |
10 | 10 |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 if (!columnSet.isInitialHeightCalculated()) { | 73 if (!columnSet.isInitialHeightCalculated()) { |
74 // Initial balancing: Start with the lowest imaginable column height. Also | 74 // Initial balancing: Start with the lowest imaginable column height. Also |
75 // calculate the height of the tallest piece of unbreakable content. | 75 // calculate the height of the tallest piece of unbreakable content. |
76 // Columns should never get any shorter than that (unless constrained by | 76 // Columns should never get any shorter than that (unless constrained by |
77 // max-height). Propagate this to our containing column set, in case there | 77 // max-height). Propagate this to our containing column set, in case there |
78 // is an outer multicol container that also needs to balance. After having | 78 // is an outer multicol container that also needs to balance. After having |
79 // calculated the initial column height, the multicol container needs | 79 // calculated the initial column height, the multicol container needs |
80 // another layout pass with the column height that we just calculated. | 80 // another layout pass with the column height that we just calculated. |
81 InitialColumnHeightFinder initialHeightFinder( | 81 InitialColumnHeightFinder initialHeightFinder( |
82 columnSet, logicalTopInFlowThread(), logicalBottomInFlowThread()); | 82 columnSet, logicalTopInFlowThread(), logicalBottomInFlowThread()); |
83 LayoutUnit tallestUnbreakableLogicalHeight = | |
84 initialHeightFinder.tallestUnbreakableLogicalHeight(); | |
85 columnSet.propagateTallestUnbreakableLogicalHeight( | 83 columnSet.propagateTallestUnbreakableLogicalHeight( |
86 tallestUnbreakableLogicalHeight); | 84 initialHeightFinder.tallestUnbreakableLogicalHeight()); |
87 newColumnHeight = | 85 newColumnHeight = initialHeightFinder.initialMinimalBalancedHeight(); |
88 std::max(initialHeightFinder.initialMinimalBalancedHeight(), | |
89 tallestUnbreakableLogicalHeight); | |
90 } else { | 86 } else { |
91 // Rebalancing: After having laid out again, we'll need to rebalance if | 87 // Rebalancing: After having laid out again, we'll need to rebalance if |
92 // the height wasn't enough and we're allowed to stretch it, and then | 88 // the height wasn't enough and we're allowed to stretch it, and then |
93 // re-lay out. There are further details on the column balancing | 89 // re-lay out. There are further details on the column balancing |
94 // machinery in ColumnBalancer and its derivates. | 90 // machinery in ColumnBalancer and its derivates. |
95 newColumnHeight = rebalanceColumnHeightIfNeeded(); | 91 newColumnHeight = rebalanceColumnHeightIfNeeded(); |
96 } | 92 } |
97 setAndConstrainColumnHeight(newColumnHeight); | 93 setAndConstrainColumnHeight(newColumnHeight); |
98 } else { | 94 } else { |
99 // The position of the column set may have changed, in which case height | 95 // The position of the column set may have changed, in which case height |
(...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
590 MultiColumnFragmentainerGroupList::addExtraGroup() { | 586 MultiColumnFragmentainerGroupList::addExtraGroup() { |
591 append(MultiColumnFragmentainerGroup(m_columnSet)); | 587 append(MultiColumnFragmentainerGroup(m_columnSet)); |
592 return last(); | 588 return last(); |
593 } | 589 } |
594 | 590 |
595 void MultiColumnFragmentainerGroupList::deleteExtraGroups() { | 591 void MultiColumnFragmentainerGroupList::deleteExtraGroups() { |
596 shrink(1); | 592 shrink(1); |
597 } | 593 } |
598 | 594 |
599 } // namespace blink | 595 } // namespace blink |
OLD | NEW |