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

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

Issue 2403553002: reflow comments in core/layout/[M-Z]*.{cpp,h} (Closed)
Patch Set: Created 4 years, 2 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 "wtf/Allocator.h" 9 #include "wtf/Allocator.h"
10 10
11 namespace blink { 11 namespace blink {
12 12
13 // A group of columns, that are laid out in the inline progression direction, al l with the same 13 // A group of columns, that are laid out in the inline progression direction,
14 // column height. 14 // all with the same column height.
15 // 15 //
16 // When a multicol container is inside another fragmentation context, and said m ulticol container 16 // When a multicol container is inside another fragmentation context, and said
17 // lives in multiple outer fragmentainers (pages / columns), we need to put thes e inner columns into 17 // multicol container lives in multiple outer fragmentainers (pages / columns),
18 // separate groups, with one group per outer fragmentainer. Such a group of colu mns is what 18 // we need to put these inner columns into separate groups, with one group per
19 // comprises a "row of column boxes" in spec lingo. 19 // outer fragmentainer. Such a group of columns is what comprises a "row of
20 // column boxes" in spec lingo.
20 // 21 //
21 // Column balancing, when enabled, takes place within a column fragmentainer gro up. 22 // Column balancing, when enabled, takes place within a column fragmentainer
23 // group.
22 // 24 //
23 // Each fragmentainer group may have its own actual column count (if there are u nused columns 25 // Each fragmentainer group may have its own actual column count (if there are
24 // because of forced breaks, for example). If there are multiple fragmentainer g roups, the actual 26 // unused columns because of forced breaks, for example). If there are multiple
25 // column count must not exceed the used column count (the one calculated based on column-count and 27 // fragmentainer groups, the actual column count must not exceed the used column
26 // column-width from CSS), or they'd overflow the outer fragmentainer in the inl ine direction. If we 28 // count (the one calculated based on column-count and column-width from CSS),
27 // need more columns than what a group has room for, we'll create another group and put them there 29 // or they'd overflow the outer fragmentainer in the inline direction. If we
28 // (and make them appear in the next outer fragmentainer). 30 // need more columns than what a group has room for, we'll create another group
31 // and put them there (and make them appear in the next outer fragmentainer).
29 class MultiColumnFragmentainerGroup { 32 class MultiColumnFragmentainerGroup {
30 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW(); 33 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW();
31 34
32 public: 35 public:
33 MultiColumnFragmentainerGroup(const LayoutMultiColumnSet&); 36 MultiColumnFragmentainerGroup(const LayoutMultiColumnSet&);
34 37
35 const LayoutMultiColumnSet& columnSet() const { return m_columnSet; } 38 const LayoutMultiColumnSet& columnSet() const { return m_columnSet; }
36 39
37 bool isFirstGroup() const; 40 bool isFirstGroup() const;
38 bool isLastGroup() const; 41 bool isLastGroup() const;
39 42
40 // Position within the LayoutMultiColumnSet. 43 // Position within the LayoutMultiColumnSet.
41 LayoutUnit logicalTop() const { return m_logicalTop; } 44 LayoutUnit logicalTop() const { return m_logicalTop; }
42 void setLogicalTop(LayoutUnit logicalTop) { m_logicalTop = logicalTop; } 45 void setLogicalTop(LayoutUnit logicalTop) { m_logicalTop = logicalTop; }
43 46
44 LayoutUnit logicalHeight() const { return m_columnHeight; } 47 LayoutUnit logicalHeight() const { return m_columnHeight; }
45 48
46 LayoutSize offsetFromColumnSet() const; 49 LayoutSize offsetFromColumnSet() const;
47 50
48 // Return the block offset from the enclosing fragmentation context, if nested . In the 51 // Return the block offset from the enclosing fragmentation context, if
49 // coordinate space of the enclosing fragmentation context. 52 // nested. In the coordinate space of the enclosing fragmentation context.
50 LayoutUnit blockOffsetInEnclosingFragmentationContext() const; 53 LayoutUnit blockOffsetInEnclosingFragmentationContext() const;
51 54
52 // The top of our flow thread portion 55 // The top of our flow thread portion
53 LayoutUnit logicalTopInFlowThread() const { return m_logicalTopInFlowThread; } 56 LayoutUnit logicalTopInFlowThread() const { return m_logicalTopInFlowThread; }
54 void setLogicalTopInFlowThread(LayoutUnit logicalTopInFlowThread) { 57 void setLogicalTopInFlowThread(LayoutUnit logicalTopInFlowThread) {
55 m_logicalTopInFlowThread = logicalTopInFlowThread; 58 m_logicalTopInFlowThread = logicalTopInFlowThread;
56 } 59 }
57 60
58 // The bottom of our flow thread portion 61 // The bottom of our flow thread portion
59 LayoutUnit logicalBottomInFlowThread() const { 62 LayoutUnit logicalBottomInFlowThread() const {
(...skipping 25 matching lines...) Expand all
85 LayoutRect flowThreadPortionOverflowRectAt(unsigned columnIndex) const; 88 LayoutRect flowThreadPortionOverflowRectAt(unsigned columnIndex) const;
86 89
87 // Get the first and the last column intersecting the specified block range. 90 // Get the first and the last column intersecting the specified block range.
88 // Note that |logicalBottomInFlowThread| is an exclusive endpoint. 91 // Note that |logicalBottomInFlowThread| is an exclusive endpoint.
89 void columnIntervalForBlockRangeInFlowThread( 92 void columnIntervalForBlockRangeInFlowThread(
90 LayoutUnit logicalTopInFlowThread, 93 LayoutUnit logicalTopInFlowThread,
91 LayoutUnit logicalBottomInFlowThread, 94 LayoutUnit logicalBottomInFlowThread,
92 unsigned& firstColumn, 95 unsigned& firstColumn,
93 unsigned& lastColumn) const; 96 unsigned& lastColumn) const;
94 97
95 // Get the first and the last column intersecting the specified visual rectang le. 98 // Get the first and the last column intersecting the specified visual
99 // rectangle.
96 void columnIntervalForVisualRect(const LayoutRect&, 100 void columnIntervalForVisualRect(const LayoutRect&,
97 unsigned& firstColumn, 101 unsigned& firstColumn,
98 unsigned& lastColumn) const; 102 unsigned& lastColumn) const;
99 103
100 LayoutRect calculateOverflow() const; 104 LayoutRect calculateOverflow() const;
101 105
102 unsigned columnIndexAtOffset(LayoutUnit offsetInFlowThread, 106 unsigned columnIndexAtOffset(LayoutUnit offsetInFlowThread,
103 LayoutBox::PageBoundaryRule) const; 107 LayoutBox::PageBoundaryRule) const;
104 108
105 // The "CSS actual" value of column-count. This includes overflowing columns, if any. 109 // The "CSS actual" value of column-count. This includes overflowing columns,
110 // if any.
106 // Returns 1 or greater, never 0. 111 // Returns 1 or greater, never 0.
107 unsigned actualColumnCount() const; 112 unsigned actualColumnCount() const;
108 113
109 private: 114 private:
110 LayoutUnit heightAdjustedForRowOffset(LayoutUnit height) const; 115 LayoutUnit heightAdjustedForRowOffset(LayoutUnit height) const;
111 LayoutUnit calculateMaxColumnHeight() const; 116 LayoutUnit calculateMaxColumnHeight() const;
112 void setAndConstrainColumnHeight(LayoutUnit); 117 void setAndConstrainColumnHeight(LayoutUnit);
113 118
114 LayoutUnit rebalanceColumnHeightIfNeeded() const; 119 LayoutUnit rebalanceColumnHeightIfNeeded() const;
115 120
116 LayoutRect columnRectAt(unsigned columnIndex) const; 121 LayoutRect columnRectAt(unsigned columnIndex) const;
117 LayoutUnit logicalTopInFlowThreadAt(unsigned columnIndex) const { 122 LayoutUnit logicalTopInFlowThreadAt(unsigned columnIndex) const {
118 return m_logicalTopInFlowThread + columnIndex * m_columnHeight; 123 return m_logicalTopInFlowThread + columnIndex * m_columnHeight;
119 } 124 }
120 125
121 // Return the column that the specified visual point belongs to. Only the coor dinate on the 126 // Return the column that the specified visual point belongs to. Only the
122 // column progression axis is relevant. Every point belongs to a column, even if said point is 127 // coordinate on the column progression axis is relevant. Every point belongs
123 // not inside any of the columns. 128 // to a column, even if said point is not inside any of the columns.
124 unsigned columnIndexAtVisualPoint(const LayoutPoint& visualPoint) const; 129 unsigned columnIndexAtVisualPoint(const LayoutPoint& visualPoint) const;
125 130
126 const LayoutMultiColumnSet& m_columnSet; 131 const LayoutMultiColumnSet& m_columnSet;
127 132
128 LayoutUnit m_logicalTop; 133 LayoutUnit m_logicalTop;
129 LayoutUnit m_logicalTopInFlowThread; 134 LayoutUnit m_logicalTopInFlowThread;
130 LayoutUnit m_logicalBottomInFlowThread; 135 LayoutUnit m_logicalBottomInFlowThread;
131 136
132 LayoutUnit m_columnHeight; 137 LayoutUnit m_columnHeight;
133 138
134 LayoutUnit m_maxColumnHeight; // Maximum column height allowed. 139 LayoutUnit m_maxColumnHeight; // Maximum column height allowed.
135 }; 140 };
136 141
137 // List of all fragmentainer groups within a column set. There will always be at least one 142 // List of all fragmentainer groups within a column set. There will always be at
138 // group. Deleting the one group is not allowed (or possible). There will be mor e than one group if 143 // least one group. Deleting the one group is not allowed (or possible). There
139 // the owning column set lives in multiple outer fragmentainers (e.g. multicol i nside paged media). 144 // will be more than one group if the owning column set lives in multiple outer
145 // fragmentainers (e.g. multicol inside paged media).
140 class CORE_EXPORT MultiColumnFragmentainerGroupList { 146 class CORE_EXPORT MultiColumnFragmentainerGroupList {
141 DISALLOW_NEW(); 147 DISALLOW_NEW();
142 148
143 public: 149 public:
144 MultiColumnFragmentainerGroupList(LayoutMultiColumnSet&); 150 MultiColumnFragmentainerGroupList(LayoutMultiColumnSet&);
145 ~MultiColumnFragmentainerGroupList(); 151 ~MultiColumnFragmentainerGroupList();
146 152
147 // Add an additional fragmentainer group to the end of the list, and return it . 153 // Add an additional fragmentainer group to the end of the list, and return
154 // it.
148 MultiColumnFragmentainerGroup& addExtraGroup(); 155 MultiColumnFragmentainerGroup& addExtraGroup();
149 156
150 // Remove all fragmentainer groups but the first one. 157 // Remove all fragmentainer groups but the first one.
151 void deleteExtraGroups(); 158 void deleteExtraGroups();
152 159
153 MultiColumnFragmentainerGroup& first() { return m_groups.first(); } 160 MultiColumnFragmentainerGroup& first() { return m_groups.first(); }
154 const MultiColumnFragmentainerGroup& first() const { 161 const MultiColumnFragmentainerGroup& first() const {
155 return m_groups.first(); 162 return m_groups.first();
156 } 163 }
157 MultiColumnFragmentainerGroup& last() { return m_groups.last(); } 164 MultiColumnFragmentainerGroup& last() { return m_groups.last(); }
(...skipping 21 matching lines...) Expand all
179 186
180 private: 187 private:
181 LayoutMultiColumnSet& m_columnSet; 188 LayoutMultiColumnSet& m_columnSet;
182 189
183 Vector<MultiColumnFragmentainerGroup, 1> m_groups; 190 Vector<MultiColumnFragmentainerGroup, 1> m_groups;
184 }; 191 };
185 192
186 } // namespace blink 193 } // namespace blink
187 194
188 #endif // MultiColumnFragmentainerGroup_h 195 #endif // MultiColumnFragmentainerGroup_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698