Chromium Code Reviews| Index: Source/core/rendering/RenderMultiColumnFlowThread.h |
| diff --git a/Source/core/rendering/RenderMultiColumnFlowThread.h b/Source/core/rendering/RenderMultiColumnFlowThread.h |
| index 3f10b58eb40d4c4f193bd3462365bd1d853828ce..301dce5a4dea5bc7738069d31c1e575bb3c0e322 100644 |
| --- a/Source/core/rendering/RenderMultiColumnFlowThread.h |
| +++ b/Source/core/rendering/RenderMultiColumnFlowThread.h |
| @@ -28,10 +28,12 @@ |
| #define RenderMultiColumnFlowThread_h |
| #include "core/rendering/RenderFlowThread.h" |
| +#include "wtf/HashMap.h" |
| namespace blink { |
| class RenderMultiColumnSet; |
| +class RenderMultiColumnSpannerPlaceholder; |
| // Flow thread implementation for CSS multicol. This will be inserted as an anonymous child block of |
| // the actual multicol container (i.e. the RenderBlockFlow whose style computes to non-auto |
| @@ -51,17 +53,26 @@ class RenderMultiColumnSet; |
| // container. It's the RenderMultiColumnSet objects that take up the necessary amount of space, and |
| // make sure that the columns are painted and hit-tested correctly. |
| // |
| +// Column spanner (column-span:all) renderers also become siblings of the column sets, even if they |
| +// occur elsewhere in the DOM tree. A RenderMultiColumnSpannerPlaceholder is created and inserted at |
| +// the position in the render tree where the spanner naturally occurs. The spanner itself is |
| +// reparented as a sibling of the column sets. The containing block of a spanner is the multicol |
| +// container, not its parent block. None of the DOM ancestors between the spanner and the multicol |
| +// container should affect rendering of the spanner in any way. |
| +// |
| // The width of the flow thread is the same as the column width. The width of a column set is the |
| // same as the content box width of the multicol container; in other words exactly enough to hold |
| // the number of columns to be used, stacked horizontally, plus column gaps between them. |
| // |
| // Since it's the first child of the multicol container, the flow thread is laid out first, albeit |
| // in a slightly special way, since it's not to take up any space in its ancestors. Afterwards, the |
| -// column sets are laid out. They get their height from the columns that they hold. In single |
| -// column-row constrained height non-balancing cases this will simply be the same as the content |
| -// height of the multicol container itself. In most other cases we'll have to calculate optimal |
| -// column heights ourselves, though. This process is referred to as column balancing, and then we |
| -// infer the column set height from the flow thread's height. |
| +// column sets and spanners are laid out. Column sets get their height from the columns that they |
| +// hold. In single column-row constrained height non-balancing cases without spanners this will |
| +// simply be the same as the content height of the multicol container itself. In most other cases |
| +// we'll have to calculate optimal column heights ourselves, though. This process is referred to as |
| +// column balancing, and then we infer the column set height from the height of the flow thread |
| +// portion occupied by each set. Column spanners are just laid out as normal blocks within the |
| +// multicol container, and get their size and position via the regular layout machinery. |
| // |
| // More on column balancing: the columns' height is unknown in the first layout pass when |
| // balancing. This means that we cannot insert any implicit (soft / unforced) breaks (and pagination |
| @@ -96,8 +107,14 @@ public: |
| RenderMultiColumnSet* firstMultiColumnSet() const; |
| RenderMultiColumnSet* lastMultiColumnSet() const; |
| + RenderBox* firstColumnSetOrSpanner() const; |
| + static RenderBox* nextColumnSetOrSpannerSiblingOf(const RenderBox*); |
| + static RenderBox* previousColumnSetOrSpannerSiblingOf(const RenderBox*); |
| + |
| + RenderMultiColumnSpannerPlaceholder* findColumnSpannerPlaceholder(RenderBox* spanner) const { return m_spannerMap.get(spanner); } |
| - virtual void addChild(RenderObject* newChild, RenderObject* beforeChild = 0) OVERRIDE; |
| + // Find the set inside which the specified renderer would be rendered. |
| + RenderMultiColumnSet* findSetRendering(RenderObject*) const; |
| // Populate the flow thread with what's currently its siblings. Called when a regular block |
| // becomes a multicol container. |
| @@ -111,7 +128,6 @@ public: |
| unsigned columnCount() const { return m_columnCount; } |
| LayoutUnit columnHeightAvailable() const { return m_columnHeightAvailable; } |
| void setColumnHeightAvailable(LayoutUnit available) { m_columnHeightAvailable = available; } |
| - virtual bool heightIsAuto() const { return !columnHeightAvailable() || multiColumnBlockFlow()->style()->columnFill() == ColumnFillBalance; } |
| bool progressionIsInline() const { return m_progressionIsInline; } |
| virtual LayoutSize columnOffset(const LayoutPoint&) const OVERRIDE FINAL; |
| @@ -123,6 +139,8 @@ public: |
| bool recalculateColumnHeights(); |
| + void advanceToNextColumnSet(RenderMultiColumnSpannerPlaceholder*); |
| + |
| protected: |
| RenderMultiColumnFlowThread(); |
| void setProgressionIsInline(bool isInline) { m_progressionIsInline = isInline; } |
| @@ -131,10 +149,14 @@ protected: |
| private: |
| void calculateColumnCountAndWidth(LayoutUnit& width, unsigned& count) const; |
| + virtual bool isDescendantValidColumnSpanner(RenderObject* descendant) const; |
| virtual const char* renderName() const OVERRIDE; |
| virtual void addRegionToThread(RenderMultiColumnSet*) OVERRIDE; |
| virtual void willBeRemovedFromTree() OVERRIDE; |
| + virtual RenderObject* resolveMovedChild(RenderObject* child) const OVERRIDE; |
| + virtual void flowThreadDescendantInserted(RenderObject*) OVERRIDE; |
| + virtual void flowThreadRelativeWillBeRemoved(RenderObject*) OVERRIDE; |
|
Julien - ping for review
2014/09/03 23:22:23
Relative seems too ambiguous to me (there is a rel
mstensho (USE GERRIT)
2014/09/04 12:14:02
Done.
|
| virtual void computeLogicalHeight(LayoutUnit logicalHeight, LayoutUnit logicalTop, LogicalExtentComputedValues&) const OVERRIDE; |
| virtual void updateLogicalWidth() OVERRIDE; |
| virtual void setPageBreak(LayoutUnit offset, LayoutUnit spaceShortage) OVERRIDE; |
| @@ -143,11 +165,21 @@ private: |
| virtual bool addForcedRegionBreak(LayoutUnit, RenderObject* breakChild, bool isBefore, LayoutUnit* offsetBreakAdjustment = 0) OVERRIDE; |
| virtual bool isPageLogicalHeightKnown() const OVERRIDE; |
| + typedef HashMap<RenderBox*, RenderMultiColumnSpannerPlaceholder*> SpannerMap; |
| + SpannerMap m_spannerMap; |
| + |
| + // The last set we worked on. It's not to be used as the "current set". The concept of a |
| + // "current set" is difficult, since layout may jump back and forth in the tree, due to wrong |
| + // top location estimates (due to e.g. margin collapsing), and possibly for other reasons. |
| + RenderMultiColumnSet* m_lastSetWorkedOn; |
|
Julien - ping for review
2014/09/03 23:22:23
Wouldn't this be better passed in as a parameter?
mstensho (USE GERRIT)
2014/09/04 12:14:02
It's used in RenderMultiColumnFlowThread::columnSe
|
| + |
| unsigned m_columnCount; // The used value of column-count |
| LayoutUnit m_columnHeightAvailable; // Total height available to columns, or 0 if auto. |
| + bool m_inLayout; // Set while we're laying out the flow thread, during which colum set heights are unknown. |
|
Julien - ping for review
2014/09/03 23:22:23
Maybe it would be better to call this m_ColumnSetH
mstensho (USE GERRIT)
2014/09/04 12:14:02
Done.
|
| bool m_inBalancingPass; // Set when relayouting for column balancing. |
| bool m_needsColumnHeightsRecalculation; // Set when we need to recalculate the column set heights after layout. |
| bool m_progressionIsInline; // Always true for regular multicol. False for paged-y overflow. |
| + bool m_beingEvacuated; |
| }; |
| } // namespace blink |