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 19 matching lines...) Expand all Loading... |
30 #include "core/layout/FragmentationContext.h" | 30 #include "core/layout/FragmentationContext.h" |
31 #include "core/layout/LayoutFlowThread.h" | 31 #include "core/layout/LayoutFlowThread.h" |
32 | 32 |
33 namespace blink { | 33 namespace blink { |
34 | 34 |
35 class LayoutMultiColumnSet; | 35 class LayoutMultiColumnSet; |
36 class LayoutMultiColumnSpannerPlaceholder; | 36 class LayoutMultiColumnSpannerPlaceholder; |
37 | 37 |
38 // What to translate *to* when translating from a flow thread coordinate space. | 38 // What to translate *to* when translating from a flow thread coordinate space. |
39 enum class CoordinateSpaceConversion { | 39 enum class CoordinateSpaceConversion { |
40 // Just translate to the nearest containing coordinate space (i.e. where our m
ulticol container | 40 // Just translate to the nearest containing coordinate space (i.e. where our |
41 // lives) of this flow thread, i.e. don't walk ancestral flow threads, if any. | 41 // multicol container lives) of this flow thread, i.e. don't walk ancestral |
| 42 // flow threads, if any. |
42 Containing, | 43 Containing, |
43 | 44 |
44 // Translate to visual coordinates, by walking all ancestral flow threads. | 45 // Translate to visual coordinates, by walking all ancestral flow threads. |
45 Visual | 46 Visual |
46 }; | 47 }; |
47 | 48 |
48 // Flow thread implementation for CSS multicol. This will be inserted as an anon
ymous child block of | 49 // Flow thread implementation for CSS multicol. This will be inserted as an |
49 // the actual multicol container (i.e. the LayoutBlockFlow whose style computes
to non-auto | 50 // anonymous child block of the actual multicol container (i.e. the |
50 // column-count and/or column-width). LayoutMultiColumnFlowThread is the heart o
f the multicol | 51 // LayoutBlockFlow whose style computes to non-auto column-count and/or |
51 // implementation, and there is only one instance per multicol container. Child
content of the | 52 // column-width). LayoutMultiColumnFlowThread is the heart of the multicol |
52 // multicol container is parented into the flow thread at the time of layoutObje
ct insertion. | 53 // implementation, and there is only one instance per multicol container. Child |
| 54 // content of the multicol container is parented into the flow thread at the |
| 55 // time of layoutObject insertion. |
53 // | 56 // |
54 // Apart from this flow thread child, the multicol container will also have Layo
utMultiColumnSet | 57 // Apart from this flow thread child, the multicol container will also have |
55 // children, which are used to position the columns visually. The flow thread is
in charge | 58 // LayoutMultiColumnSet children, which are used to position the columns |
56 // of layout, and, after having calculated the column width, it lays out content
as if everything | 59 // visually. The flow thread is in charge of layout, and, after having |
57 // were in one tall single column, except that there will typically be some amou
nt of blank space | 60 // calculated the column width, it lays out content as if everything were in one |
58 // (also known as pagination struts) at the offsets where the actual column boun
daries are. This | 61 // tall single column, except that there will typically be some amount of blank |
59 // way, content that needs to be preceded by a break will appear at the top of t
he next | 62 // space (also known as pagination struts) at the offsets where the actual |
60 // column. Content needs to be preceded by a break when there's a forced break o
r when the content | 63 // column boundaries are. This way, content that needs to be preceded by a break |
61 // is unbreakable and cannot fully fit in the same column as the preceding piece
of | 64 // will appear at the top of the next column. Content needs to be preceded by a |
62 // content. Although a LayoutMultiColumnFlowThread is laid out, it does not take
up any space in its | 65 // break when there's a forced break or when the content is unbreakable and |
63 // container. It's the LayoutMultiColumnSet objects that take up the necessary a
mount of space, and | 66 // cannot fully fit in the same column as the preceding piece of content. |
64 // make sure that the columns are painted and hit-tested correctly. | 67 // Although a LayoutMultiColumnFlowThread is laid out, it does not take up any |
| 68 // space in its container. It's the LayoutMultiColumnSet objects that take up |
| 69 // the necessary amount of space, and make sure that the columns are painted and |
| 70 // hit-tested correctly. |
65 // | 71 // |
66 // If there is any column content inside the multicol container, we create a | 72 // If there is any column content inside the multicol container, we create a |
67 // LayoutMultiColumnSet. We only need to create multiple sets if there are spann
ers | 73 // LayoutMultiColumnSet. We only need to create multiple sets if there are |
68 // (column-span:all) in the multicol container. When a spanner is inserted, cont
ent preceding it | 74 // spanners (column-span:all) in the multicol container. When a spanner is |
69 // gets its own set, and content succeeding it will get another set. The spanner
itself will also | 75 // inserted, content preceding it gets its own set, and content succeeding it |
70 // get its own placeholder between the sets (LayoutMultiColumnSpannerPlaceholder
), so that it gets | 76 // will get another set. The spanner itself will also get its own placeholder |
71 // positioned and sized correctly. The column-span:all element is inside the flo
w thread, but its | 77 // between the sets (LayoutMultiColumnSpannerPlaceholder), so that it gets |
72 // containing block is the multicol container. | 78 // positioned and sized correctly. The column-span:all element is inside the |
| 79 // flow thread, but its containing block is the multicol container. |
73 // | 80 // |
74 // Some invariants for the layout tree structure for multicol: | 81 // Some invariants for the layout tree structure for multicol: |
75 // - A multicol container is always a LayoutBlockFlow | 82 // - A multicol container is always a LayoutBlockFlow |
76 // - Every multicol container has one and only one LayoutMultiColumnFlowThread | 83 // - Every multicol container has one and only one LayoutMultiColumnFlowThread |
77 // - All multicol DOM children and pseudo-elements associated with the multicol
container are | 84 // - All multicol DOM children and pseudo-elements associated with the multicol |
78 // reparented into the flow thread | 85 // container are reparented into the flow thread. |
79 // - The LayoutMultiColumnFlowThread is the first child of the multicol containe
r | 86 // - The LayoutMultiColumnFlowThread is the first child of the multicol |
80 // - A multicol container may only have LayoutMultiColumnFlowThread, LayoutMulti
ColumnSet and | 87 // container. |
81 // LayoutMultiColumnSpannerPlaceholder children | 88 // - A multicol container may only have LayoutMultiColumnFlowThread, |
82 // - A LayoutMultiColumnSet may not be adjacent to another LayoutMultiColumnSet;
there are no | 89 // LayoutMultiColumnSet and LayoutMultiColumnSpannerPlaceholder children. |
83 // use-cases for it, and there are also implementation limitations behind this
requirement. | 90 // - A LayoutMultiColumnSet may not be adjacent to another LayoutMultiColumnSet; |
84 // - The flow thread is not in the containing block chain for children that are
not to be laid out | 91 // there are no use-cases for it, and there are also implementation |
85 // in columns. This means column spanners and absolutely positioned children w
hose containing | 92 // limitations behind this requirement. |
86 // block is outside column content | 93 // - The flow thread is not in the containing block chain for children that are |
87 // - Each spanner (column-span:all) establishes a LayoutMultiColumnSpannerPlaceh
older | 94 // not to be laid out in columns. This means column spanners and absolutely |
| 95 // positioned children whose containing block is outside column content |
| 96 // - Each spanner (column-span:all) establishes a |
| 97 // LayoutMultiColumnSpannerPlaceholder |
88 // | 98 // |
89 // The width of the flow thread is the same as the column width. The width of a
column set is the | 99 // The width of the flow thread is the same as the column width. The width of a |
90 // same as the content box width of the multicol container; in other words exact
ly enough to hold | 100 // column set is the same as the content box width of the multicol container; in |
91 // the number of columns to be used, stacked horizontally, plus column gaps betw
een them. | 101 // other words exactly enough to hold the number of columns to be used, stacked |
| 102 // horizontally, plus column gaps between them. |
92 // | 103 // |
93 // Since it's the first child of the multicol container, the flow thread is laid
out first, albeit | 104 // Since it's the first child of the multicol container, the flow thread is laid |
94 // in a slightly special way, since it's not to take up any space in its ancesto
rs. Afterwards, the | 105 // out first, albeit in a slightly special way, since it's not to take up any |
95 // column sets are laid out. Column sets get their height from the columns that
they hold. In single | 106 // space in its ancestors. Afterwards, the column sets are laid out. Column sets |
96 // column-row constrained height non-balancing cases without spanners this will
simply be the same | 107 // get their height from the columns that they hold. In single column-row |
97 // as the content height of the multicol container itself. In most other cases w
e'll have to | 108 // constrained height non-balancing cases without spanners this will simply be |
98 // calculate optimal column heights ourselves, though. This process is referred
to as column | 109 // the same as the content height of the multicol container itself. In most |
99 // balancing, and then we infer the column set height from the height of the flo
w thread portion | 110 // other cases we'll have to calculate optimal column heights ourselves, though. |
100 // occupied by each set. | 111 // This process is referred to as column balancing, and then we infer the column |
| 112 // set height from the height of the flow thread portion occupied by each set. |
101 // | 113 // |
102 // More on column balancing: the columns' height is unknown in the first layout
pass when | 114 // More on column balancing: the columns' height is unknown in the first layout |
103 // balancing. This means that we cannot insert any implicit (soft / unforced) br
eaks (and pagination | 115 // pass when balancing. This means that we cannot insert any implicit (soft / |
104 // struts) when laying out the contents of the flow thread. We'll just lay out e
verything in tall | 116 // unforced) breaks (and pagination struts) when laying out the contents of the |
105 // single strip. After the initial flow thread layout pass we can determine a te
ntative / minimal / | 117 // flow thread. We'll just lay out everything in tall single strip. After the |
106 // initial column height. This is calculated by simply dividing the flow thread'
s height by the | 118 // initial flow thread layout pass we can determine a tentative / minimal / |
107 // number of specified columns. In the layout pass that follows, we can insert b
reaks (and | 119 // initial column height. This is calculated by simply dividing the flow |
108 // pagination struts) at column boundaries, since we now have a column height. I
t may very easily | 120 // thread's height by the number of specified columns. In the layout pass that |
109 // turn out that the calculated height wasn't enough, though. We'll notice this
at end of layout. If | 121 // follows, we can insert breaks (and pagination struts) at column boundaries, |
110 // we end up with too many columns (i.e. columns overflowing the multicol contai
ner), it wasn't | 122 // since we now have a column height. |
111 // enough. In this case we need to increase the column heights. We'll increase t
hem by the lowest | 123 // It may very easily turn out that the calculated height wasn't enough, though. |
112 // amount of space that could possibly affect where the breaks occur. We'll rela
yout (to find new | 124 // We'll notice this at end of layout. If we end up with too many columns (i.e. |
113 // break points and the new lowest amount of space increase that could affect wh
ere they occur, in | 125 // columns overflowing the multicol container), it wasn't enough. In this case |
114 // case we need another round) until we've reached an acceptable height (where e
verything fits | 126 // we need to increase the column heights. We'll increase them by the lowest |
115 // perfectly in the number of columns that we have specified). The rule of thumb
is that we | 127 // amount of space that could possibly affect where the breaks occur. We'll |
116 // shouldn't have to perform more of such iterations than the number of columns
that we have. | 128 // relayout (to find new break points and the new lowest amount of space |
| 129 // increase that could affect where they occur, in case we need another round) |
| 130 // until we've reached an acceptable height (where everything fits perfectly in |
| 131 // the number of columns that we have specified). The rule of thumb is that we |
| 132 // shouldn't have to perform more of such iterations than the number of columns |
| 133 // that we have. |
117 // | 134 // |
118 // For each layout iteration done for column balancing, the flow thread will nee
d a deep layout if | 135 // For each layout iteration done for column balancing, the flow thread will |
119 // column heights changed in the previous pass, since column height changes may
affect break points | 136 // need a deep layout if column heights changed in the previous pass, since |
120 // and pagination struts anywhere in the tree, and currently no way exists to do
this in a more | 137 // column height changes may affect break points and pagination struts anywhere |
121 // optimized manner. | 138 // in the tree, and currently no way exists to do this in a more optimized |
| 139 // manner. |
122 // | 140 // |
123 // There's also some documentation online: | 141 // There's also some documentation online: |
124 // https://sites.google.com/a/chromium.org/dev/developers/design-documents/multi
-column-layout | 142 // https://www.chromium.org/developers/design-documents/multi-column-layout |
125 class CORE_EXPORT LayoutMultiColumnFlowThread : public LayoutFlowThread, | 143 class CORE_EXPORT LayoutMultiColumnFlowThread : public LayoutFlowThread, |
126 public FragmentationContext { | 144 public FragmentationContext { |
127 public: | 145 public: |
128 ~LayoutMultiColumnFlowThread() override; | 146 ~LayoutMultiColumnFlowThread() override; |
129 | 147 |
130 static LayoutMultiColumnFlowThread* createAnonymous( | 148 static LayoutMultiColumnFlowThread* createAnonymous( |
131 Document&, | 149 Document&, |
132 const ComputedStyle& parentStyle); | 150 const ComputedStyle& parentStyle); |
133 | 151 |
134 bool isLayoutMultiColumnFlowThread() const final { return true; } | 152 bool isLayoutMultiColumnFlowThread() const final { return true; } |
135 | 153 |
136 LayoutBlockFlow* multiColumnBlockFlow() const { | 154 LayoutBlockFlow* multiColumnBlockFlow() const { |
137 return toLayoutBlockFlow(parent()); | 155 return toLayoutBlockFlow(parent()); |
138 } | 156 } |
139 | 157 |
140 LayoutMultiColumnSet* firstMultiColumnSet() const; | 158 LayoutMultiColumnSet* firstMultiColumnSet() const; |
141 LayoutMultiColumnSet* lastMultiColumnSet() const; | 159 LayoutMultiColumnSet* lastMultiColumnSet() const; |
142 | 160 |
143 // Return the first column set or spanner placeholder. | 161 // Return the first column set or spanner placeholder. |
144 LayoutBox* firstMultiColumnBox() const { return nextSiblingBox(); } | 162 LayoutBox* firstMultiColumnBox() const { return nextSiblingBox(); } |
145 // Return the last column set or spanner placeholder. | 163 // Return the last column set or spanner placeholder. |
146 LayoutBox* lastMultiColumnBox() const { | 164 LayoutBox* lastMultiColumnBox() const { |
147 LayoutBox* lastSiblingBox = multiColumnBlockFlow()->lastChildBox(); | 165 LayoutBox* lastSiblingBox = multiColumnBlockFlow()->lastChildBox(); |
148 // The flow thread is the first child of the multicol container. If the flow
thread is also | 166 // The flow thread is the first child of the multicol container. If the flow |
149 // the last child, it means that there are no siblings; i.e. we have no colu
mn boxes. | 167 // thread is also the last child, it means that there are no siblings; i.e. |
| 168 // we have no column boxes. |
150 return lastSiblingBox != this ? lastSiblingBox : 0; | 169 return lastSiblingBox != this ? lastSiblingBox : 0; |
151 } | 170 } |
152 | 171 |
153 // Find the first set inside which the specified layoutObject (which is a flow
thread descendant) would be rendered. | 172 // Find the first set inside which the specified layoutObject (which is a |
| 173 // flowthread descendant) would be rendered. |
154 LayoutMultiColumnSet* mapDescendantToColumnSet(LayoutObject*) const; | 174 LayoutMultiColumnSet* mapDescendantToColumnSet(LayoutObject*) const; |
155 | 175 |
156 // Return the spanner placeholder that belongs to the spanner in the containin
g block chain, if | 176 // Return the spanner placeholder that belongs to the spanner in the |
157 // any. This includes the layoutObject for the element that actually establish
es the spanner too. | 177 // containing block chain, if any. This includes the layoutObject for the |
| 178 // element that actually establishes the spanner too. |
158 LayoutMultiColumnSpannerPlaceholder* containingColumnSpannerPlaceholder( | 179 LayoutMultiColumnSpannerPlaceholder* containingColumnSpannerPlaceholder( |
159 const LayoutObject* descendant) const; | 180 const LayoutObject* descendant) const; |
160 | 181 |
161 // Populate the flow thread with what's currently its siblings. Called when a
regular block | 182 // Populate the flow thread with what's currently its siblings. Called when a |
162 // becomes a multicol container. | 183 // regular block becomes a multicol container. |
163 void populate(); | 184 void populate(); |
164 | 185 |
165 // Empty the flow thread by moving everything to the parent. Remove all multic
ol specific | 186 // Empty the flow thread by moving everything to the parent. Remove all |
166 // layoutObjects. Then destroy the flow thread. Called when a multicol contain
er becomes a regular | 187 // multicol specific layoutObjects. Then destroy the flow thread. Called when |
167 // block. | 188 // a multicol container becomes a regular block. |
168 void evacuateAndDestroy(); | 189 void evacuateAndDestroy(); |
169 | 190 |
170 unsigned columnCount() const { return m_columnCount; } | 191 unsigned columnCount() const { return m_columnCount; } |
171 | 192 |
172 // Total height available to columns and spanners. This is the multicol contai
ner's content box | 193 // Total height available to columns and spanners. This is the multicol |
173 // logical height, or 0 if auto. | 194 // container's content box logical height, or 0 if auto. |
174 LayoutUnit columnHeightAvailable() const { return m_columnHeightAvailable; } | 195 LayoutUnit columnHeightAvailable() const { return m_columnHeightAvailable; } |
175 void setColumnHeightAvailable(LayoutUnit available) { | 196 void setColumnHeightAvailable(LayoutUnit available) { |
176 m_columnHeightAvailable = available; | 197 m_columnHeightAvailable = available; |
177 } | 198 } |
178 | 199 |
179 // Maximum content box logical height for the multicol container. This takes C
SS logical | 200 // Maximum content box logical height for the multicol container. This takes |
180 // 'height' and 'max-height' into account. LayoutUnit::max() is returned if no
thing constrains | 201 // CSS logical 'height' and 'max-height' into account. LayoutUnit::max() is |
181 // the height of the multicol container. This method only deals with used valu
es of CSS | 202 // returned if nothing constrains the height of the multicol container. This |
182 // properties, and it does not consider enclosing fragmentation contexts -- th
at's something | 203 // method only deals with used values of CSS properties, and it does not |
183 // that needs to be calculated per fragmentainer group. | 204 // consider enclosing fragmentation contexts -- that's something that needs to |
| 205 // be calculated per fragmentainer group. |
184 LayoutUnit maxColumnLogicalHeight() const; | 206 LayoutUnit maxColumnLogicalHeight() const; |
185 | 207 |
186 bool progressionIsInline() const { return m_progressionIsInline; } | 208 bool progressionIsInline() const { return m_progressionIsInline; } |
187 | 209 |
188 LayoutUnit tallestUnbreakableLogicalHeight( | 210 LayoutUnit tallestUnbreakableLogicalHeight( |
189 LayoutUnit offsetInFlowThread) const; | 211 LayoutUnit offsetInFlowThread) const; |
190 | 212 |
191 LayoutSize columnOffset(const LayoutPoint&) const final; | 213 LayoutSize columnOffset(const LayoutPoint&) const final; |
192 | 214 |
193 // Do we need to set a new width and lay out? | 215 // Do we need to set a new width and lay out? |
(...skipping 12 matching lines...) Expand all Loading... |
206 LayoutPoint visualPointToFlowThreadPoint( | 228 LayoutPoint visualPointToFlowThreadPoint( |
207 const LayoutPoint& visualPoint) const override; | 229 const LayoutPoint& visualPoint) const override; |
208 | 230 |
209 int inlineBlockBaseline(LineDirectionMode) const override; | 231 int inlineBlockBaseline(LineDirectionMode) const override; |
210 | 232 |
211 LayoutMultiColumnSet* columnSetAtBlockOffset(LayoutUnit, | 233 LayoutMultiColumnSet* columnSetAtBlockOffset(LayoutUnit, |
212 PageBoundaryRule) const final; | 234 PageBoundaryRule) const final; |
213 | 235 |
214 void layoutColumns(SubtreeLayoutScope&); | 236 void layoutColumns(SubtreeLayoutScope&); |
215 | 237 |
216 // Skip past a column spanner during flow thread layout. Spanners are not laid
out inside the | 238 // Skip past a column spanner during flow thread layout. Spanners are not laid |
217 // flow thread, since the flow thread is not in a spanner's containing block c
hain (since the | 239 // out inside the flow thread, since the flow thread is not in a spanner's |
218 // containing block is the multicol container). | 240 // containing block chain (since the containing block is the multicol |
| 241 // container). |
219 void skipColumnSpanner(LayoutBox*, LayoutUnit logicalTopInFlowThread); | 242 void skipColumnSpanner(LayoutBox*, LayoutUnit logicalTopInFlowThread); |
220 | 243 |
221 // Returns true if at least one column got a new height after flow thread layo
ut (during column | 244 // Returns true if at least one column got a new height after flow thread |
222 // set layout), in which case we need another layout pass. Column heights may
change after flow | 245 // layout (during column set layout), in which case we need another layout |
223 // thread layout because of balancing. We may have to do multiple layout passe
s, depending on | 246 // pass. Column heights may change after flow thread layout because of |
224 // how the contents is fitted to the changed column heights. In most cases, la
ying out again | 247 // balancing. We may have to do multiple layout passes, depending on how the |
225 // twice or even just once will suffice. Sometimes we need more passes than th
at, though, but | 248 // contents is fitted to the changed column heights. In most cases, laying out |
226 // the number of retries should not exceed the number of columns, unless we ha
ve a bug. | 249 // again twice or even just once will suffice. Sometimes we need more passes |
| 250 // than that, though, but the number of retries should not exceed the number |
| 251 // of columns, unless we have a bug. |
227 bool columnHeightsChanged() const { return m_columnHeightsChanged; } | 252 bool columnHeightsChanged() const { return m_columnHeightsChanged; } |
228 void setColumnHeightsChanged() { m_columnHeightsChanged = true; } | 253 void setColumnHeightsChanged() { m_columnHeightsChanged = true; } |
229 | 254 |
230 void columnRuleStyleDidChange(); | 255 void columnRuleStyleDidChange(); |
231 | 256 |
232 // Remove the spanner placeholder and return true if the specified object is n
o longer a valid spanner. | 257 // Remove the spanner placeholder and return true if the specified object is |
| 258 // no longer a valid spanner. |
233 bool removeSpannerPlaceholderIfNoLongerValid( | 259 bool removeSpannerPlaceholderIfNoLongerValid( |
234 LayoutBox* spannerObjectInFlowThread); | 260 LayoutBox* spannerObjectInFlowThread); |
235 | 261 |
236 LayoutMultiColumnFlowThread* enclosingFlowThread() const; | 262 LayoutMultiColumnFlowThread* enclosingFlowThread() const; |
237 FragmentationContext* enclosingFragmentationContext() const; | 263 FragmentationContext* enclosingFragmentationContext() const; |
238 LayoutUnit blockOffsetInEnclosingFragmentationContext() const { | 264 LayoutUnit blockOffsetInEnclosingFragmentationContext() const { |
239 ASSERT(enclosingFragmentationContext()); | 265 ASSERT(enclosingFragmentationContext()); |
240 return m_blockOffsetInEnclosingFragmentationContext; | 266 return m_blockOffsetInEnclosingFragmentationContext; |
241 } | 267 } |
242 | 268 |
243 // If we've run out of columns in the last fragmentainer group (column row), w
e have to insert | 269 // If we've run out of columns in the last fragmentainer group (column row), |
244 // another fragmentainer group in order to hold more columns. This means that
we're moving to | 270 // we have to insert another fragmentainer group in order to hold more |
245 // the next outer column (in the enclosing fragmentation context). | 271 // columns. This means that we're moving to the next outer column (in the |
| 272 // enclosing fragmentation context). |
246 void appendNewFragmentainerGroupIfNeeded(LayoutUnit offsetInFlowThread, | 273 void appendNewFragmentainerGroupIfNeeded(LayoutUnit offsetInFlowThread, |
247 PageBoundaryRule); | 274 PageBoundaryRule); |
248 | 275 |
249 // Implementing FragmentationContext: | 276 // Implementing FragmentationContext: |
250 bool isFragmentainerLogicalHeightKnown() final; | 277 bool isFragmentainerLogicalHeightKnown() final; |
251 LayoutUnit fragmentainerLogicalHeightAt(LayoutUnit blockOffset) final; | 278 LayoutUnit fragmentainerLogicalHeightAt(LayoutUnit blockOffset) final; |
252 LayoutUnit remainingLogicalHeightAt(LayoutUnit blockOffset) final; | 279 LayoutUnit remainingLogicalHeightAt(LayoutUnit blockOffset) final; |
253 LayoutMultiColumnFlowThread* associatedFlowThread() final { return this; } | 280 LayoutMultiColumnFlowThread* associatedFlowThread() final { return this; } |
254 | 281 |
255 const char* name() const override { return "LayoutMultiColumnFlowThread"; } | 282 const char* name() const override { return "LayoutMultiColumnFlowThread"; } |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
287 void computeLogicalHeight(LayoutUnit logicalHeight, | 314 void computeLogicalHeight(LayoutUnit logicalHeight, |
288 LayoutUnit logicalTop, | 315 LayoutUnit logicalTop, |
289 LogicalExtentComputedValues&) const override; | 316 LogicalExtentComputedValues&) const override; |
290 void updateLogicalWidth() override; | 317 void updateLogicalWidth() override; |
291 void contentWasLaidOut( | 318 void contentWasLaidOut( |
292 LayoutUnit logicalBottomInFlowThreadAfterPagination) override; | 319 LayoutUnit logicalBottomInFlowThreadAfterPagination) override; |
293 bool canSkipLayout(const LayoutBox&) const override; | 320 bool canSkipLayout(const LayoutBox&) const override; |
294 MultiColumnLayoutState multiColumnLayoutState() const override; | 321 MultiColumnLayoutState multiColumnLayoutState() const override; |
295 void restoreMultiColumnLayoutState(const MultiColumnLayoutState&) override; | 322 void restoreMultiColumnLayoutState(const MultiColumnLayoutState&) override; |
296 | 323 |
297 // The last set we worked on. It's not to be used as the "current set". The co
ncept of a | 324 // The last set we worked on. It's not to be used as the "current set". The |
298 // "current set" is difficult, since layout may jump back and forth in the tre
e, due to wrong | 325 // concept of a "current set" is difficult, since layout may jump back and |
299 // top location estimates (due to e.g. margin collapsing), and possibly for ot
her reasons. | 326 // forth in the tree, due to wrong top location estimates (due to e.g. margin |
| 327 // collapsing), and possibly for other reasons. |
300 LayoutMultiColumnSet* m_lastSetWorkedOn; | 328 LayoutMultiColumnSet* m_lastSetWorkedOn; |
301 | 329 |
302 unsigned m_columnCount; // The used value of column-count | 330 // The used value of column-count |
303 LayoutUnit | 331 unsigned m_columnCount; |
304 m_columnHeightAvailable; // Total height available to columns, or 0 if au
to. | 332 // Total height available to columns, or 0 if auto. |
| 333 LayoutUnit m_columnHeightAvailable; |
305 | 334 |
306 // Cached block offset from this flow thread to the enclosing fragmentation co
ntext, if any. In | 335 // Cached block offset from this flow thread to the enclosing fragmentation |
| 336 // context, if any. In |
307 // the coordinate space of the enclosing fragmentation context. | 337 // the coordinate space of the enclosing fragmentation context. |
308 LayoutUnit m_blockOffsetInEnclosingFragmentationContext; | 338 LayoutUnit m_blockOffsetInEnclosingFragmentationContext; |
309 | 339 |
310 bool | 340 // Set when column heights are out of sync with actual layout. |
311 m_columnHeightsChanged; // Set when column heights are out of sync with a
ctual layout. | 341 bool m_columnHeightsChanged; |
312 bool | 342 // Always true for regular multicol. False for paged-y overflow. |
313 m_progressionIsInline; // Always true for regular multicol. False for pag
ed-y overflow. | 343 bool m_progressionIsInline; |
314 bool m_isBeingEvacuated; | 344 bool m_isBeingEvacuated; |
315 }; | 345 }; |
316 | 346 |
317 // Cannot use DEFINE_LAYOUT_OBJECT_TYPE_CASTS here, because isMultiColumnFlowThr
ead() is defined in | 347 // Cannot use DEFINE_LAYOUT_OBJECT_TYPE_CASTS here, because |
318 // LayoutFlowThread, not in LayoutObject. | 348 // isMultiColumnFlowThread() is defined in LayoutFlowThread, not in |
| 349 // LayoutObject. |
319 DEFINE_TYPE_CASTS(LayoutMultiColumnFlowThread, | 350 DEFINE_TYPE_CASTS(LayoutMultiColumnFlowThread, |
320 LayoutFlowThread, | 351 LayoutFlowThread, |
321 object, | 352 object, |
322 object->isLayoutMultiColumnFlowThread(), | 353 object->isLayoutMultiColumnFlowThread(), |
323 object.isLayoutMultiColumnFlowThread()); | 354 object.isLayoutMultiColumnFlowThread()); |
324 | 355 |
325 } // namespace blink | 356 } // namespace blink |
326 | 357 |
327 #endif // LayoutMultiColumnFlowThread_h | 358 #endif // LayoutMultiColumnFlowThread_h |
OLD | NEW |