OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012 Apple Inc. All rights reserved. | 2 * Copyright (C) 2012 Apple Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 void populate(); | 115 void populate(); |
116 | 116 |
117 // Empty the flow thread by moving everything to the parent. Remove all mult
icol specific | 117 // Empty the flow thread by moving everything to the parent. Remove all mult
icol specific |
118 // renderers. Then destroy the flow thread. Called when a multicol container
becomes a regular | 118 // renderers. Then destroy the flow thread. Called when a multicol container
becomes a regular |
119 // block. | 119 // block. |
120 void evacuateAndDestroy(); | 120 void evacuateAndDestroy(); |
121 | 121 |
122 unsigned columnCount() const { return m_columnCount; } | 122 unsigned columnCount() const { return m_columnCount; } |
123 LayoutUnit columnHeightAvailable() const { return m_columnHeightAvailable; } | 123 LayoutUnit columnHeightAvailable() const { return m_columnHeightAvailable; } |
124 void setColumnHeightAvailable(LayoutUnit available) { m_columnHeightAvailabl
e = available; } | 124 void setColumnHeightAvailable(LayoutUnit available) { m_columnHeightAvailabl
e = available; } |
125 virtual bool heightIsAuto() const { return !columnHeightAvailable() || multi
ColumnBlockFlow()->style()->columnFill() == ColumnFillBalance; } | |
126 bool progressionIsInline() const { return m_progressionIsInline; } | 125 bool progressionIsInline() const { return m_progressionIsInline; } |
127 | 126 |
128 virtual LayoutSize columnOffset(const LayoutPoint&) const override final; | 127 virtual LayoutSize columnOffset(const LayoutPoint&) const override final; |
129 | 128 |
130 // Do we need to set a new width and lay out? | 129 // Do we need to set a new width and lay out? |
131 virtual bool needsNewWidth() const; | 130 virtual bool needsNewWidth() const; |
132 | 131 |
133 void layoutColumns(bool relayoutChildren, SubtreeLayoutScope&); | 132 void layoutColumns(bool relayoutChildren, SubtreeLayoutScope&); |
134 | 133 |
135 bool recalculateColumnHeights(); | 134 bool recalculateColumnHeights(); |
136 | 135 |
137 protected: | 136 protected: |
138 RenderMultiColumnFlowThread(); | 137 RenderMultiColumnFlowThread(); |
139 void setProgressionIsInline(bool isInline) { m_progressionIsInline = isInlin
e; } | 138 void setProgressionIsInline(bool isInline) { m_progressionIsInline = isInlin
e; } |
140 | 139 |
141 virtual void layout() override; | 140 virtual void layout() override; |
142 | 141 |
143 private: | 142 private: |
144 void calculateColumnCountAndWidth(LayoutUnit& width, unsigned& count) const; | 143 void calculateColumnCountAndWidth(LayoutUnit& width, unsigned& count) const; |
145 void createAndInsertMultiColumnSet(); | 144 void createAndInsertMultiColumnSet(); |
146 void createAndInsertSpannerSet(RenderBox* spanner); | 145 void createAndInsertSpannerSet(RenderBox* spanner); |
147 virtual bool descendantIsValidColumnSpanner(RenderObject* descendant) const; | 146 virtual bool descendantIsValidColumnSpanner(RenderObject* descendant) const; |
148 | 147 |
149 virtual const char* renderName() const override; | 148 virtual const char* renderName() const override; |
150 virtual void addRegionToThread(RenderMultiColumnSet*) override; | 149 virtual void addRegionToThread(RenderMultiColumnSet*) override; |
151 virtual void willBeRemovedFromTree() override; | 150 virtual void willBeRemovedFromTree() override; |
| 151 virtual bool isColumnSpanner(const RenderObject*) const override; |
| 152 virtual bool isInsideColumnSpanner(const RenderObject*) const override final
; |
| 153 virtual LayoutUnit enterColumnSpannerBeforeLayout(RenderBox*, LayoutUnit log
icalTop, SubtreeLayoutScope&) override; |
| 154 virtual void leaveColumnSpannerAfterLayout(RenderBox*, LayoutUnit logicalBot
tom) override; |
152 virtual void flowThreadDescendantWasInserted(RenderObject*) override; | 155 virtual void flowThreadDescendantWasInserted(RenderObject*) override; |
153 virtual void computeLogicalHeight(LayoutUnit logicalHeight, LayoutUnit logic
alTop, LogicalExtentComputedValues&) const override; | 156 virtual void computeLogicalHeight(LayoutUnit logicalHeight, LayoutUnit logic
alTop, LogicalExtentComputedValues&) const override; |
154 virtual void updateLogicalWidth() override; | 157 virtual void updateLogicalWidth() override; |
155 virtual void setPageBreak(LayoutUnit offset, LayoutUnit spaceShortage) overr
ide; | 158 virtual void setPageBreak(LayoutUnit offset, LayoutUnit spaceShortage) overr
ide; |
156 virtual void updateMinimumPageHeight(LayoutUnit offset, LayoutUnit minHeight
) override; | 159 virtual void updateMinimumPageHeight(LayoutUnit offset, LayoutUnit minHeight
) override; |
157 virtual RenderMultiColumnSet* columnSetAtBlockOffset(LayoutUnit) const overr
ide; | 160 virtual RenderMultiColumnSet* columnSetAtBlockOffset(LayoutUnit) const overr
ide; |
158 virtual bool addForcedRegionBreak(LayoutUnit, RenderObject* breakChild, bool
isBefore, LayoutUnit* offsetBreakAdjustment = 0) override; | 161 virtual bool addForcedRegionBreak(LayoutUnit, RenderObject* breakChild, bool
isBefore, LayoutUnit* offsetBreakAdjustment = 0) override; |
159 virtual bool isPageLogicalHeightKnown() const override; | 162 virtual bool isPageLogicalHeightKnown() const override; |
160 | 163 |
161 typedef HashMap<const RenderObject*, RenderMultiColumnSpannerSet*> SpannerMa
p; | 164 typedef HashMap<const RenderObject*, RenderMultiColumnSpannerSet*> SpannerMa
p; |
162 SpannerMap m_spannerMap; | 165 SpannerMap m_spannerMap; |
163 | 166 |
| 167 // The last set we worked on. It's not to be used as the "current set". The
concept of a |
| 168 // "current set" is difficult, since layout may jump back and forth in the t
ree, due to wrong |
| 169 // top location estimates (due to e.g. margin collapsing), and possibly for
other reasons. |
| 170 RenderMultiColumnSet* m_lastSetWorkedOn; |
| 171 |
164 unsigned m_columnCount; // The used value of column-count | 172 unsigned m_columnCount; // The used value of column-count |
165 LayoutUnit m_columnHeightAvailable; // Total height available to columns, or
0 if auto. | 173 LayoutUnit m_columnHeightAvailable; // Total height available to columns, or
0 if auto. |
166 bool m_inBalancingPass; // Set when relayouting for column balancing. | 174 bool m_inBalancingPass; // Set when relayouting for column balancing. |
167 bool m_needsColumnHeightsRecalculation; // Set when we need to recalculate t
he column set heights after layout. | 175 bool m_needsColumnHeightsRecalculation; // Set when we need to recalculate t
he column set heights after layout. |
168 bool m_progressionIsInline; // Always true for regular multicol. False for p
aged-y overflow. | 176 bool m_progressionIsInline; // Always true for regular multicol. False for p
aged-y overflow. |
169 }; | 177 }; |
170 | 178 |
171 } // namespace blink | 179 } // namespace blink |
172 | 180 |
173 #endif // RenderMultiColumnFlowThread_h | 181 #endif // RenderMultiColumnFlowThread_h |
174 | 182 |
OLD | NEW |