Index: Source/core/rendering/RenderMultiColumnSet.h |
diff --git a/Source/core/rendering/RenderMultiColumnSet.h b/Source/core/rendering/RenderMultiColumnSet.h |
index 16c12faaf36c5e51fed9d776ea93e6285d2a91cd..1632de19c32e73c5f628fd2eb13cd3a56fbc88e6 100644 |
--- a/Source/core/rendering/RenderMultiColumnSet.h |
+++ b/Source/core/rendering/RenderMultiColumnSet.h |
@@ -71,14 +71,24 @@ public: |
RenderMultiColumnSet* nextSiblingMultiColumnSet() const; |
RenderMultiColumnSet* previousSiblingMultiColumnSet() const; |
+ // Get the first renderer in the flow thread that's rendered inside this set. |
+ RenderObject* firstRendererInFlowThread() const; |
+ // Get the last renderer in the flow thread that's rendered inside this set. |
+ RenderObject* lastRendererInFlowThread() const; |
+ // True if the specified renderer in the flow thread is rendered inside this set. |
+ bool renders(RenderObject*) const; |
+ |
+ void setLogicalTopInFlowThread(LayoutUnit); |
LayoutUnit logicalTopInFlowThread() const { return isHorizontalWritingMode() ? flowThreadPortionRect().y() : flowThreadPortionRect().x(); } |
- LayoutUnit logicalBottomInFlowThread() const { return isHorizontalWritingMode() ? flowThreadPortionRect().maxY() : flowThreadPortionRect().maxX(); } |
- |
LayoutUnit logicalHeightInFlowThread() const { return isHorizontalWritingMode() ? flowThreadPortionRect().height() : flowThreadPortionRect().width(); } |
+ void setLogicalBottomInFlowThread(LayoutUnit); |
+ LayoutUnit logicalBottomInFlowThread() const { return isHorizontalWritingMode() ? flowThreadPortionRect().maxY() : flowThreadPortionRect().maxX(); } |
// The used CSS value of column-count, i.e. how many columns there are room for without overflowing. |
unsigned usedColumnCount() const { return multiColumnFlowThread()->columnCount(); } |
+ bool heightIsAuto() const; |
+ |
// Find the column that contains the given block offset, and return the translation needed to |
// get from flow thread coordinates to visual coordinates. |
LayoutSize flowThreadTranslationAtOffset(LayoutUnit) const; |
@@ -94,7 +104,9 @@ public: |
// height. |
void addContentRun(LayoutUnit endOffsetFromFirstPage); |
- // (Re-)calculate the column height if it's auto. |
+ // (Re-)calculate the column height if it's auto. This is first and foremost needed by sets that |
+ // are to balance the column height, but even when it isn't to be balanced, this is necessary if |
+ // the multicol container's height is constrained. |
bool recalculateColumnHeight(BalancedHeightCalculation); |
// Record space shortage (the amount of space that would have been enough to prevent some |
@@ -106,6 +118,19 @@ public: |
// Reset previously calculated column height. Will mark for layout if needed. |
void resetColumnHeight(); |
+ // Has this set been flowed in this layout pass? |
+ bool hasBeenFlowed() const; |
+ // Prepare this set for flow thread layout. Mark it as "not flowed". |
+ void resetFlow(); |
+ // Layout of flow thread content that's to be rendered inside this column set begins. This |
+ // happens at the beginning of flow thread layout, and when advancing from a previous column set |
+ // or spanner to this one. |
+ void beginFlow(LayoutUnit offsetInFlowThread); |
+ // Layout of flow thread content that was to be rendered inside this column set has |
+ // finished. This happens at end of flow thread layout, and when advancing to the next column |
+ // set or spanner. |
+ void endFlow(LayoutUnit offsetInFlowThread); |
+ |
// Expand this set's flow thread portion rectangle to contain all trailing flow thread |
// overflow. Only to be called on the last set. |
void expandToEncompassFlowThreadContentsIfNeeded(); |
@@ -195,6 +220,33 @@ private: |
Vector<ContentRun, 1> m_contentRuns; |
}; |
+inline bool RenderMultiColumnSet::hasBeenFlowed() const |
+{ |
+ return logicalBottomInFlowThread() != RenderFlowThread::maxLogicalHeight(); |
+} |
+ |
+inline void RenderMultiColumnSet::resetFlow() |
+{ |
+ // Start with "infinite" flow thread portion height until height is known. |
+ setLogicalBottomInFlowThread(RenderFlowThread::maxLogicalHeight()); |
+} |
+ |
+inline void RenderMultiColumnSet::beginFlow(LayoutUnit offsetInFlowThread) |
+{ |
+ // At this point layout is exactly at the beginning of this set. Store block offset from flow |
+ // thread start. |
+ setLogicalTopInFlowThread(offsetInFlowThread); |
+} |
+ |
+inline void RenderMultiColumnSet::endFlow(LayoutUnit offsetInFlowThread) |
+{ |
+ // At this point layout is exactly at the end of this set. Store block offset from flow thread |
+ // start. This set is now considered "flowed", although we may have to revisit it later (with |
+ // beginFlow()), e.g. if a subtree in the flow thread has to be laid out over again because the |
+ // initial margin collapsing estimates were wrong. |
+ setLogicalBottomInFlowThread(offsetInFlowThread); |
+} |
+ |
DEFINE_RENDER_OBJECT_TYPE_CASTS(RenderMultiColumnSet, isRenderMultiColumnSet()); |
} // namespace WebCore |