Index: Source/core/rendering/RenderBlockFlow.cpp |
diff --git a/Source/core/rendering/RenderBlockFlow.cpp b/Source/core/rendering/RenderBlockFlow.cpp |
index 068627320dad05554a93bd69b39d3ba7dbdbe420..d29ef66cf605bad310695b1f7db411ef31d66297 100644 |
--- a/Source/core/rendering/RenderBlockFlow.cpp |
+++ b/Source/core/rendering/RenderBlockFlow.cpp |
@@ -552,6 +552,20 @@ void RenderBlockFlow::layoutBlockChild(RenderBox* child, MarginInfo& marginInfo, |
{ |
LayoutUnit oldPosMarginBefore = maxPositiveMarginBefore(); |
LayoutUnit oldNegMarginBefore = maxNegativeMarginBefore(); |
+ bool childIsColumnSpanner = child->isColumnSpanAll(); |
+ |
+ if (childIsColumnSpanner) { |
Julien - ping for review
2014/09/30 00:39:32
Nit: This looks like it should be a RAII so that w
|
+ // Margins of a column spanner cannot collapse with anything. Block direction margins on |
+ // spanners will be ignored here, inside flow thread layout. Instead they'll be added around |
+ // the RenderMultiColumnSpannerSet. Now skip past the pending margin that belongs to the |
+ // columns. |
+ setLogicalHeight(logicalHeight() + marginInfo.margin()); |
+ marginInfo.clearMargin(); |
+ LayoutUnit adjustment = flowThreadContainingBlock()->enterColumnSpanner(child, logicalHeight()); |
+ // 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); |
@@ -687,6 +701,11 @@ void RenderBlockFlow::layoutBlockChild(RenderBox* child, MarginInfo& marginInfo, |
LayoutUnit newHeight = applyAfterBreak(child, logicalHeight(), marginInfo); |
if (newHeight != height()) |
setLogicalHeight(newHeight); |
+ |
+ if (childIsColumnSpanner) { |
+ flowThreadContainingBlock()->leaveColumnSpanner(child, logicalHeight()); |
+ ASSERT(!marginInfo.margin()); |
+ } |
} |
} |
@@ -1285,7 +1304,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()) { |
LayoutUnit oldLogicalTop = logicalTop; |
logicalTop = std::min(logicalTop, nextPageLogicalTop(beforeCollapseLogicalTop)); |
setLogicalHeight(logicalHeight() + (logicalTop - oldLogicalTop)); |
@@ -1501,7 +1520,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()) |
logicalTopEstimate = std::min(logicalTopEstimate, nextPageLogicalTop(logicalHeight())); |
logicalTopEstimate += getClearDelta(child, logicalTopEstimate); |