Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(236)

Side by Side Diff: third_party/WebKit/Source/core/layout/MultiColumnFragmentainerGroup.h

Issue 2874933005: Distinguish between row (fragmentainer group) height and column (fragmentainer) height. (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef MultiColumnFragmentainerGroup_h 5 #ifndef MultiColumnFragmentainerGroup_h
6 #define MultiColumnFragmentainerGroup_h 6 #define MultiColumnFragmentainerGroup_h
7 7
8 #include "core/layout/LayoutMultiColumnFlowThread.h" 8 #include "core/layout/LayoutMultiColumnFlowThread.h"
9 #include "platform/wtf/Allocator.h" 9 #include "platform/wtf/Allocator.h"
10 10
(...skipping 26 matching lines...) Expand all
37 37
38 const LayoutMultiColumnSet& ColumnSet() const { return column_set_; } 38 const LayoutMultiColumnSet& ColumnSet() const { return column_set_; }
39 39
40 bool IsFirstGroup() const; 40 bool IsFirstGroup() const;
41 bool IsLastGroup() const; 41 bool IsLastGroup() const;
42 42
43 // Position within the LayoutMultiColumnSet. 43 // Position within the LayoutMultiColumnSet.
44 LayoutUnit LogicalTop() const { return logical_top_; } 44 LayoutUnit LogicalTop() const { return logical_top_; }
45 void SetLogicalTop(LayoutUnit logical_top) { logical_top_ = logical_top; } 45 void SetLogicalTop(LayoutUnit logical_top) { logical_top_ = logical_top; }
46 46
47 LayoutUnit LogicalHeight() const { return column_height_; } 47 // Return the amount of block space that this fragmentainer group takes up in
48 // its containing LayoutMultiColumnSet.
49 LayoutUnit GroupLogicalHeight() const { return logical_height_; }
50
51 // Return the block size of a column (or fragmentainer) in this fragmentainer
52 // group. The spec says that this value must always be >= 1px, to ensure
eae 2017/05/12 16:31:21 These comments are great! Thank you.
53 // progress.
54 LayoutUnit ColumnLogicalHeight() const {
55 // If the height hasn't been calculated yet, though, we allow returning 0
56 // (and the caller is then expected to refrain from attempting to fragment).
57 if (!logical_height_)
58 return logical_height_;
59
60 return std::max(LayoutUnit(1), logical_height_);
61 }
48 62
49 LayoutSize OffsetFromColumnSet() const; 63 LayoutSize OffsetFromColumnSet() const;
50 64
51 // Return the block offset from the enclosing fragmentation context, if 65 // Return the block offset from the enclosing fragmentation context, if
52 // nested. In the coordinate space of the enclosing fragmentation context. 66 // nested. In the coordinate space of the enclosing fragmentation context.
53 LayoutUnit BlockOffsetInEnclosingFragmentationContext() const; 67 LayoutUnit BlockOffsetInEnclosingFragmentationContext() const;
54 68
55 // The top of our flow thread portion 69 // The top of our flow thread portion
56 LayoutUnit LogicalTopInFlowThread() const { 70 LayoutUnit LogicalTopInFlowThread() const {
57 return logical_top_in_flow_thread_; 71 return logical_top_in_flow_thread_;
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 163
150 private: 164 private:
151 LayoutUnit HeightAdjustedForRowOffset(LayoutUnit height) const; 165 LayoutUnit HeightAdjustedForRowOffset(LayoutUnit height) const;
152 LayoutUnit CalculateMaxColumnHeight() const; 166 LayoutUnit CalculateMaxColumnHeight() const;
153 void SetAndConstrainColumnHeight(LayoutUnit); 167 void SetAndConstrainColumnHeight(LayoutUnit);
154 168
155 LayoutUnit RebalanceColumnHeightIfNeeded() const; 169 LayoutUnit RebalanceColumnHeightIfNeeded() const;
156 170
157 LayoutRect ColumnRectAt(unsigned column_index) const; 171 LayoutRect ColumnRectAt(unsigned column_index) const;
158 LayoutUnit LogicalTopInFlowThreadAt(unsigned column_index) const { 172 LayoutUnit LogicalTopInFlowThreadAt(unsigned column_index) const {
159 return logical_top_in_flow_thread_ + column_index * column_height_; 173 return logical_top_in_flow_thread_ + column_index * ColumnLogicalHeight();
160 } 174 }
161 175
162 // Return the column that the specified visual point belongs to. Only the 176 // Return the column that the specified visual point belongs to. Only the
163 // coordinate on the column progression axis is relevant. Every point belongs 177 // coordinate on the column progression axis is relevant. Every point belongs
164 // to a column, even if said point is not inside any of the columns. 178 // to a column, even if said point is not inside any of the columns.
165 unsigned ColumnIndexAtVisualPoint(const LayoutPoint& visual_point) const; 179 unsigned ColumnIndexAtVisualPoint(const LayoutPoint& visual_point) const;
166 180
167 const LayoutMultiColumnSet& column_set_; 181 const LayoutMultiColumnSet& column_set_;
168 182
169 LayoutUnit logical_top_; 183 LayoutUnit logical_top_;
170 LayoutUnit logical_top_in_flow_thread_; 184 LayoutUnit logical_top_in_flow_thread_;
171 LayoutUnit logical_bottom_in_flow_thread_; 185 LayoutUnit logical_bottom_in_flow_thread_;
172 186
173 LayoutUnit column_height_; 187 // Logical height of the group. This will also be the height of each column
188 // in this group, with the difference that, while the logical height can be
189 // 0, the height of a column must be >= 1px.
190 LayoutUnit logical_height_;
174 191
175 LayoutUnit max_column_height_; // Maximum column height allowed. 192 // Maximum logical height allowed.
193 LayoutUnit max_logical_height_;
176 }; 194 };
177 195
178 // List of all fragmentainer groups within a column set. There will always be at 196 // List of all fragmentainer groups within a column set. There will always be at
179 // least one group. Deleting the one group is not allowed (or possible). There 197 // least one group. Deleting the one group is not allowed (or possible). There
180 // will be more than one group if the owning column set lives in multiple outer 198 // will be more than one group if the owning column set lives in multiple outer
181 // fragmentainers (e.g. multicol inside paged media). 199 // fragmentainers (e.g. multicol inside paged media).
182 class CORE_EXPORT MultiColumnFragmentainerGroupList { 200 class CORE_EXPORT MultiColumnFragmentainerGroupList {
183 DISALLOW_NEW(); 201 DISALLOW_NEW();
184 202
185 public: 203 public:
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 238
221 private: 239 private:
222 LayoutMultiColumnSet& column_set_; 240 LayoutMultiColumnSet& column_set_;
223 241
224 Vector<MultiColumnFragmentainerGroup, 1> groups_; 242 Vector<MultiColumnFragmentainerGroup, 1> groups_;
225 }; 243 };
226 244
227 } // namespace blink 245 } // namespace blink
228 246
229 #endif // MultiColumnFragmentainerGroup_h 247 #endif // MultiColumnFragmentainerGroup_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698