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 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 unsigned columnCount() const { return m_columnCount; } | 161 unsigned columnCount() const { return m_columnCount; } |
162 LayoutUnit columnHeightAvailable() const { return m_columnHeightAvailable; } | 162 LayoutUnit columnHeightAvailable() const { return m_columnHeightAvailable; } |
163 void setColumnHeightAvailable(LayoutUnit available) { m_columnHeightAvailabl
e = available; } | 163 void setColumnHeightAvailable(LayoutUnit available) { m_columnHeightAvailabl
e = available; } |
164 bool progressionIsInline() const { return m_progressionIsInline; } | 164 bool progressionIsInline() const { return m_progressionIsInline; } |
165 | 165 |
166 LayoutSize columnOffset(const LayoutPoint&) const final; | 166 LayoutSize columnOffset(const LayoutPoint&) const final; |
167 | 167 |
168 // Do we need to set a new width and lay out? | 168 // Do we need to set a new width and lay out? |
169 virtual bool needsNewWidth() const; | 169 virtual bool needsNewWidth() const; |
170 | 170 |
| 171 bool isPageLogicalHeightKnown() const final; |
| 172 |
| 173 LayoutSize flowThreadTranslationAtOffset(LayoutUnit) const; |
| 174 |
171 LayoutPoint visualPointToFlowThreadPoint(const LayoutPoint& visualPoint) con
st override; | 175 LayoutPoint visualPointToFlowThreadPoint(const LayoutPoint& visualPoint) con
st override; |
172 | 176 |
173 LayoutMultiColumnSet* columnSetAtBlockOffset(LayoutUnit) const final; | 177 LayoutMultiColumnSet* columnSetAtBlockOffset(LayoutUnit) const final; |
174 | 178 |
175 void layoutColumns(bool relayoutChildren, SubtreeLayoutScope&); | 179 void layoutColumns(bool relayoutChildren, SubtreeLayoutScope&); |
176 | 180 |
| 181 bool isInInitialLayoutPass() const { return !m_inBalancingPass; } |
| 182 |
177 bool recalculateColumnHeights(); | 183 bool recalculateColumnHeights(); |
178 | 184 |
179 void columnRuleStyleDidChange(); | 185 void columnRuleStyleDidChange(); |
180 | 186 |
181 // Remove the spanner placeholder and return true if the specified object is
no longer a valid spanner. | 187 // Remove the spanner placeholder and return true if the specified object is
no longer a valid spanner. |
182 bool removeSpannerPlaceholderIfNoLongerValid(LayoutBox* spannerObjectInFlowT
hread); | 188 bool removeSpannerPlaceholderIfNoLongerValid(LayoutBox* spannerObjectInFlowT
hread); |
183 | 189 |
| 190 LayoutMultiColumnFlowThread* enclosingFlowThread() const; |
| 191 LayoutUnit blockOffsetInEnclosingFlowThread() const { ASSERT(enclosingFlowTh
read()); return m_blockOffsetInEnclosingFlowThread; } |
| 192 |
| 193 // Return true if we have a fragmentainer group that can hold a column at th
e specified flow thread block offset. |
| 194 bool hasFragmentainerGroupForColumnAt(LayoutUnit offsetInFlowThread) const; |
| 195 |
| 196 // If we've run out of columns in the last fragmentainer group (column row),
we have to insert |
| 197 // another fragmentainer group in order to hold more columns. This means tha
t we're moving to |
| 198 // the next outer column (in the enclosing fragmentation context). |
| 199 void appendNewFragmentainerGroupIfNeeded(LayoutUnit offsetInFlowThread); |
| 200 |
184 const char* name() const override { return "LayoutMultiColumnFlowThread"; } | 201 const char* name() const override { return "LayoutMultiColumnFlowThread"; } |
185 | 202 |
186 protected: | 203 protected: |
187 LayoutMultiColumnFlowThread(); | 204 LayoutMultiColumnFlowThread(); |
188 void setProgressionIsInline(bool isInline) { m_progressionIsInline = isInlin
e; } | 205 void setProgressionIsInline(bool isInline) { m_progressionIsInline = isInlin
e; } |
189 | 206 |
190 void layout() override; | 207 void layout() override; |
191 | 208 |
192 private: | 209 private: |
193 void calculateColumnCountAndWidth(LayoutUnit& width, unsigned& count) const; | 210 void calculateColumnCountAndWidth(LayoutUnit& width, unsigned& count) const; |
194 void createAndInsertMultiColumnSet(LayoutBox* insertBefore = nullptr); | 211 void createAndInsertMultiColumnSet(LayoutBox* insertBefore = nullptr); |
195 void createAndInsertSpannerPlaceholder(LayoutBox* spannerObjectInFlowThread,
LayoutObject* insertedBeforeInFlowThread); | 212 void createAndInsertSpannerPlaceholder(LayoutBox* spannerObjectInFlowThread,
LayoutObject* insertedBeforeInFlowThread); |
196 void destroySpannerPlaceholder(LayoutMultiColumnSpannerPlaceholder*); | 213 void destroySpannerPlaceholder(LayoutMultiColumnSpannerPlaceholder*); |
197 virtual bool descendantIsValidColumnSpanner(LayoutObject* descendant) const; | 214 virtual bool descendantIsValidColumnSpanner(LayoutObject* descendant) const; |
198 | 215 |
199 void addColumnSetToThread(LayoutMultiColumnSet*) override; | 216 void addColumnSetToThread(LayoutMultiColumnSet*) override; |
200 void willBeRemovedFromTree() override; | 217 void willBeRemovedFromTree() override; |
201 void skipColumnSpanner(LayoutBox*, LayoutUnit logicalTopInFlowThread) overri
de; | 218 void skipColumnSpanner(LayoutBox*, LayoutUnit logicalTopInFlowThread) overri
de; |
202 void flowThreadDescendantWasInserted(LayoutObject*) final; | 219 void flowThreadDescendantWasInserted(LayoutObject*) final; |
203 void flowThreadDescendantWillBeRemoved(LayoutObject*) final; | 220 void flowThreadDescendantWillBeRemoved(LayoutObject*) final; |
204 void flowThreadDescendantStyleWillChange(LayoutObject*, StyleDifference, con
st ComputedStyle& newStyle) override; | 221 void flowThreadDescendantStyleWillChange(LayoutObject*, StyleDifference, con
st ComputedStyle& newStyle) override; |
205 void flowThreadDescendantStyleDidChange(LayoutObject*, StyleDifference, cons
t ComputedStyle& oldStyle) override; | 222 void flowThreadDescendantStyleDidChange(LayoutObject*, StyleDifference, cons
t ComputedStyle& oldStyle) override; |
206 void computePreferredLogicalWidths() override; | 223 void computePreferredLogicalWidths() override; |
207 void computeLogicalHeight(LayoutUnit logicalHeight, LayoutUnit logicalTop, L
ogicalExtentComputedValues&) const override; | 224 void computeLogicalHeight(LayoutUnit logicalHeight, LayoutUnit logicalTop, L
ogicalExtentComputedValues&) const override; |
208 void updateLogicalWidth() override; | 225 void updateLogicalWidth() override; |
209 void setPageBreak(LayoutUnit offset, LayoutUnit spaceShortage) override; | 226 void setPageBreak(LayoutUnit offset, LayoutUnit spaceShortage) override; |
210 void updateMinimumPageHeight(LayoutUnit offset, LayoutUnit minHeight) overri
de; | 227 void updateMinimumPageHeight(LayoutUnit offset, LayoutUnit minHeight) overri
de; |
211 bool addForcedColumnBreak(LayoutUnit, LayoutObject* breakChild, bool isBefor
e, LayoutUnit* offsetBreakAdjustment = nullptr) override; | 228 bool addForcedColumnBreak(LayoutUnit, LayoutObject* breakChild, bool isBefor
e, LayoutUnit* offsetBreakAdjustment = nullptr) override; |
212 bool isPageLogicalHeightKnown() const override; | |
213 | 229 |
214 // The last set we worked on. It's not to be used as the "current set". The
concept of a | 230 // The last set we worked on. It's not to be used as the "current set". The
concept of a |
215 // "current set" is difficult, since layout may jump back and forth in the t
ree, due to wrong | 231 // "current set" is difficult, since layout may jump back and forth in the t
ree, due to wrong |
216 // top location estimates (due to e.g. margin collapsing), and possibly for
other reasons. | 232 // top location estimates (due to e.g. margin collapsing), and possibly for
other reasons. |
217 LayoutMultiColumnSet* m_lastSetWorkedOn; | 233 LayoutMultiColumnSet* m_lastSetWorkedOn; |
218 | 234 |
219 unsigned m_columnCount; // The used value of column-count | 235 unsigned m_columnCount; // The used value of column-count |
220 LayoutUnit m_columnHeightAvailable; // Total height available to columns, or
0 if auto. | 236 LayoutUnit m_columnHeightAvailable; // Total height available to columns, or
0 if auto. |
| 237 |
| 238 // Cached block offset from this flow thread to the enclosing flow thread, i
f any. In the |
| 239 // coordinate space of the enclosing flow thread. |
| 240 LayoutUnit m_blockOffsetInEnclosingFlowThread; |
| 241 |
221 bool m_inBalancingPass; // Set when relayouting for column balancing. | 242 bool m_inBalancingPass; // Set when relayouting for column balancing. |
222 bool m_needsColumnHeightsRecalculation; // Set when we need to recalculate t
he column set heights after layout. | 243 bool m_needsColumnHeightsRecalculation; // Set when we need to recalculate t
he column set heights after layout. |
223 bool m_progressionIsInline; // Always true for regular multicol. False for p
aged-y overflow. | 244 bool m_progressionIsInline; // Always true for regular multicol. False for p
aged-y overflow. |
224 bool m_isBeingEvacuated; | 245 bool m_isBeingEvacuated; |
225 }; | 246 }; |
226 | 247 |
227 // Cannot use DEFINE_LAYOUT_OBJECT_TYPE_CASTS here, because isMultiColumnFlowThr
ead() is defined in | 248 // Cannot use DEFINE_LAYOUT_OBJECT_TYPE_CASTS here, because isMultiColumnFlowThr
ead() is defined in |
228 // LayoutFlowThread, not in LayoutObject. | 249 // LayoutFlowThread, not in LayoutObject. |
229 DEFINE_TYPE_CASTS(LayoutMultiColumnFlowThread, LayoutFlowThread, object, object-
>isLayoutMultiColumnFlowThread(), object.isLayoutMultiColumnFlowThread()); | 250 DEFINE_TYPE_CASTS(LayoutMultiColumnFlowThread, LayoutFlowThread, object, object-
>isLayoutMultiColumnFlowThread(), object.isLayoutMultiColumnFlowThread()); |
230 | 251 |
231 } // namespace blink | 252 } // namespace blink |
232 | 253 |
233 #endif // LayoutMultiColumnFlowThread_h | 254 #endif // LayoutMultiColumnFlowThread_h |
OLD | NEW |