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

Side by Side Diff: Source/core/rendering/RenderMultiColumnFlowThread.h

Issue 869583002: [New Multicolumn] Support dynamic insertion and removal of multicol content. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: code review Created 5 years, 11 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 /* 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 // make sure that the columns are painted and hit-tested correctly. 53 // make sure that the columns are painted and hit-tested correctly.
54 // 54 //
55 // If there is any column content inside the multicol container, we create a 55 // If there is any column content inside the multicol container, we create a
56 // RenderMultiColumnSet. We only need to create multiple sets if there are spann ers 56 // RenderMultiColumnSet. We only need to create multiple sets if there are spann ers
57 // (column-span:all) in the multicol container. When a spanner is inserted, cont ent preceding it 57 // (column-span:all) in the multicol container. When a spanner is inserted, cont ent preceding it
58 // gets its own set, and content succeeding it will get another set. The spanner itself will also 58 // gets its own set, and content succeeding it will get another set. The spanner itself will also
59 // get its own placeholder between the sets (RenderMultiColumnSpannerPlaceholder ), so that it gets 59 // get its own placeholder between the sets (RenderMultiColumnSpannerPlaceholder ), so that it gets
60 // positioned and sized correctly. The column-span:all element is inside the flo w thread, but its 60 // positioned and sized correctly. The column-span:all element is inside the flo w thread, but its
61 // containing block is the multicol container. 61 // containing block is the multicol container.
62 // 62 //
63 // Some invariants for the render tree structure for multicol:
64 // - A multicol container is always a RenderBlockFlow
65 // - Every multicol container has one and only one RenderMultiColumnFlowThread
66 // - All multicol DOM children and pseudo-elements associated with the multicol container are
67 // reparented into the flow thread
68 // - The RenderMultiColumnFlowThread is the first child of the multicol containe r
69 // - A multicol container may only have RenderMultiColumnFlowThread, RenderMulti ColumnSet and
70 // RenderMultiColumnSpannerPlaceholder children
71 // - A RenderMultiColumnSet may not be adjacent to another RenderMultiColumnSet; there are no
72 // use-cases for it, and there are also implementation limitations behind this requirement.
73 // - The flow thread is not in the containing block chain for children that are not to be laid out
74 // in columns. This means column spanners and absolutely positioned children w hose containing
75 // block is outside column content
76 // - Each spanner (column-span:all) establishes a RenderMultiColumnSpannerPlaceh older
77 //
63 // The width of the flow thread is the same as the column width. The width of a column set is the 78 // The width of the flow thread is the same as the column width. The width of a column set is the
64 // same as the content box width of the multicol container; in other words exact ly enough to hold 79 // same as the content box width of the multicol container; in other words exact ly enough to hold
65 // the number of columns to be used, stacked horizontally, plus column gaps betw een them. 80 // the number of columns to be used, stacked horizontally, plus column gaps betw een them.
66 // 81 //
67 // Since it's the first child of the multicol container, the flow thread is laid out first, albeit 82 // Since it's the first child of the multicol container, the flow thread is laid out first, albeit
68 // in a slightly special way, since it's not to take up any space in its ancesto rs. Afterwards, the 83 // in a slightly special way, since it's not to take up any space in its ancesto rs. Afterwards, the
69 // column sets are laid out. Column sets get their height from the columns that they hold. In single 84 // column sets are laid out. Column sets get their height from the columns that they hold. In single
70 // column-row constrained height non-balancing cases without spanners this will simply be the same 85 // column-row constrained height non-balancing cases without spanners this will simply be the same
71 // as the content height of the multicol container itself. In most other cases w e'll have to 86 // as the content height of the multicol container itself. In most other cases w e'll have to
72 // calculate optimal column heights ourselves, though. This process is referred to as column 87 // calculate optimal column heights ourselves, though. This process is referred to as column
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 void columnRuleStyleDidChange(); 174 void columnRuleStyleDidChange();
160 175
161 protected: 176 protected:
162 RenderMultiColumnFlowThread(); 177 RenderMultiColumnFlowThread();
163 void setProgressionIsInline(bool isInline) { m_progressionIsInline = isInlin e; } 178 void setProgressionIsInline(bool isInline) { m_progressionIsInline = isInlin e; }
164 179
165 virtual void layout() override; 180 virtual void layout() override;
166 181
167 private: 182 private:
168 void calculateColumnCountAndWidth(LayoutUnit& width, unsigned& count) const; 183 void calculateColumnCountAndWidth(LayoutUnit& width, unsigned& count) const;
169 void createAndInsertMultiColumnSet(); 184 void createAndInsertMultiColumnSet(RenderBox* insertBefore = 0);
170 void createAndInsertSpannerPlaceholder(RenderBox* spanner); 185 void createAndInsertSpannerPlaceholder(RenderBox* spanner, RenderBox* insert Before = 0);
171 virtual bool descendantIsValidColumnSpanner(RenderObject* descendant) const; 186 virtual bool descendantIsValidColumnSpanner(RenderObject* descendant) const;
172 187
173 virtual const char* renderName() const override; 188 virtual const char* renderName() const override;
174 virtual void addRegionToThread(RenderMultiColumnSet*) override; 189 virtual void addRegionToThread(RenderMultiColumnSet*) override;
175 virtual void willBeRemovedFromTree() override; 190 virtual void willBeRemovedFromTree() override;
176 virtual LayoutUnit skipColumnSpanner(RenderBox*, LayoutUnit logicalTopInFlow Thread) override; 191 virtual LayoutUnit skipColumnSpanner(RenderBox*, LayoutUnit logicalTopInFlow Thread) override;
177 virtual void flowThreadDescendantWasInserted(RenderObject*) override; 192 virtual void flowThreadDescendantWasInserted(RenderObject*) override;
178 virtual void flowThreadDescendantWillBeRemoved(RenderObject*) override; 193 virtual void flowThreadDescendantWillBeRemoved(RenderObject*) override;
179 virtual void computeLogicalHeight(LayoutUnit logicalHeight, LayoutUnit logic alTop, LogicalExtentComputedValues&) const override; 194 virtual void computeLogicalHeight(LayoutUnit logicalHeight, LayoutUnit logic alTop, LogicalExtentComputedValues&) const override;
180 virtual void updateLogicalWidth() override; 195 virtual void updateLogicalWidth() override;
(...skipping 11 matching lines...) Expand all
192 LayoutUnit m_columnHeightAvailable; // Total height available to columns, or 0 if auto. 207 LayoutUnit m_columnHeightAvailable; // Total height available to columns, or 0 if auto.
193 bool m_inBalancingPass; // Set when relayouting for column balancing. 208 bool m_inBalancingPass; // Set when relayouting for column balancing.
194 bool m_needsColumnHeightsRecalculation; // Set when we need to recalculate t he column set heights after layout. 209 bool m_needsColumnHeightsRecalculation; // Set when we need to recalculate t he column set heights after layout.
195 bool m_progressionIsInline; // Always true for regular multicol. False for p aged-y overflow. 210 bool m_progressionIsInline; // Always true for regular multicol. False for p aged-y overflow.
196 bool m_isBeingEvacuated; 211 bool m_isBeingEvacuated;
197 }; 212 };
198 213
199 } // namespace blink 214 } // namespace blink
200 215
201 #endif // RenderMultiColumnFlowThread_h 216 #endif // RenderMultiColumnFlowThread_h
OLDNEW
« no previous file with comments | « Source/core/rendering/RenderBox.cpp ('k') | Source/core/rendering/RenderMultiColumnFlowThread.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698