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

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

Issue 584033002: [New Multicolumn] Add support for column-span:all (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fix ref in test. Tables don't do subpixel, and that made a difference on Windows and Mac. Created 6 years, 2 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/RenderMultiColumnSet.h ('k') | Source/core/rendering/RenderMultiColumnSpannerSet.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/rendering/RenderMultiColumnSet.cpp
diff --git a/Source/core/rendering/RenderMultiColumnSet.cpp b/Source/core/rendering/RenderMultiColumnSet.cpp
index efb34c280b22c0ba73502a33796ec30e7e58f589..8d9023d3691a8abb6608d4916aef2c47f48a691d 100644
--- a/Source/core/rendering/RenderMultiColumnSet.cpp
+++ b/Source/core/rendering/RenderMultiColumnSet.cpp
@@ -71,6 +71,42 @@ RenderMultiColumnSet* RenderMultiColumnSet::previousSiblingMultiColumnSet() cons
return 0;
}
+void RenderMultiColumnSet::setLogicalTopInFlowThread(LayoutUnit logicalTop)
+{
+ LayoutRect rect = flowThreadPortionRect();
+ if (isHorizontalWritingMode())
+ rect.setY(logicalTop);
+ else
+ rect.setX(logicalTop);
+ setFlowThreadPortionRect(rect);
+}
+
+void RenderMultiColumnSet::setLogicalBottomInFlowThread(LayoutUnit logicalBottom)
+{
+ LayoutRect rect = flowThreadPortionRect();
+ if (isHorizontalWritingMode())
+ rect.shiftMaxYEdgeTo(logicalBottom);
+ else
+ rect.shiftMaxXEdgeTo(logicalBottom);
+ setFlowThreadPortionRect(rect);
+}
+
+bool RenderMultiColumnSet::heightIsAuto() const
+{
+ RenderMultiColumnFlowThread* flowThread = multiColumnFlowThread();
+ if (!flowThread->isRenderPagedFlowThread()) {
+ if (RenderMultiColumnSet* next = nextSiblingMultiColumnSet()) {
+ if (next->isRenderMultiColumnSpannerSet()) {
+ // If we're followed by a spanner, we need to balance.
+ return true;
+ }
+ }
+ if (multiColumnBlockFlow()->style()->columnFill() == ColumnFillBalance)
+ return true;
+ }
+ return !flowThread->columnHeightAvailable();
+}
+
LayoutSize RenderMultiColumnSet::flowThreadTranslationAtOffset(LayoutUnit blockOffset) const
{
unsigned columnIndex = columnIndexAtOffset(blockOffset);
@@ -194,7 +230,7 @@ LayoutUnit RenderMultiColumnSet::calculateColumnHeight(BalancedHeightCalculation
void RenderMultiColumnSet::addContentRun(LayoutUnit endOffsetFromFirstPage)
{
- if (!multiColumnFlowThread()->heightIsAuto())
+ if (!requiresBalancing())
return;
if (!m_contentRuns.isEmpty() && endOffsetFromFirstPage <= m_contentRuns.last().breakOffset())
return;
@@ -206,21 +242,27 @@ void RenderMultiColumnSet::addContentRun(LayoutUnit endOffsetFromFirstPage)
bool RenderMultiColumnSet::recalculateColumnHeight(BalancedHeightCalculation calculationMode)
{
- ASSERT(multiColumnFlowThread()->heightIsAuto());
-
LayoutUnit oldColumnHeight = m_columnHeight;
- if (calculationMode == GuessFromFlowThreadPortion) {
- // Post-process the content runs and find out where the implicit breaks will occur.
- distributeImplicitBreaks();
- }
- LayoutUnit newColumnHeight = calculateColumnHeight(calculationMode);
- setAndConstrainColumnHeight(newColumnHeight);
- // After having calculated an initial column height, the multicol container typically needs at
- // least one more layout pass with a new column height, but if a height was specified, we only
- // need to do this if we think that we need less space than specified. Conversely, if we
- // determined that the columns need to be as tall as the specified height of the container, we
- // have already laid it out correctly, and there's no need for another pass.
+ m_maxColumnHeight = calculateMaxColumnHeight();
+
+ if (heightIsAuto()) {
+ if (calculationMode == GuessFromFlowThreadPortion) {
+ // Post-process the content runs and find out where the implicit breaks will occur.
+ distributeImplicitBreaks();
+ }
+ LayoutUnit newColumnHeight = calculateColumnHeight(calculationMode);
+ setAndConstrainColumnHeight(newColumnHeight);
+ // After having calculated an initial column height, the multicol container typically needs at
+ // least one more layout pass with a new column height, but if a height was specified, we only
+ // need to do this if we think that we need less space than specified. Conversely, if we
+ // determined that the columns need to be as tall as the specified height of the container, we
+ // have already laid it out correctly, and there's no need for another pass.
+ } else {
+ // The position of the column set may have changed, in which case height available for
+ // columns may have changed as well.
+ setAndConstrainColumnHeight(m_columnHeight);
+ }
// We can get rid of the content runs now, if we haven't already done so. They are only needed
// to calculate the initial balanced column height. In fact, we have to get rid of them before
@@ -255,7 +297,7 @@ void RenderMultiColumnSet::resetColumnHeight()
LayoutUnit oldColumnHeight = pageLogicalHeight();
- if (multiColumnFlowThread()->heightIsAuto())
+ if (heightIsAuto())
m_columnHeight = 0;
else
setAndConstrainColumnHeight(heightAdjustedForSetOffset(multiColumnFlowThread()->columnHeightAvailable()));
« no previous file with comments | « Source/core/rendering/RenderMultiColumnSet.h ('k') | Source/core/rendering/RenderMultiColumnSpannerSet.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698