| Index: Source/core/rendering/RenderMultiColumnSet.cpp
|
| diff --git a/Source/core/rendering/RenderMultiColumnSet.cpp b/Source/core/rendering/RenderMultiColumnSet.cpp
|
| index dd1cc2263e4c9bfa6f92627b25bee9e1b6e88c48..94e77044e76134575b0a1df1826bbf1aa7d41056 100644
|
| --- a/Source/core/rendering/RenderMultiColumnSet.cpp
|
| +++ b/Source/core/rendering/RenderMultiColumnSet.cpp
|
| @@ -29,6 +29,7 @@
|
| #include "core/rendering/PaintInfo.h"
|
| #include "core/rendering/RenderLayer.h"
|
| #include "core/rendering/RenderMultiColumnFlowThread.h"
|
| +#include "core/rendering/RenderMultiColumnSpannerPlaceholder.h"
|
|
|
| namespace blink {
|
|
|
| @@ -68,6 +69,43 @@ RenderMultiColumnSet* RenderMultiColumnSet::previousSiblingMultiColumnSet() cons
|
| return 0;
|
| }
|
|
|
| +void RenderMultiColumnSet::setLogicalTopInFlowThread(LayoutUnit logicalTop)
|
| +{
|
| + LayoutRect rect = flowThreadPortionRect();
|
| + if (isHorizontalWritingMode())
|
| + rect.setY(logicalTop);
|
| + else
|
| + rect.setX(logicalTop);
|
| + setFlowThreadPortionRect(rect);
|
| +}
|
| +
|
| +void RenderMultiColumnSet::setLogicalBottomInFlowThread(LayoutUnit logicalBottom)
|
| +{
|
| + LayoutRect rect = flowThreadPortionRect();
|
| + if (isHorizontalWritingMode())
|
| + rect.shiftMaxYEdgeTo(logicalBottom);
|
| + else
|
| + rect.shiftMaxXEdgeTo(logicalBottom);
|
| + setFlowThreadPortionRect(rect);
|
| +}
|
| +
|
| +bool RenderMultiColumnSet::heightIsAuto() const
|
| +{
|
| + RenderMultiColumnFlowThread* flowThread = multiColumnFlowThread();
|
| + if (!flowThread->isRenderPagedFlowThread()) {
|
| + if (RenderBox* next = RenderMultiColumnFlowThread::nextColumnSetOrSpannerSiblingOf(this)) {
|
| + if (!next->isRenderMultiColumnSet()) {
|
| + // If we're followed by a spanner, we need to balance.
|
| + ASSERT(flowThread->findColumnSpannerPlaceholder(next));
|
| + return true;
|
| + }
|
| + }
|
| + if (multiColumnBlockFlow()->style()->columnFill() == ColumnFillBalance)
|
| + return true;
|
| + }
|
| + return !flowThread->columnHeightAvailable();
|
| +}
|
| +
|
| LayoutSize RenderMultiColumnSet::flowThreadTranslationAtOffset(LayoutUnit blockOffset) const
|
| {
|
| unsigned columnIndex = columnIndexAtOffset(blockOffset);
|
| @@ -88,7 +126,7 @@ LayoutUnit RenderMultiColumnSet::heightAdjustedForSetOffset(LayoutUnit height) c
|
| // a wasted layout iteration. Of course all other sets (if any) have this problem in the first
|
| // layout pass too, but there's really nothing we can do there until the flow thread has been
|
| // laid out anyway.
|
| - if (previousSiblingMultiColumnSet()) {
|
| + if (RenderMultiColumnFlowThread::previousColumnSetOrSpannerSiblingOf(this)) {
|
| RenderBlockFlow* multicolBlock = multiColumnBlockFlow();
|
| LayoutUnit contentLogicalTop = logicalTop() - multicolBlock->borderAndPaddingBefore();
|
| height -= contentLogicalTop;
|
| @@ -191,7 +229,7 @@ LayoutUnit RenderMultiColumnSet::calculateColumnHeight(BalancedHeightCalculation
|
|
|
| void RenderMultiColumnSet::addContentRun(LayoutUnit endOffsetFromFirstPage)
|
| {
|
| - if (!multiColumnFlowThread()->heightIsAuto())
|
| + if (!heightIsAuto())
|
| return;
|
| if (!m_contentRuns.isEmpty() && endOffsetFromFirstPage <= m_contentRuns.last().breakOffset())
|
| return;
|
| @@ -203,21 +241,27 @@ void RenderMultiColumnSet::addContentRun(LayoutUnit endOffsetFromFirstPage)
|
|
|
| bool RenderMultiColumnSet::recalculateColumnHeight(BalancedHeightCalculation calculationMode)
|
| {
|
| - ASSERT(multiColumnFlowThread()->heightIsAuto());
|
| -
|
| LayoutUnit oldColumnHeight = m_columnHeight;
|
| - if (calculationMode == GuessFromFlowThreadPortion) {
|
| - // Post-process the content runs and find out where the implicit breaks will occur.
|
| - distributeImplicitBreaks();
|
| - }
|
| - LayoutUnit newColumnHeight = calculateColumnHeight(calculationMode);
|
| - setAndConstrainColumnHeight(newColumnHeight);
|
|
|
| - // After having calculated an initial column height, the multicol container typically needs at
|
| - // least one more layout pass with a new column height, but if a height was specified, we only
|
| - // need to do this if we think that we need less space than specified. Conversely, if we
|
| - // determined that the columns need to be as tall as the specified height of the container, we
|
| - // have already laid it out correctly, and there's no need for another pass.
|
| + m_maxColumnHeight = calculateMaxColumnHeight();
|
| +
|
| + if (heightIsAuto()) {
|
| + if (calculationMode == GuessFromFlowThreadPortion) {
|
| + // Post-process the content runs and find out where the implicit breaks will occur.
|
| + distributeImplicitBreaks();
|
| + }
|
| + LayoutUnit newColumnHeight = calculateColumnHeight(calculationMode);
|
| + setAndConstrainColumnHeight(newColumnHeight);
|
| + // After having calculated an initial column height, the multicol container typically needs at
|
| + // least one more layout pass with a new column height, but if a height was specified, we only
|
| + // need to do this if we think that we need less space than specified. Conversely, if we
|
| + // determined that the columns need to be as tall as the specified height of the container, we
|
| + // have already laid it out correctly, and there's no need for another pass.
|
| + } else {
|
| + // The position of the column set may have changed, in which case height available for
|
| + // columns may have changed as well.
|
| + setAndConstrainColumnHeight(m_columnHeight);
|
| + }
|
|
|
| // We can get rid of the content runs now, if we haven't already done so. They are only needed
|
| // to calculate the initial balanced column height. In fact, we have to get rid of them before
|
| @@ -252,7 +296,7 @@ void RenderMultiColumnSet::resetColumnHeight()
|
|
|
| LayoutUnit oldColumnHeight = pageLogicalHeight();
|
|
|
| - if (multiColumnFlowThread()->heightIsAuto())
|
| + if (heightIsAuto())
|
| m_columnHeight = 0;
|
| else
|
| setAndConstrainColumnHeight(heightAdjustedForSetOffset(multiColumnFlowThread()->columnHeightAvailable()));
|
|
|