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 26 matching lines...) Expand all Loading... |
37 | 37 |
38 enum BalancedColumnHeightCalculation { GuessFromFlowThreadPortion, StretchBySpac
eShortage }; | 38 enum BalancedColumnHeightCalculation { GuessFromFlowThreadPortion, StretchBySpac
eShortage }; |
39 | 39 |
40 // Flow thread implementation for CSS multicol. This will be inserted as an anon
ymous child block of | 40 // Flow thread implementation for CSS multicol. This will be inserted as an anon
ymous child block of |
41 // the actual multicol container (i.e. the LayoutBlockFlow whose style computes
to non-auto | 41 // the actual multicol container (i.e. the LayoutBlockFlow whose style computes
to non-auto |
42 // column-count and/or column-width). LayoutMultiColumnFlowThread is the heart o
f the multicol | 42 // column-count and/or column-width). LayoutMultiColumnFlowThread is the heart o
f the multicol |
43 // implementation, and there is only one instance per multicol container. Child
content of the | 43 // implementation, and there is only one instance per multicol container. Child
content of the |
44 // multicol container is parented into the flow thread at the time of layoutObje
ct insertion. | 44 // multicol container is parented into the flow thread at the time of layoutObje
ct insertion. |
45 // | 45 // |
46 // Apart from this flow thread child, the multicol container will also have Layo
utMultiColumnSet | 46 // Apart from this flow thread child, the multicol container will also have Layo
utMultiColumnSet |
47 // "region" children, which are used to position the columns visually. The flow
thread is in charge | 47 // children, which are used to position the columns visually. The flow thread is
in charge |
48 // of layout, and, after having calculated the column width, it lays out content
as if everything | 48 // of layout, and, after having calculated the column width, it lays out content
as if everything |
49 // were in one tall single column, except that there will typically be some amou
nt of blank space | 49 // were in one tall single column, except that there will typically be some amou
nt of blank space |
50 // (also known as pagination struts) at the offsets where the actual column boun
daries are. This | 50 // (also known as pagination struts) at the offsets where the actual column boun
daries are. This |
51 // way, content that needs to be preceded by a break will appear at the top of t
he next | 51 // way, content that needs to be preceded by a break will appear at the top of t
he next |
52 // column. Content needs to be preceded by a break when there's a forced break o
r when the content | 52 // column. Content needs to be preceded by a break when there's a forced break o
r when the content |
53 // is unbreakable and cannot fully fit in the same column as the preceding piece
of | 53 // is unbreakable and cannot fully fit in the same column as the preceding piece
of |
54 // content. Although a LayoutMultiColumnFlowThread is laid out, it does not take
up any space in its | 54 // content. Although a LayoutMultiColumnFlowThread is laid out, it does not take
up any space in its |
55 // container. It's the LayoutMultiColumnSet objects that take up the necessary a
mount of space, and | 55 // container. It's the LayoutMultiColumnSet objects that take up the necessary a
mount of space, and |
56 // make sure that the columns are painted and hit-tested correctly. | 56 // make sure that the columns are painted and hit-tested correctly. |
57 // | 57 // |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 void setProgressionIsInline(bool isInline) { m_progressionIsInline = isInlin
e; } | 185 void setProgressionIsInline(bool isInline) { m_progressionIsInline = isInlin
e; } |
186 | 186 |
187 virtual void layout() override; | 187 virtual void layout() override; |
188 | 188 |
189 private: | 189 private: |
190 void calculateColumnCountAndWidth(LayoutUnit& width, unsigned& count) const; | 190 void calculateColumnCountAndWidth(LayoutUnit& width, unsigned& count) const; |
191 void createAndInsertMultiColumnSet(LayoutBox* insertBefore = 0); | 191 void createAndInsertMultiColumnSet(LayoutBox* insertBefore = 0); |
192 void createAndInsertSpannerPlaceholder(LayoutBox* spanner, LayoutBox* insert
Before = 0); | 192 void createAndInsertSpannerPlaceholder(LayoutBox* spanner, LayoutBox* insert
Before = 0); |
193 virtual bool descendantIsValidColumnSpanner(LayoutObject* descendant) const; | 193 virtual bool descendantIsValidColumnSpanner(LayoutObject* descendant) const; |
194 | 194 |
195 virtual void addRegionToThread(LayoutMultiColumnSet*) override; | 195 virtual void addColumnSetToThread(LayoutMultiColumnSet*) override; |
196 virtual void willBeRemovedFromTree() override; | 196 virtual void willBeRemovedFromTree() override; |
197 virtual LayoutUnit skipColumnSpanner(LayoutBox*, LayoutUnit logicalTopInFlow
Thread) override; | 197 virtual LayoutUnit skipColumnSpanner(LayoutBox*, LayoutUnit logicalTopInFlow
Thread) override; |
198 virtual void flowThreadDescendantWasInserted(LayoutObject*) override; | 198 virtual void flowThreadDescendantWasInserted(LayoutObject*) override; |
199 virtual void flowThreadDescendantWillBeRemoved(LayoutObject*) override; | 199 virtual void flowThreadDescendantWillBeRemoved(LayoutObject*) override; |
200 virtual void computePreferredLogicalWidths() override; | 200 virtual void computePreferredLogicalWidths() override; |
201 virtual void computeLogicalHeight(LayoutUnit logicalHeight, LayoutUnit logic
alTop, LogicalExtentComputedValues&) const override; | 201 virtual void computeLogicalHeight(LayoutUnit logicalHeight, LayoutUnit logic
alTop, LogicalExtentComputedValues&) const override; |
202 virtual void updateLogicalWidth() override; | 202 virtual void updateLogicalWidth() override; |
203 virtual void setPageBreak(LayoutUnit offset, LayoutUnit spaceShortage) overr
ide; | 203 virtual void setPageBreak(LayoutUnit offset, LayoutUnit spaceShortage) overr
ide; |
204 virtual void updateMinimumPageHeight(LayoutUnit offset, LayoutUnit minHeight
) override; | 204 virtual void updateMinimumPageHeight(LayoutUnit offset, LayoutUnit minHeight
) override; |
205 virtual bool addForcedRegionBreak(LayoutUnit, LayoutObject* breakChild, bool
isBefore, LayoutUnit* offsetBreakAdjustment = 0) override; | 205 virtual bool addForcedColumnBreak(LayoutUnit, LayoutObject* breakChild, bool
isBefore, LayoutUnit* offsetBreakAdjustment = 0) override; |
206 virtual bool isPageLogicalHeightKnown() const override; | 206 virtual bool isPageLogicalHeightKnown() const override; |
207 | 207 |
208 // The last set we worked on. It's not to be used as the "current set". The
concept of a | 208 // The last set we worked on. It's not to be used as the "current set". The
concept of a |
209 // "current set" is difficult, since layout may jump back and forth in the t
ree, due to wrong | 209 // "current set" is difficult, since layout may jump back and forth in the t
ree, due to wrong |
210 // top location estimates (due to e.g. margin collapsing), and possibly for
other reasons. | 210 // top location estimates (due to e.g. margin collapsing), and possibly for
other reasons. |
211 LayoutMultiColumnSet* m_lastSetWorkedOn; | 211 LayoutMultiColumnSet* m_lastSetWorkedOn; |
212 | 212 |
213 unsigned m_columnCount; // The used value of column-count | 213 unsigned m_columnCount; // The used value of column-count |
214 LayoutUnit m_columnHeightAvailable; // Total height available to columns, or
0 if auto. | 214 LayoutUnit m_columnHeightAvailable; // Total height available to columns, or
0 if auto. |
215 bool m_inBalancingPass; // Set when relayouting for column balancing. | 215 bool m_inBalancingPass; // Set when relayouting for column balancing. |
216 bool m_needsColumnHeightsRecalculation; // Set when we need to recalculate t
he column set heights after layout. | 216 bool m_needsColumnHeightsRecalculation; // Set when we need to recalculate t
he column set heights after layout. |
217 bool m_progressionIsInline; // Always true for regular multicol. False for p
aged-y overflow. | 217 bool m_progressionIsInline; // Always true for regular multicol. False for p
aged-y overflow. |
218 bool m_isBeingEvacuated; | 218 bool m_isBeingEvacuated; |
219 }; | 219 }; |
220 | 220 |
221 } // namespace blink | 221 } // namespace blink |
222 | 222 |
223 #endif // LayoutMultiColumnFlowThread_h | 223 #endif // LayoutMultiColumnFlowThread_h |
OLD | NEW |