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

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

Issue 148823002: *** DO NOT LAND *** Measure the size and complexity of the old multicol implementation. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 11 months 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/RenderBlockFlow.h ('k') | Source/core/rendering/RenderBox.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 840108dd5a2c728bf4f935408859f787da4632f2..c25c1678ff0989ece0e44446b61b9fc5fad02f72 100644
--- a/Source/core/rendering/RenderBlockFlow.cpp
+++ b/Source/core/rendering/RenderBlockFlow.cpp
@@ -145,7 +145,7 @@ static bool inNormalFlow(RenderBox* child)
RenderBlock* curr = child->containingBlock();
RenderView* renderView = child->view();
while (curr && curr != renderView) {
- if (curr->hasColumns() || curr->isRenderFlowThread())
+ if (curr->isRenderFlowThread())
return true;
if (curr->isFloatingOrOutOfFlowPositioned())
return false;
@@ -187,59 +187,6 @@ void RenderBlockFlow::willBeDestroyed()
RenderBlock::willBeDestroyed();
}
-bool RenderBlockFlow::relayoutForPagination(bool hasSpecifiedPageLogicalHeight, LayoutUnit pageLogicalHeight, LayoutStateMaintainer& statePusher)
-{
- if (!hasColumns())
- return false;
-
- OwnPtr<RenderOverflow> savedOverflow = m_overflow.release();
- if (childrenInline())
- addOverflowFromInlineChildren();
- else
- addOverflowFromBlockChildren();
- LayoutUnit layoutOverflowLogicalBottom = (isHorizontalWritingMode() ? layoutOverflowRect().maxY() : layoutOverflowRect().maxX()) - borderBefore() - paddingBefore();
-
- // FIXME: We don't balance properly at all in the presence of forced page breaks. We need to understand what
- // the distance between forced page breaks is so that we can avoid making the minimum column height too tall.
- ColumnInfo* colInfo = columnInfo();
- if (!hasSpecifiedPageLogicalHeight) {
- LayoutUnit columnHeight = pageLogicalHeight;
- int minColumnCount = colInfo->forcedBreaks() + 1;
- int desiredColumnCount = colInfo->desiredColumnCount();
- if (minColumnCount >= desiredColumnCount) {
- // The forced page breaks are in control of the balancing. Just set the column height to the
- // maximum page break distance.
- if (!pageLogicalHeight) {
- LayoutUnit distanceBetweenBreaks = max<LayoutUnit>(colInfo->maximumDistanceBetweenForcedBreaks(),
- view()->layoutState()->pageLogicalOffset(this, borderBefore() + paddingBefore() + layoutOverflowLogicalBottom) - colInfo->forcedBreakOffset());
- columnHeight = max(colInfo->minimumColumnHeight(), distanceBetweenBreaks);
- }
- } else if (layoutOverflowLogicalBottom > boundedMultiply(pageLogicalHeight, desiredColumnCount)) {
- // Now that we know the intrinsic height of the columns, we have to rebalance them.
- columnHeight = max<LayoutUnit>(colInfo->minimumColumnHeight(), ceilf((float)layoutOverflowLogicalBottom / desiredColumnCount));
- }
-
- if (columnHeight && columnHeight != pageLogicalHeight) {
- statePusher.pop();
- setEverHadLayout(true);
- layoutBlockFlow(false, columnHeight);
- return true;
- }
- }
-
- if (pageLogicalHeight)
- colInfo->setColumnCountAndHeight(ceilf((float)layoutOverflowLogicalBottom / pageLogicalHeight), pageLogicalHeight);
-
- if (columnCount(colInfo)) {
- setLogicalHeight(borderBefore() + paddingBefore() + colInfo->columnHeight() + borderAfter() + paddingAfter() + scrollbarLogicalHeight());
- m_overflow.clear();
- } else {
- m_overflow = savedOverflow.release();
- }
-
- return false;
-}
-
bool RenderBlockFlow::isSelfCollapsingBlock() const
{
m_hasOnlySelfCollapsingChildren = RenderBlock::isSelfCollapsingBlock();
@@ -251,7 +198,7 @@ void RenderBlockFlow::layoutBlock(bool relayoutChildren)
layoutBlockFlow(relayoutChildren);
}
-inline void RenderBlockFlow::layoutBlockFlow(bool relayoutChildren, LayoutUnit pageLogicalHeight)
+inline void RenderBlockFlow::layoutBlockFlow(bool relayoutChildren)
{
ASSERT(needsLayout());
ASSERT(isInlineBlockOrInlineTable() || !isInline());
@@ -271,12 +218,13 @@ inline void RenderBlockFlow::layoutBlockFlow(bool relayoutChildren, LayoutUnit p
rebuildFloatsFromIntruding();
+ LayoutUnit pageLogicalHeight;
bool pageLogicalHeightChanged = false;
bool hasSpecifiedPageLogicalHeight = false;
checkForPaginationLogicalHeightChange(pageLogicalHeight, pageLogicalHeightChanged, hasSpecifiedPageLogicalHeight);
RenderView* renderView = view();
- LayoutStateMaintainer statePusher(renderView, this, locationOffset(), hasColumns() || hasTransform() || hasReflection() || style()->isFlippedBlocksWritingMode(), pageLogicalHeight, pageLogicalHeightChanged, columnInfo());
+ LayoutStateMaintainer statePusher(renderView, this, locationOffset(), hasTransform() || hasReflection() || style()->isFlippedBlocksWritingMode(), pageLogicalHeight, pageLogicalHeightChanged);
// Regions changing widths can force us to relayout our children.
RenderFlowThread* flowThread = flowThreadContainingBlock();
@@ -1530,15 +1478,12 @@ bool RenderBlockFlow::mustSeparateMarginAfterForChild(const RenderBox* child) co
LayoutUnit RenderBlockFlow::applyBeforeBreak(RenderBox* child, LayoutUnit logicalOffset)
{
// FIXME: Add page break checking here when we support printing.
- bool checkColumnBreaks = view()->layoutState()->isPaginatingColumns();
- bool checkPageBreaks = !checkColumnBreaks && view()->layoutState()->m_pageLogicalHeight; // FIXME: Once columns can print we have to check this.
+ bool checkPageBreaks = view()->layoutState()->m_pageLogicalHeight; // FIXME: Once columns can print we have to check this.
RenderFlowThread* flowThread = flowThreadContainingBlock();
bool checkRegionBreaks = flowThread && flowThread->isRenderNamedFlowThread();
- bool checkBeforeAlways = (checkColumnBreaks && child->style()->columnBreakBefore() == PBALWAYS) || (checkPageBreaks && child->style()->pageBreakBefore() == PBALWAYS)
+ bool checkBeforeAlways = (checkPageBreaks && child->style()->pageBreakBefore() == PBALWAYS)
|| (checkRegionBreaks && child->style()->regionBreakBefore() == PBALWAYS);
if (checkBeforeAlways && inNormalFlow(child) && hasNextPage(logicalOffset, IncludePageBoundary)) {
- if (checkColumnBreaks)
- view()->layoutState()->addForcedColumnBreak(child, logicalOffset);
if (checkRegionBreaks) {
LayoutUnit offsetBreakAdjustment = 0;
if (flowThread->addForcedRegionBreak(offsetFromLogicalTopOfFirstPage() + logicalOffset, child, true, &offsetBreakAdjustment))
@@ -1552,11 +1497,10 @@ LayoutUnit RenderBlockFlow::applyBeforeBreak(RenderBox* child, LayoutUnit logica
LayoutUnit RenderBlockFlow::applyAfterBreak(RenderBox* child, LayoutUnit logicalOffset, MarginInfo& marginInfo)
{
// FIXME: Add page break checking here when we support printing.
- bool checkColumnBreaks = view()->layoutState()->isPaginatingColumns();
- bool checkPageBreaks = !checkColumnBreaks && view()->layoutState()->m_pageLogicalHeight; // FIXME: Once columns can print we have to check this.
+ bool checkPageBreaks = view()->layoutState()->m_pageLogicalHeight; // FIXME: Once columns can print we have to check this.
RenderFlowThread* flowThread = flowThreadContainingBlock();
bool checkRegionBreaks = flowThread && flowThread->isRenderNamedFlowThread();
- bool checkAfterAlways = (checkColumnBreaks && child->style()->columnBreakAfter() == PBALWAYS) || (checkPageBreaks && child->style()->pageBreakAfter() == PBALWAYS)
+ bool checkAfterAlways = (checkPageBreaks && child->style()->pageBreakAfter() == PBALWAYS)
|| (checkRegionBreaks && child->style()->regionBreakAfter() == PBALWAYS);
if (checkAfterAlways && inNormalFlow(child) && hasNextPage(logicalOffset, IncludePageBoundary)) {
LayoutUnit marginOffset = marginInfo.canCollapseWithMarginBefore() ? LayoutUnit() : marginInfo.margin();
@@ -1564,8 +1508,6 @@ LayoutUnit RenderBlockFlow::applyAfterBreak(RenderBox* child, LayoutUnit logical
// So our margin doesn't participate in the next collapsing steps.
marginInfo.clearMargin();
- if (checkColumnBreaks)
- view()->layoutState()->addForcedColumnBreak(child, logicalOffset);
if (checkRegionBreaks) {
LayoutUnit offsetBreakAdjustment = 0;
if (flowThread->addForcedRegionBreak(offsetFromLogicalTopOfFirstPage() + logicalOffset + marginOffset, child, false, &offsetBreakAdjustment))
@@ -1593,7 +1535,7 @@ void RenderBlockFlow::addOverflowFromFloats()
void RenderBlockFlow::computeOverflow(LayoutUnit oldClientAfterEdge, bool recomputeFloats)
{
RenderBlock::computeOverflow(oldClientAfterEdge, recomputeFloats);
- if (!hasColumns() && (recomputeFloats || isRoot() || expandsToEncloseOverhangingFloats() || hasSelfPaintingLayer()))
+ if (recomputeFloats || isRoot() || expandsToEncloseOverhangingFloats() || hasSelfPaintingLayer())
addOverflowFromFloats();
}
@@ -1907,9 +1849,6 @@ void RenderBlockFlow::repaintOverflow()
else
repaintRect = LayoutRect(m_repaintLogicalTop, repaintLogicalLeft, m_repaintLogicalBottom - m_repaintLogicalTop, repaintLogicalRight - repaintLogicalLeft);
- // The repaint rect may be split across columns, in which case adjustRectForColumns() will return the union.
- adjustRectForColumns(repaintRect);
-
repaintRect.inflate(maximalOutlineSize(PaintPhaseOutline));
if (hasOverflowClip()) {
@@ -2397,7 +2336,7 @@ bool RenderBlockFlow::positionNewFloats()
bool RenderBlockFlow::hasOverhangingFloat(RenderBox* renderer)
{
- if (!m_floatingObjects || hasColumns() || !parent())
+ if (!m_floatingObjects || !parent())
return false;
const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set();
@@ -2446,7 +2385,7 @@ void RenderBlockFlow::addIntrudingFloats(RenderBlockFlow* prev, LayoutUnit logic
LayoutUnit RenderBlockFlow::addOverhangingFloats(RenderBlockFlow* child, bool makeChildPaintOtherFloats)
{
// Prevent floats from being added to the canvas by the root element, e.g., <html>.
- if (child->hasOverflowClip() || !child->containsFloats() || child->isRoot() || child->hasColumns() || child->isWritingModeRoot())
+ if (child->hasOverflowClip() || !child->containsFloats() || child->isRoot() || child->isWritingModeRoot())
return 0;
LayoutUnit childLogicalTop = child->logicalTop();
« no previous file with comments | « Source/core/rendering/RenderBlockFlow.h ('k') | Source/core/rendering/RenderBox.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698