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

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

Issue 16943008: Column balancing support in the region based multicol implementation. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 6 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.h
diff --git a/Source/core/rendering/RenderMultiColumnSet.h b/Source/core/rendering/RenderMultiColumnSet.h
index bd5b0cd52b07573b6bbe1e325ee7d0fc2699fb1e..a0d27926fae36e4c24f7a4bc4a8118d3a9c1c051 100644
--- a/Source/core/rendering/RenderMultiColumnSet.h
+++ b/Source/core/rendering/RenderMultiColumnSet.h
@@ -56,10 +56,8 @@ public:
m_computedColumnWidth = width;
m_computedColumnCount = count;
}
- void setComputedColumnHeight(LayoutUnit height)
- {
- m_computedColumnHeight = height;
- }
+
+ LayoutUnit heightAdjustedForSetOffset(LayoutUnit height) const;
void updateMinimumColumnHeight(LayoutUnit height) { m_minimumColumnHeight = std::max(height, m_minimumColumnHeight); }
LayoutUnit minimumColumnHeight() const { return m_minimumColumnHeight; }
@@ -84,12 +82,21 @@ public:
m_forcedBreakOffset = offsetFromFirstPage;
}
- bool requiresBalancing() const { return m_requiresBalancing; }
- void setRequiresBalancing(bool balancing) { m_requiresBalancing = balancing; }
+ // Calculate the column height when contents are supposed to be balanced. If 'initial' is set,
+ // guess an initial column height; otherwise, stretch the column height a tad. Return true if
+ // column height changed and another layout pass is required.
+ bool calculateBalancedHeight(bool initial);
+
+ // Record space shortage (the amount of space that would have been enough to prevent some
+ // element from being moved to the next column) at a column break. The smallest amount of space
+ // shortage we find is the amount with which we will stretch the column height, if it turns out
+ // after layout that the columns weren't tall enough.
+ void recordSpaceShortage(LayoutUnit spaceShortage);
virtual void updateLogicalWidth() OVERRIDE;
- virtual void updateLogicalHeight() OVERRIDE;
-
+
+ void prepareForLayout();
+
private:
RenderMultiColumnSet(RenderFlowThread*);
@@ -123,15 +130,22 @@ private:
LayoutRect flowThreadPortionRectAt(unsigned index) const;
LayoutRect flowThreadPortionOverflowRect(const LayoutRect& flowThreadPortion, unsigned index, unsigned colCount, LayoutUnit colGap) const;
-
- unsigned columnIndexAtOffset(LayoutUnit) const;
-
+
+ enum ColumnIndexCalculationMode {
+ ClampToExistingColumns, // Stay within the range of already existing columns.
+ AssumeNewColumns // Allow column indices outside the range of already existing columns.
+ };
+ unsigned columnIndexAtOffset(LayoutUnit, ColumnIndexCalculationMode = ClampToExistingColumns) const;
+
+ void setAndConstrainColumnHeight(LayoutUnit);
+
unsigned m_computedColumnCount;
LayoutUnit m_computedColumnWidth;
LayoutUnit m_computedColumnHeight;
// The following variables are used when balancing the column set.
- bool m_requiresBalancing; // Whether or not the columns in the column set have to be balanced, i.e., made to be similar logical heights.
+ LayoutUnit m_maxColumnHeight; // Maximum column height allowed.
+ LayoutUnit m_minSpaceShortage; // The smallest amout of space shortage that caused a column break.
LayoutUnit m_minimumColumnHeight;
unsigned m_forcedBreaksCount; // FIXME: We will ultimately need to cache more information to balance around forced breaks properly.
LayoutUnit m_maximumDistanceBetweenForcedBreaks;
« no previous file with comments | « Source/core/rendering/RenderMultiColumnFlowThread.cpp ('k') | Source/core/rendering/RenderMultiColumnSet.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698