Chromium Code Reviews| Index: Source/core/rendering/RenderBlockFlow.cpp |
| diff --git a/Source/core/rendering/RenderBlockFlow.cpp b/Source/core/rendering/RenderBlockFlow.cpp |
| index 0513586dd5081be7a3de8f49d36c672de700222b..36285cff6b3532896a3cd2be4dc7f2a5c8c71fed 100644 |
| --- a/Source/core/rendering/RenderBlockFlow.cpp |
| +++ b/Source/core/rendering/RenderBlockFlow.cpp |
| @@ -544,11 +544,44 @@ void RenderBlockFlow::setLogicalTopForChild(RenderBox* child, LayoutUnit logical |
| } |
| } |
| +class ColumnSpannerLayoutScope { |
| +public: |
| + ColumnSpannerLayoutScope() |
| + : m_spanner(0) { } |
| + |
| + ~ColumnSpannerLayoutScope() |
| + { |
| + if (!m_spanner) |
| + return; |
| + m_spanner->flowThreadContainingBlock()->leaveColumnSpannerAfterLayout(m_spanner, m_spanner->containingBlock()->logicalHeight()); |
| + } |
| + |
| + LayoutUnit enterSpanner(RenderBox* spanner, SubtreeLayoutScope& layoutScope) |
| + { |
| + ASSERT(!m_spanner); |
| + m_spanner = spanner; |
| + return m_spanner->flowThreadContainingBlock()->enterColumnSpannerBeforeLayout(m_spanner, m_spanner->containingBlock()->logicalHeight(), layoutScope); |
| + } |
| + |
| +private: |
| + RenderBox* m_spanner; |
| +}; |
| + |
| void RenderBlockFlow::layoutBlockChild(RenderBox* child, MarginInfo& marginInfo, LayoutUnit& previousFloatLogicalBottom) |
| { |
| LayoutUnit oldPosMarginBefore = maxPositiveMarginBefore(); |
| LayoutUnit oldNegMarginBefore = maxNegativeMarginBefore(); |
| + SubtreeLayoutScope layoutScope(*child); |
| + |
| + ColumnSpannerLayoutScope columnSpannerLayoutScope; |
| + if (child->isColumnSpanAll()) { |
| + LayoutUnit adjustment = columnSpannerLayoutScope.enterSpanner(child, layoutScope); |
| + // A spanner needs to start at an exact column boundary inside the flow thread, so that it |
| + // doesn't bleed into a preceding column. That's what the adjustment is about. |
| + setLogicalHeight(logicalHeight() + adjustment); |
| + } |
| + |
| // The child is a normal flow object. Compute the margins we will use for collapsing now. |
| child->computeAndSetBlockDirectionMargins(this); |
| @@ -590,7 +623,6 @@ void RenderBlockFlow::layoutBlockChild(RenderBox* child, MarginInfo& marginInfo, |
| previousFloatLogicalBottom = std::max(previousFloatLogicalBottom, oldLogicalTop + childRenderBlockFlow->lowestFloatLogicalBottom()); |
| } |
| - SubtreeLayoutScope layoutScope(*child); |
| if (!child->needsLayout()) |
| child->markForPaginationRelayoutIfNeeded(layoutScope); |
| @@ -1295,7 +1327,7 @@ LayoutUnit RenderBlockFlow::collapseMargins(RenderBox* child, MarginInfo& margin |
| // If margins would pull us past the top of the next page, then we need to pull back and pretend like the margins |
| // collapsed into the page edge. |
| LayoutState* layoutState = view()->layoutState(); |
| - if (layoutState->isPaginated() && layoutState->pageLogicalHeight() && logicalTop > beforeCollapseLogicalTop) { |
| + if (layoutState->isPaginated() && layoutState->pageLogicalHeight() && logicalTop > beforeCollapseLogicalTop && !child->isColumnSpanAll()) { |
|
Julien - ping for review
2014/11/17 23:47:11
It seems like we should just make column spanning
mstensho (USE GERRIT)
2014/11/18 13:29:26
They already do create a new block formatting cont
Julien - ping for review
2014/11/19 17:54:34
I missed that you actually changed the function in
mstensho (USE GERRIT)
2014/11/21 15:39:24
This code here is about the top margin. Being a BF
|
| LayoutUnit oldLogicalTop = logicalTop; |
| logicalTop = std::min(logicalTop, nextPageLogicalTop(beforeCollapseLogicalTop)); |
| setLogicalHeight(logicalHeight() + (logicalTop - oldLogicalTop)); |
| @@ -1511,7 +1543,7 @@ LayoutUnit RenderBlockFlow::estimateLogicalTopPosition(RenderBox* child, const M |
| // Adjust logicalTopEstimate down to the next page if the margins are so large that we don't fit on the current |
| // page. |
| LayoutState* layoutState = view()->layoutState(); |
| - if (layoutState->isPaginated() && layoutState->pageLogicalHeight() && logicalTopEstimate > logicalHeight()) |
| + if (layoutState->isPaginated() && layoutState->pageLogicalHeight() && logicalTopEstimate > logicalHeight() && !child->isColumnSpanAll()) |
|
mstensho (USE GERRIT)
2014/11/21 15:39:24
I'll remove this for now. No test covers it. See p
|
| logicalTopEstimate = std::min(logicalTopEstimate, nextPageLogicalTop(logicalHeight())); |
| logicalTopEstimate += getClearDelta(child, logicalTopEstimate); |