| 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 #ifndef MultiColumnFragmentainerGroup_h | 5 #ifndef MultiColumnFragmentainerGroup_h |
| 6 #define MultiColumnFragmentainerGroup_h | 6 #define MultiColumnFragmentainerGroup_h |
| 7 | 7 |
| 8 #include "core/layout/LayoutMultiColumnFlowThread.h" | 8 #include "core/layout/LayoutMultiColumnFlowThread.h" |
| 9 | 9 |
| 10 namespace blink { | 10 namespace blink { |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 void resetColumnHeight(); | 53 void resetColumnHeight(); |
| 54 void addContentRun(LayoutUnit endOffsetInFlowThread); | 54 void addContentRun(LayoutUnit endOffsetInFlowThread); |
| 55 void updateMinimumColumnHeight(LayoutUnit height) { m_minimumColumnHeight =
std::max(height, m_minimumColumnHeight); } | 55 void updateMinimumColumnHeight(LayoutUnit height) { m_minimumColumnHeight =
std::max(height, m_minimumColumnHeight); } |
| 56 void recordSpaceShortage(LayoutUnit); | 56 void recordSpaceShortage(LayoutUnit); |
| 57 bool recalculateColumnHeight(BalancedColumnHeightCalculation calculationMode
); | 57 bool recalculateColumnHeight(BalancedColumnHeightCalculation calculationMode
); |
| 58 | 58 |
| 59 void expandToEncompassFlowThreadOverflow(); | 59 void expandToEncompassFlowThreadOverflow(); |
| 60 | 60 |
| 61 LayoutSize flowThreadTranslationAtOffset(LayoutUnit offsetInFlowThread) cons
t; | 61 LayoutSize flowThreadTranslationAtOffset(LayoutUnit offsetInFlowThread) cons
t; |
| 62 LayoutUnit columnLogicalTopForOffset(LayoutUnit offsetInFlowThread) const; | 62 LayoutUnit columnLogicalTopForOffset(LayoutUnit offsetInFlowThread) const; |
| 63 LayoutPoint visualPointToFlowThreadPoint(const LayoutPoint& visualPoint) con
st; |
| 63 void collectLayerFragments(LayerFragments&, const LayoutRect& layerBoundingB
ox, const LayoutRect& dirtyRect) const; | 64 void collectLayerFragments(LayerFragments&, const LayoutRect& layerBoundingB
ox, const LayoutRect& dirtyRect) const; |
| 64 LayoutRect calculateOverflow() const; | 65 LayoutRect calculateOverflow() const; |
| 65 | 66 |
| 66 // The "CSS actual" value of column-count. This includes overflowing columns
, if any. | 67 // The "CSS actual" value of column-count. This includes overflowing columns
, if any. |
| 67 unsigned actualColumnCount() const; | 68 unsigned actualColumnCount() const; |
| 68 | 69 |
| 69 private: | 70 private: |
| 70 LayoutUnit heightAdjustedForRowOffset(LayoutUnit height) const; | 71 LayoutUnit heightAdjustedForRowOffset(LayoutUnit height) const; |
| 71 LayoutUnit calculateMaxColumnHeight() const; | 72 LayoutUnit calculateMaxColumnHeight() const; |
| 72 void setAndConstrainColumnHeight(LayoutUnit); | 73 void setAndConstrainColumnHeight(LayoutUnit); |
| 73 | 74 |
| 74 // Return the index of the content run with the currently tallest columns, t
aking all implicit | 75 // Return the index of the content run with the currently tallest columns, t
aking all implicit |
| 75 // breaks assumed so far into account. | 76 // breaks assumed so far into account. |
| 76 unsigned findRunWithTallestColumns() const; | 77 unsigned findRunWithTallestColumns() const; |
| 77 | 78 |
| 78 // Given the current list of content runs, make assumptions about where we n
eed to insert | 79 // Given the current list of content runs, make assumptions about where we n
eed to insert |
| 79 // implicit breaks (if there's room for any at all; depending on the number
of explicit breaks), | 80 // implicit breaks (if there's room for any at all; depending on the number
of explicit breaks), |
| 80 // and store the results. This is needed in order to balance the columns. | 81 // and store the results. This is needed in order to balance the columns. |
| 81 void distributeImplicitBreaks(); | 82 void distributeImplicitBreaks(); |
| 82 | 83 |
| 83 LayoutUnit calculateColumnHeight(BalancedColumnHeightCalculation) const; | 84 LayoutUnit calculateColumnHeight(BalancedColumnHeightCalculation) const; |
| 84 | 85 |
| 85 LayoutRect columnRectAt(unsigned columnIndex) const; | 86 LayoutRect columnRectAt(unsigned columnIndex) const; |
| 87 LayoutUnit logicalTopInFlowThreadAt(unsigned columnIndex) const { return m_l
ogicalTopInFlowThread + columnIndex * m_columnHeight; } |
| 86 LayoutRect flowThreadPortionRectAt(unsigned columnIndex) const; | 88 LayoutRect flowThreadPortionRectAt(unsigned columnIndex) const; |
| 87 LayoutRect flowThreadPortionOverflowRect(const LayoutRect& flowThreadPortion
, unsigned columnIndex, unsigned columnCount, LayoutUnit columnGap) const; | 89 LayoutRect flowThreadPortionOverflowRect(const LayoutRect& flowThreadPortion
, unsigned columnIndex, unsigned columnCount, LayoutUnit columnGap) const; |
| 88 | 90 |
| 89 enum ColumnIndexCalculationMode { | 91 enum ColumnIndexCalculationMode { |
| 90 ClampToExistingColumns, // Stay within the range of already existing col
umns. | 92 ClampToExistingColumns, // Stay within the range of already existing col
umns. |
| 91 AssumeNewColumns // Allow column indices outside the range of already ex
isting columns. | 93 AssumeNewColumns // Allow column indices outside the range of already ex
isting columns. |
| 92 }; | 94 }; |
| 93 unsigned columnIndexAtOffset(LayoutUnit offsetInFlowThread, ColumnIndexCalcu
lationMode = ClampToExistingColumns) const; | 95 unsigned columnIndexAtOffset(LayoutUnit offsetInFlowThread, ColumnIndexCalcu
lationMode = ClampToExistingColumns) const; |
| 94 | 96 |
| 97 // Return the column that the specified visual point belongs to. Only the co
ordinate on the |
| 98 // column progression axis is relevant. Every point belongs to a column, eve
n if said point is |
| 99 // not inside any of the columns. |
| 100 unsigned columnIndexAtVisualPoint(const LayoutPoint& visualPoint) const; |
| 101 |
| 95 LayoutMultiColumnSet& m_columnSet; | 102 LayoutMultiColumnSet& m_columnSet; |
| 96 | 103 |
| 97 LayoutUnit m_logicalTop; | 104 LayoutUnit m_logicalTop; |
| 98 LayoutUnit m_logicalTopInFlowThread; | 105 LayoutUnit m_logicalTopInFlowThread; |
| 99 LayoutUnit m_logicalBottomInFlowThread; | 106 LayoutUnit m_logicalBottomInFlowThread; |
| 100 | 107 |
| 101 LayoutUnit m_columnHeight; | 108 LayoutUnit m_columnHeight; |
| 102 | 109 |
| 103 // The following variables are used when balancing the column set. | 110 // The following variables are used when balancing the column set. |
| 104 LayoutUnit m_maxColumnHeight; // Maximum column height allowed. | 111 LayoutUnit m_maxColumnHeight; // Maximum column height allowed. |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 // Remove all fragmentainer groups but the first one. | 153 // Remove all fragmentainer groups but the first one. |
| 147 void deleteExtraGroups(); | 154 void deleteExtraGroups(); |
| 148 | 155 |
| 149 private: | 156 private: |
| 150 LayoutMultiColumnSet& m_columnSet; | 157 LayoutMultiColumnSet& m_columnSet; |
| 151 }; | 158 }; |
| 152 | 159 |
| 153 } // namespace blink | 160 } // namespace blink |
| 154 | 161 |
| 155 #endif // MultiColumnFragmentainerGroup_h | 162 #endif // MultiColumnFragmentainerGroup_h |
| OLD | NEW |