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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 | 81 |
82 LayoutUnit heightAdjustedForSetOffset(LayoutUnit height) const; | 82 LayoutUnit heightAdjustedForSetOffset(LayoutUnit height) const; |
83 | 83 |
84 void updateMinimumColumnHeight(LayoutUnit height) { m_minimumColumnHeight =
std::max(height, m_minimumColumnHeight); } | 84 void updateMinimumColumnHeight(LayoutUnit height) { m_minimumColumnHeight =
std::max(height, m_minimumColumnHeight); } |
85 LayoutUnit minimumColumnHeight() const { return m_minimumColumnHeight; } | 85 LayoutUnit minimumColumnHeight() const { return m_minimumColumnHeight; } |
86 | 86 |
87 unsigned forcedBreaksCount() const { return m_contentRuns.size(); } | 87 unsigned forcedBreaksCount() const { return m_contentRuns.size(); } |
88 void clearForcedBreaks(); | 88 void clearForcedBreaks(); |
89 void addForcedBreak(LayoutUnit offsetFromFirstPage); | 89 void addForcedBreak(LayoutUnit offsetFromFirstPage); |
90 | 90 |
91 // (Re-)calculate the column height when contents are supposed to be balance
d. If 'initial' is | 91 // (Re-)calculate the column height if it's auto. If 'initial' is set, guess
an initial column |
92 // set, guess an initial column height; otherwise, stretch the column height
a tad. Return true | 92 // height; otherwise, stretch the column height a tad. Return true if column
height changed and |
93 // if column height changed and another layout pass is required. | 93 // another layout pass is required. |
94 bool recalculateBalancedHeight(bool initial); | 94 bool recalculateColumnHeight(bool initial); |
95 | 95 |
96 // Record space shortage (the amount of space that would have been enough to
prevent some | 96 // Record space shortage (the amount of space that would have been enough to
prevent some |
97 // element from being moved to the next column) at a column break. The small
est amount of space | 97 // element from being moved to the next column) at a column break. The small
est amount of space |
98 // shortage we find is the amount with which we will stretch the column heig
ht, if it turns out | 98 // shortage we find is the amount with which we will stretch the column heig
ht, if it turns out |
99 // after layout that the columns weren't tall enough. | 99 // after layout that the columns weren't tall enough. |
100 void recordSpaceShortage(LayoutUnit spaceShortage); | 100 void recordSpaceShortage(LayoutUnit spaceShortage); |
101 | 101 |
102 virtual void updateLogicalWidth() OVERRIDE; | 102 virtual void updateLogicalWidth() OVERRIDE; |
103 | 103 |
104 void prepareForLayout(); | 104 void prepareForLayout(); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 | 143 |
144 // Return the index of the content run with the currently tallest columns, t
aking all implicit | 144 // Return the index of the content run with the currently tallest columns, t
aking all implicit |
145 // breaks assumed so far into account. | 145 // breaks assumed so far into account. |
146 unsigned findRunWithTallestColumns() const; | 146 unsigned findRunWithTallestColumns() const; |
147 | 147 |
148 // Given the current list of content runs, make assumptions about where we n
eed to insert | 148 // Given the current list of content runs, make assumptions about where we n
eed to insert |
149 // implicit breaks (if there's room for any at all; depending on the number
of explicit breaks), | 149 // implicit breaks (if there's room for any at all; depending on the number
of explicit breaks), |
150 // and store the results. This is needed in order to balance the columns. | 150 // and store the results. This is needed in order to balance the columns. |
151 void distributeImplicitBreaks(); | 151 void distributeImplicitBreaks(); |
152 | 152 |
153 LayoutUnit calculateBalancedHeight(bool initial) const; | 153 LayoutUnit calculateColumnHeight(bool initial) const; |
154 | 154 |
155 unsigned m_computedColumnCount; // Used column count (the resulting 'N' from
the pseudo-algorithm in the multicol spec) | 155 unsigned m_computedColumnCount; // Used column count (the resulting 'N' from
the pseudo-algorithm in the multicol spec) |
156 LayoutUnit m_computedColumnWidth; // Used column width (the resulting 'W' fr
om the pseudo-algorithm in the multicol spec) | 156 LayoutUnit m_computedColumnWidth; // Used column width (the resulting 'W' fr
om the pseudo-algorithm in the multicol spec) |
157 LayoutUnit m_computedColumnHeight; | 157 LayoutUnit m_computedColumnHeight; |
158 | 158 |
159 // The following variables are used when balancing the column set. | 159 // The following variables are used when balancing the column set. |
160 LayoutUnit m_maxColumnHeight; // Maximum column height allowed. | 160 LayoutUnit m_maxColumnHeight; // Maximum column height allowed. |
161 LayoutUnit m_minSpaceShortage; // The smallest amout of space shortage that
caused a column break. | 161 LayoutUnit m_minSpaceShortage; // The smallest amout of space shortage that
caused a column break. |
162 LayoutUnit m_minimumColumnHeight; | 162 LayoutUnit m_minimumColumnHeight; |
163 | 163 |
(...skipping 24 matching lines...) Expand all Loading... |
188 }; | 188 }; |
189 Vector<ContentRun, 1> m_contentRuns; | 189 Vector<ContentRun, 1> m_contentRuns; |
190 }; | 190 }; |
191 | 191 |
192 DEFINE_RENDER_OBJECT_TYPE_CASTS(RenderMultiColumnSet, isRenderMultiColumnSet()); | 192 DEFINE_RENDER_OBJECT_TYPE_CASTS(RenderMultiColumnSet, isRenderMultiColumnSet()); |
193 | 193 |
194 } // namespace WebCore | 194 } // namespace WebCore |
195 | 195 |
196 #endif // RenderMultiColumnSet_h | 196 #endif // RenderMultiColumnSet_h |
197 | 197 |
OLD | NEW |