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

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

Issue 295373006: [New Multicolumn] Support for paged overflow. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 7 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
Index: Source/core/rendering/RenderMultiColumnSet.cpp
diff --git a/Source/core/rendering/RenderMultiColumnSet.cpp b/Source/core/rendering/RenderMultiColumnSet.cpp
index eee9aee2b43f70076d1e24d18b42c194744d8cd1..7311e3a30991dff23693f17ea58459514545cd1a 100644
--- a/Source/core/rendering/RenderMultiColumnSet.cpp
+++ b/Source/core/rendering/RenderMultiColumnSet.cpp
@@ -193,7 +193,7 @@ LayoutUnit RenderMultiColumnSet::calculateColumnHeight(BalancedHeightCalculation
void RenderMultiColumnSet::addContentRun(LayoutUnit endOffsetFromFirstPage)
{
- if (!multiColumnFlowThread()->requiresBalancing())
+ if (!multiColumnFlowThread()->heightIsAuto())
return;
if (!m_contentRuns.isEmpty() && endOffsetFromFirstPage <= m_contentRuns.last().breakOffset())
return;
@@ -205,7 +205,7 @@ void RenderMultiColumnSet::addContentRun(LayoutUnit endOffsetFromFirstPage)
bool RenderMultiColumnSet::recalculateColumnHeight(BalancedHeightCalculation calculationMode)
{
- ASSERT(multiColumnFlowThread()->requiresBalancing());
+ ASSERT(multiColumnFlowThread()->heightIsAuto());
LayoutUnit oldColumnHeight = m_columnHeight;
if (calculationMode == GuessFromFlowThreadPortion) {
@@ -254,7 +254,7 @@ void RenderMultiColumnSet::resetColumnHeight()
LayoutUnit oldColumnHeight = pageLogicalHeight();
- if (multiColumnFlowThread()->requiresBalancing())
+ if (multiColumnFlowThread()->heightIsAuto())
m_columnHeight = 0;
else
setAndConstrainColumnHeight(heightAdjustedForSetOffset(multiColumnFlowThread()->columnHeightAvailable()));
@@ -337,10 +337,15 @@ LayoutRect RenderMultiColumnSet::columnRectAt(unsigned index) const
LayoutUnit colLogicalTop = borderBefore() + paddingBefore();
LayoutUnit colLogicalLeft = borderAndPaddingLogicalLeft();
LayoutUnit colGap = columnGap();
- if (style()->isLeftToRightDirection())
- colLogicalLeft += index * (colLogicalWidth + colGap);
- else
- colLogicalLeft += contentLogicalWidth() - colLogicalWidth - index * (colLogicalWidth + colGap);
+
+ if (multiColumnFlowThread()->progressionIsInline()) {
+ if (style()->isLeftToRightDirection())
+ colLogicalLeft += index * (colLogicalWidth + colGap);
+ else
+ colLogicalLeft += contentLogicalWidth() - colLogicalWidth - index * (colLogicalWidth + colGap);
+ } else {
+ colLogicalTop += index * (colLogicalHeight + colGap);
+ }
if (isHorizontalWritingMode())
return LayoutRect(colLogicalLeft, colLogicalTop, colLogicalWidth, colLogicalHeight);
@@ -437,6 +442,9 @@ void RenderMultiColumnSet::paintColumnRules(PaintInfo& paintInfo, const LayoutPo
if (paintInfo.context->paintingDisabled())
return;
+ if (flowThread()->isRenderPagedFlowThread())
+ return;
+
RenderStyle* blockStyle = multiColumnBlockFlow()->style();
const Color& ruleColor = resolveColor(blockStyle, CSSPropertyWebkitColumnRuleColor);
bool ruleTransparent = blockStyle->columnRuleIsTransparent();
@@ -566,6 +574,12 @@ void RenderMultiColumnSet::collectLayerFragments(LayerFragments& fragments, cons
LayoutUnit colGap = columnGap();
unsigned colCount = actualColumnCount();
+ RenderMultiColumnFlowThread* flowThread = multiColumnFlowThread();
+ bool progressionIsInline = flowThread->progressionIsInline();
+ bool leftToRight = style()->isLeftToRightDirection();
+
+ LayoutUnit initialBlockOffset = logicalTop() - flowThread->logicalTop();
+
for (unsigned i = startColumn; i <= endColumn; i++) {
// Get the portion of the flow thread that corresponds to this column.
LayoutRect flowThreadPortion = flowThreadPortionRectAt(i);
@@ -582,11 +596,15 @@ void RenderMultiColumnSet::collectLayerFragments(LayerFragments& fragments, cons
// We also need to intersect the dirty rect. We have to apply a translation and shift based off
// our column index.
LayoutPoint translationOffset;
- LayoutUnit inlineOffset = i * (colLogicalWidth + colGap);
- if (!style()->isLeftToRightDirection())
+ LayoutUnit inlineOffset = progressionIsInline ? i * (colLogicalWidth + colGap) : LayoutUnit();
+ if (!leftToRight)
inlineOffset = -inlineOffset;
translationOffset.setX(inlineOffset);
- LayoutUnit blockOffset = isHorizontalWritingMode() ? -flowThreadPortion.y() : -flowThreadPortion.x();
+ LayoutUnit blockOffset;
+ if (progressionIsInline)
+ blockOffset = initialBlockOffset + (isHorizontalWritingMode() ? -flowThreadPortion.y() : -flowThreadPortion.x());
+ else
+ blockOffset = i * colGap;
rune 2014/06/18 22:09:05 I had to stare at this for a while. I think this w
rune 2014/06/19 09:22:19 Never mind renaming. This is in RenderMultiColumnS
if (isFlippedBlocksWritingMode(style()->writingMode()))
blockOffset = -blockOffset;
translationOffset.setY(blockOffset);
@@ -612,7 +630,7 @@ void RenderMultiColumnSet::collectLayerFragments(LayerFragments& fragments, cons
LayoutRect flippedFlowThreadOverflowPortion(flowThreadOverflowPortion);
// Flip it into more a physical (RenderLayer-style) rectangle.
- flowThread()->flipForWritingMode(flippedFlowThreadOverflowPortion);
+ flowThread->flipForWritingMode(flippedFlowThreadOverflowPortion);
fragment.paginationClip = flippedFlowThreadOverflowPortion;
fragments.append(fragment);
}

Powered by Google App Engine
This is Rietveld 408576698