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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 // RenderMultiColumnSet::recordSpaceShortage()). We'll relayout (to find new bre
ak points and the | 77 // RenderMultiColumnSet::recordSpaceShortage()). We'll relayout (to find new bre
ak points and the |
78 // new lowest amount of space increase that could affect where they occur, in ca
se we need another | 78 // new lowest amount of space increase that could affect where they occur, in ca
se we need another |
79 // round) until we've reached an acceptable height (where everything fits perfec
tly in the number of | 79 // round) until we've reached an acceptable height (where everything fits perfec
tly in the number of |
80 // columns that we have specified). The rule of thumb is that we shouldn't have
to perform more of | 80 // columns that we have specified). The rule of thumb is that we shouldn't have
to perform more of |
81 // such iterations than the number of columns that we have. | 81 // such iterations than the number of columns that we have. |
82 // | 82 // |
83 // For each layout iteration done for column balancing, the flow thread will nee
d a deep layout if | 83 // For each layout iteration done for column balancing, the flow thread will nee
d a deep layout if |
84 // column heights changed in the previous pass, since column height changes may
affect break points | 84 // column heights changed in the previous pass, since column height changes may
affect break points |
85 // and pagination struts anywhere in the tree, and currently no way exists to do
this in a more | 85 // and pagination struts anywhere in the tree, and currently no way exists to do
this in a more |
86 // optimized manner. | 86 // optimized manner. |
87 class RenderMultiColumnFlowThread FINAL : public RenderFlowThread { | 87 class RenderMultiColumnFlowThread : public RenderFlowThread { |
88 public: | 88 public: |
89 virtual ~RenderMultiColumnFlowThread(); | 89 virtual ~RenderMultiColumnFlowThread(); |
90 | 90 |
91 static RenderMultiColumnFlowThread* createAnonymous(Document&, RenderStyle*
parentStyle); | 91 static RenderMultiColumnFlowThread* createAnonymous(Document&, RenderStyle*
parentStyle); |
92 | 92 |
93 virtual bool isRenderMultiColumnFlowThread() const OVERRIDE FINAL { return t
rue; } | 93 virtual bool isRenderMultiColumnFlowThread() const OVERRIDE FINAL { return t
rue; } |
94 | 94 |
95 RenderBlockFlow* multiColumnBlockFlow() const { return toRenderBlockFlow(par
ent()); } | 95 RenderBlockFlow* multiColumnBlockFlow() const { return toRenderBlockFlow(par
ent()); } |
96 | 96 |
97 RenderMultiColumnSet* firstMultiColumnSet() const; | 97 RenderMultiColumnSet* firstMultiColumnSet() const; |
98 RenderMultiColumnSet* lastMultiColumnSet() const; | 98 RenderMultiColumnSet* lastMultiColumnSet() const; |
99 | 99 |
100 virtual void addChild(RenderObject* newChild, RenderObject* beforeChild = 0)
OVERRIDE; | 100 virtual void addChild(RenderObject* newChild, RenderObject* beforeChild = 0)
OVERRIDE; |
101 | 101 |
102 // Populate the flow thread with what's currently its siblings. Called when
a regular block | 102 // Populate the flow thread with what's currently its siblings. Called when
a regular block |
103 // becomes a multicol container. | 103 // becomes a multicol container. |
104 void populate(); | 104 void populate(); |
105 | 105 |
106 // Empty the flow thread by moving everything to the parent. Remove all mult
icol specific | 106 // Empty the flow thread by moving everything to the parent. Remove all mult
icol specific |
107 // renderers. Then destroy the flow thread. Called when a multicol container
becomes a regular | 107 // renderers. Then destroy the flow thread. Called when a multicol container
becomes a regular |
108 // block. | 108 // block. |
109 void evacuateAndDestroy(); | 109 void evacuateAndDestroy(); |
110 | 110 |
111 unsigned columnCount() const { return m_columnCount; } | 111 unsigned columnCount() const { return m_columnCount; } |
112 LayoutUnit columnHeightAvailable() const { return m_columnHeightAvailable; } | 112 LayoutUnit columnHeightAvailable() const { return m_columnHeightAvailable; } |
113 void setColumnHeightAvailable(LayoutUnit available) { m_columnHeightAvailabl
e = available; } | 113 void setColumnHeightAvailable(LayoutUnit available) { m_columnHeightAvailabl
e = available; } |
114 bool requiresBalancing() const { return !columnHeightAvailable() || multiCol
umnBlockFlow()->style()->columnFill() == ColumnFillBalance; } | 114 virtual bool heightIsAuto() const { return !columnHeightAvailable() || multi
ColumnBlockFlow()->style()->columnFill() == ColumnFillBalance; } |
| 115 bool progressionIsInline() const { return m_progressionIsInline; } |
115 | 116 |
116 virtual LayoutSize columnOffset(const LayoutPoint&) const OVERRIDE FINAL; | 117 virtual LayoutSize columnOffset(const LayoutPoint&) const OVERRIDE FINAL; |
117 | 118 |
118 // Do we need to set a new width and lay out? | 119 // Do we need to set a new width and lay out? |
119 bool needsNewWidth() const; | 120 virtual bool needsNewWidth() const; |
120 | 121 |
121 void layoutColumns(bool relayoutChildren, SubtreeLayoutScope&); | 122 void layoutColumns(bool relayoutChildren, SubtreeLayoutScope&); |
122 | 123 |
123 bool recalculateColumnHeights(); | 124 bool recalculateColumnHeights(); |
124 | 125 |
| 126 protected: |
| 127 RenderMultiColumnFlowThread(); |
| 128 void setProgressionIsInline(bool isInline) { m_progressionIsInline = isInlin
e; } |
| 129 |
| 130 virtual void layout() OVERRIDE; |
| 131 |
125 private: | 132 private: |
126 RenderMultiColumnFlowThread(); | |
127 | |
128 void calculateColumnCountAndWidth(LayoutUnit& width, unsigned& count) const; | 133 void calculateColumnCountAndWidth(LayoutUnit& width, unsigned& count) const; |
129 | 134 |
130 virtual const char* renderName() const OVERRIDE; | 135 virtual const char* renderName() const OVERRIDE; |
131 virtual void addRegionToThread(RenderMultiColumnSet*) OVERRIDE; | 136 virtual void addRegionToThread(RenderMultiColumnSet*) OVERRIDE; |
132 virtual void willBeRemovedFromTree() OVERRIDE; | 137 virtual void willBeRemovedFromTree() OVERRIDE; |
133 virtual void computeLogicalHeight(LayoutUnit logicalHeight, LayoutUnit logic
alTop, LogicalExtentComputedValues&) const OVERRIDE; | 138 virtual void computeLogicalHeight(LayoutUnit logicalHeight, LayoutUnit logic
alTop, LogicalExtentComputedValues&) const OVERRIDE; |
134 virtual void updateLogicalWidth() OVERRIDE FINAL; | 139 virtual void updateLogicalWidth() OVERRIDE; |
135 virtual void layout() OVERRIDE FINAL; | |
136 virtual void setPageBreak(LayoutUnit offset, LayoutUnit spaceShortage) OVERR
IDE; | 140 virtual void setPageBreak(LayoutUnit offset, LayoutUnit spaceShortage) OVERR
IDE; |
137 virtual void updateMinimumPageHeight(LayoutUnit offset, LayoutUnit minHeight
) OVERRIDE; | 141 virtual void updateMinimumPageHeight(LayoutUnit offset, LayoutUnit minHeight
) OVERRIDE; |
138 virtual RenderMultiColumnSet* columnSetAtBlockOffset(LayoutUnit) const OVERR
IDE; | 142 virtual RenderMultiColumnSet* columnSetAtBlockOffset(LayoutUnit) const OVERR
IDE; |
139 virtual bool addForcedRegionBreak(LayoutUnit, RenderObject* breakChild, bool
isBefore, LayoutUnit* offsetBreakAdjustment = 0) OVERRIDE; | 143 virtual bool addForcedRegionBreak(LayoutUnit, RenderObject* breakChild, bool
isBefore, LayoutUnit* offsetBreakAdjustment = 0) OVERRIDE; |
140 virtual bool isPageLogicalHeightKnown() const OVERRIDE; | 144 virtual bool isPageLogicalHeightKnown() const OVERRIDE; |
141 | 145 |
142 unsigned m_columnCount; // The used value of column-count | 146 unsigned m_columnCount; // The used value of column-count |
143 LayoutUnit m_columnHeightAvailable; // Total height available to columns, or
0 if auto. | 147 LayoutUnit m_columnHeightAvailable; // Total height available to columns, or
0 if auto. |
144 bool m_inBalancingPass; // Set when relayouting for column balancing. | 148 bool m_inBalancingPass; // Set when relayouting for column balancing. |
145 bool m_needsColumnHeightsRecalculation; // Set when we need to recalculate t
he column set heights after layout. | 149 bool m_needsColumnHeightsRecalculation; // Set when we need to recalculate t
he column set heights after layout. |
| 150 bool m_progressionIsInline; // Always true for regular multicol. False for p
aged-y overflow. |
146 }; | 151 }; |
147 | 152 |
148 } // namespace WebCore | 153 } // namespace WebCore |
149 | 154 |
150 #endif // RenderMultiColumnFlowThread_h | 155 #endif // RenderMultiColumnFlowThread_h |
151 | 156 |
OLD | NEW |