| 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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 // More on column balancing: the columns' height is unknown in the first layout
pass when | 94 // More on column balancing: the columns' height is unknown in the first layout
pass when |
| 95 // balancing. This means that we cannot insert any implicit (soft / unforced) br
eaks (and pagination | 95 // balancing. This means that we cannot insert any implicit (soft / unforced) br
eaks (and pagination |
| 96 // struts) when laying out the contents of the flow thread. We'll just lay out e
verything in tall | 96 // struts) when laying out the contents of the flow thread. We'll just lay out e
verything in tall |
| 97 // single strip. After the initial flow thread layout pass we can determine a te
ntative / minimal / | 97 // single strip. After the initial flow thread layout pass we can determine a te
ntative / minimal / |
| 98 // initial column height. This is calculated by simply dividing the flow thread'
s height by the | 98 // initial column height. This is calculated by simply dividing the flow thread'
s height by the |
| 99 // number of specified columns. In the layout pass that follows, we can insert b
reaks (and | 99 // number of specified columns. In the layout pass that follows, we can insert b
reaks (and |
| 100 // pagination struts) at column boundaries, since we now have a column height. I
t may very easily | 100 // pagination struts) at column boundaries, since we now have a column height. I
t may very easily |
| 101 // turn out that the calculated height wasn't enough, though. We'll notice this
at end of layout. If | 101 // turn out that the calculated height wasn't enough, though. We'll notice this
at end of layout. If |
| 102 // we end up with too many columns (i.e. columns overflowing the multicol contai
ner), it wasn't | 102 // we end up with too many columns (i.e. columns overflowing the multicol contai
ner), it wasn't |
| 103 // enough. In this case we need to increase the column heights. We'll increase t
hem by the lowest | 103 // enough. In this case we need to increase the column heights. We'll increase t
hem by the lowest |
| 104 // amount of space that could possibly affect where the breaks occur (see | 104 // amount of space that could possibly affect where the breaks occur. We'll rela
yout (to find new |
| 105 // LayoutMultiColumnSet::recordSpaceShortage()). We'll relayout (to find new bre
ak points and the | 105 // break points and the new lowest amount of space increase that could affect wh
ere they occur, in |
| 106 // new lowest amount of space increase that could affect where they occur, in ca
se we need another | 106 // case we need another round) until we've reached an acceptable height (where e
verything fits |
| 107 // round) until we've reached an acceptable height (where everything fits perfec
tly in the number of | 107 // perfectly in the number of columns that we have specified). The rule of thumb
is that we |
| 108 // columns that we have specified). The rule of thumb is that we shouldn't have
to perform more of | 108 // shouldn't have to perform more of such iterations than the number of columns
that we have. |
| 109 // such iterations than the number of columns that we have. | |
| 110 // | 109 // |
| 111 // For each layout iteration done for column balancing, the flow thread will nee
d a deep layout if | 110 // For each layout iteration done for column balancing, the flow thread will nee
d a deep layout if |
| 112 // column heights changed in the previous pass, since column height changes may
affect break points | 111 // column heights changed in the previous pass, since column height changes may
affect break points |
| 113 // and pagination struts anywhere in the tree, and currently no way exists to do
this in a more | 112 // and pagination struts anywhere in the tree, and currently no way exists to do
this in a more |
| 114 // optimized manner. | 113 // optimized manner. |
| 115 // | 114 // |
| 116 // There's also some documentation online: | 115 // There's also some documentation online: |
| 117 // https://sites.google.com/a/chromium.org/dev/developers/design-documents/multi
-column-layout | 116 // https://sites.google.com/a/chromium.org/dev/developers/design-documents/multi
-column-layout |
| 118 class CORE_EXPORT LayoutMultiColumnFlowThread : public LayoutFlowThread { | 117 class CORE_EXPORT LayoutMultiColumnFlowThread : public LayoutFlowThread { |
| 119 public: | 118 public: |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 220 | 219 |
| 221 void addColumnSetToThread(LayoutMultiColumnSet*) override; | 220 void addColumnSetToThread(LayoutMultiColumnSet*) override; |
| 222 void willBeRemovedFromTree() override; | 221 void willBeRemovedFromTree() override; |
| 223 void flowThreadDescendantWasInserted(LayoutObject*) final; | 222 void flowThreadDescendantWasInserted(LayoutObject*) final; |
| 224 void flowThreadDescendantWillBeRemoved(LayoutObject*) final; | 223 void flowThreadDescendantWillBeRemoved(LayoutObject*) final; |
| 225 void flowThreadDescendantStyleWillChange(LayoutBox*, StyleDifference, const
ComputedStyle& newStyle) override; | 224 void flowThreadDescendantStyleWillChange(LayoutBox*, StyleDifference, const
ComputedStyle& newStyle) override; |
| 226 void flowThreadDescendantStyleDidChange(LayoutBox*, StyleDifference, const C
omputedStyle& oldStyle) override; | 225 void flowThreadDescendantStyleDidChange(LayoutBox*, StyleDifference, const C
omputedStyle& oldStyle) override; |
| 227 void computePreferredLogicalWidths() override; | 226 void computePreferredLogicalWidths() override; |
| 228 void computeLogicalHeight(LayoutUnit logicalHeight, LayoutUnit logicalTop, L
ogicalExtentComputedValues&) const override; | 227 void computeLogicalHeight(LayoutUnit logicalHeight, LayoutUnit logicalTop, L
ogicalExtentComputedValues&) const override; |
| 229 void updateLogicalWidth() override; | 228 void updateLogicalWidth() override; |
| 230 void setPageBreak(LayoutUnit offset, LayoutUnit spaceShortage) override; | 229 void contentWasLaidOut(LayoutUnit logicalTopInFlowThreadAfterPagination) ove
rride; |
| 231 void updateMinimumPageHeight(LayoutUnit offset, LayoutUnit minHeight) overri
de; | 230 void updateMinimumPageHeight(LayoutUnit offset, LayoutUnit minHeight) overri
de; |
| 232 bool addForcedColumnBreak(LayoutUnit, LayoutObject* breakChild, bool isBefor
e, LayoutUnit* offsetBreakAdjustment = nullptr) override; | |
| 233 | 231 |
| 234 // The last set we worked on. It's not to be used as the "current set". The
concept of a | 232 // The last set we worked on. It's not to be used as the "current set". The
concept of a |
| 235 // "current set" is difficult, since layout may jump back and forth in the t
ree, due to wrong | 233 // "current set" is difficult, since layout may jump back and forth in the t
ree, due to wrong |
| 236 // top location estimates (due to e.g. margin collapsing), and possibly for
other reasons. | 234 // top location estimates (due to e.g. margin collapsing), and possibly for
other reasons. |
| 237 LayoutMultiColumnSet* m_lastSetWorkedOn; | 235 LayoutMultiColumnSet* m_lastSetWorkedOn; |
| 238 | 236 |
| 239 unsigned m_columnCount; // The used value of column-count | 237 unsigned m_columnCount; // The used value of column-count |
| 240 LayoutUnit m_columnHeightAvailable; // Total height available to columns, or
0 if auto. | 238 LayoutUnit m_columnHeightAvailable; // Total height available to columns, or
0 if auto. |
| 241 | 239 |
| 242 // Cached block offset from this flow thread to the enclosing flow thread, i
f any. In the | 240 // Cached block offset from this flow thread to the enclosing flow thread, i
f any. In the |
| 243 // coordinate space of the enclosing flow thread. | 241 // coordinate space of the enclosing flow thread. |
| 244 LayoutUnit m_blockOffsetInEnclosingFlowThread; | 242 LayoutUnit m_blockOffsetInEnclosingFlowThread; |
| 245 | 243 |
| 246 bool m_inBalancingPass; // Set when relayouting for column balancing. | 244 bool m_inBalancingPass; // Set when relayouting for column balancing. |
| 247 bool m_needsColumnHeightsRecalculation; // Set when we need to recalculate t
he column set heights after layout. | 245 bool m_needsColumnHeightsRecalculation; // Set when we need to recalculate t
he column set heights after layout. |
| 248 bool m_progressionIsInline; // Always true for regular multicol. False for p
aged-y overflow. | 246 bool m_progressionIsInline; // Always true for regular multicol. False for p
aged-y overflow. |
| 249 bool m_isBeingEvacuated; | 247 bool m_isBeingEvacuated; |
| 250 }; | 248 }; |
| 251 | 249 |
| 252 // Cannot use DEFINE_LAYOUT_OBJECT_TYPE_CASTS here, because isMultiColumnFlowThr
ead() is defined in | 250 // Cannot use DEFINE_LAYOUT_OBJECT_TYPE_CASTS here, because isMultiColumnFlowThr
ead() is defined in |
| 253 // LayoutFlowThread, not in LayoutObject. | 251 // LayoutFlowThread, not in LayoutObject. |
| 254 DEFINE_TYPE_CASTS(LayoutMultiColumnFlowThread, LayoutFlowThread, object, object-
>isLayoutMultiColumnFlowThread(), object.isLayoutMultiColumnFlowThread()); | 252 DEFINE_TYPE_CASTS(LayoutMultiColumnFlowThread, LayoutFlowThread, object, object-
>isLayoutMultiColumnFlowThread(), object.isLayoutMultiColumnFlowThread()); |
| 255 | 253 |
| 256 } // namespace blink | 254 } // namespace blink |
| 257 | 255 |
| 258 #endif // LayoutMultiColumnFlowThread_h | 256 #endif // LayoutMultiColumnFlowThread_h |
| OLD | NEW |