Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1529)

Unified Diff: Source/core/rendering/RenderBlockFlow.cpp

Issue 712553003: [New Multicolumn] Actual support for layout of column-span:all. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Code review. Camelize. Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/rendering/RenderBlock.cpp ('k') | Source/core/rendering/RenderFlowThread.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/rendering/RenderBlockFlow.cpp
diff --git a/Source/core/rendering/RenderBlockFlow.cpp b/Source/core/rendering/RenderBlockFlow.cpp
index afc0212fa770522ad2b8b05610560df1286d5192..6e7ddee59d2e1678777ac80e797ca5ec20b93093 100644
--- a/Source/core/rendering/RenderBlockFlow.cpp
+++ b/Source/core/rendering/RenderBlockFlow.cpp
@@ -546,11 +546,46 @@ void RenderBlockFlow::setLogicalTopForChild(RenderBox* child, LayoutUnit logical
}
}
+class ColumnSpannerLayoutScope {
+public:
+ ColumnSpannerLayoutScope()
+ : m_spanner(0)
+ {
+ }
+
+ ~ColumnSpannerLayoutScope()
+ {
+ if (!m_spanner)
+ return;
+ m_spanner->flowThreadContainingBlock()->exitColumnSpannerAfterLayout(m_spanner, m_spanner->parentBlock()->logicalHeight());
+ }
+
+ LayoutUnit enterSpanner(RenderBox* spanner, SubtreeLayoutScope& layoutScope)
+ {
+ ASSERT(!m_spanner);
+ m_spanner = spanner;
+ return m_spanner->flowThreadContainingBlock()->enterColumnSpannerBeforeLayout(m_spanner, m_spanner->parentBlock()->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);
@@ -592,7 +627,6 @@ void RenderBlockFlow::layoutBlockChild(RenderBox* child, MarginInfo& marginInfo,
previousFloatLogicalBottom = std::max(previousFloatLogicalBottom, oldLogicalTop + childRenderBlockFlow->lowestFloatLogicalBottom());
}
- SubtreeLayoutScope layoutScope(*child);
if (!child->needsLayout())
child->markForPaginationRelayoutIfNeeded(layoutScope);
@@ -867,6 +901,8 @@ void RenderBlockFlow::adjustLinePositionForPagination(RootInlineBox* lineBox, La
LayoutUnit RenderBlockFlow::adjustForUnsplittableChild(RenderBox* child, LayoutUnit logicalOffset, bool includeMargins)
{
+ if (child->isColumnSpanAll())
+ return logicalOffset;
bool checkColumnBreaks = view()->layoutState()->isPaginatingColumns() || flowThreadContainingBlock();
bool checkPageBreaks = !checkColumnBreaks && view()->layoutState()->pageLogicalHeight();
bool isUnsplittable = child->isUnsplittableForPagination() || (checkColumnBreaks && child->style()->columnBreakInside() == PBAVOID)
@@ -1297,7 +1333,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));
@@ -1513,7 +1549,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);
« no previous file with comments | « Source/core/rendering/RenderBlock.cpp ('k') | Source/core/rendering/RenderFlowThread.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698