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

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

Issue 879483002: [New Multicolumn] Intrinsic/preferred logical width calculation for spanners. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: final code review Created 5 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
Index: Source/core/rendering/RenderMultiColumnFlowThread.cpp
diff --git a/Source/core/rendering/RenderMultiColumnFlowThread.cpp b/Source/core/rendering/RenderMultiColumnFlowThread.cpp
index 0af35bb74c94ec0857dcca363d101b7b783835b1..5657d2ccf9594d7215d6e1004104400cd92b61cc 100644
--- a/Source/core/rendering/RenderMultiColumnFlowThread.cpp
+++ b/Source/core/rendering/RenderMultiColumnFlowThread.cpp
@@ -580,6 +580,32 @@ void RenderMultiColumnFlowThread::flowThreadDescendantWillBeRemoved(RenderObject
columnSetToRemove->destroy();
}
+void RenderMultiColumnFlowThread::computePreferredLogicalWidths()
+{
+ RenderFlowThread::computePreferredLogicalWidths();
+
+ // The min/max intrinsic widths calculated really tell how much space elements need when
+ // laid out inside the columns. In order to eventually end up with the desired column width,
+ // we need to convert them to values pertaining to the multicol container.
+ const RenderBlockFlow* multicolContainer = multiColumnBlockFlow();
+ const RenderStyle* multicolStyle = multicolContainer->style();
+ int columnCount = multicolStyle->hasAutoColumnCount() ? 1 : multicolStyle->columnCount();
+ LayoutUnit columnWidth;
+ LayoutUnit gapExtra = (columnCount - 1) * multicolContainer->columnGap();
+ if (multicolStyle->hasAutoColumnWidth()) {
+ m_minPreferredLogicalWidth = m_minPreferredLogicalWidth * columnCount + gapExtra;
+ } else {
+ columnWidth = multicolStyle->columnWidth();
+ m_minPreferredLogicalWidth = std::min(m_minPreferredLogicalWidth, columnWidth);
+ }
+ // Note that if column-count is auto here, we should resolve it to calculate the maximum
+ // intrinsic width, instead of pretending that it's 1. The only way to do that is by performing
+ // a layout pass, but this is not an appropriate time or place for layout. The good news is that
+ // if height is unconstrained and there are no explicit breaks, the resolved column-count really
+ // should be 1.
+ m_maxPreferredLogicalWidth = std::max(m_maxPreferredLogicalWidth, columnWidth) * columnCount + gapExtra;
+}
+
void RenderMultiColumnFlowThread::computeLogicalHeight(LayoutUnit logicalHeight, LayoutUnit logicalTop, LogicalExtentComputedValues& computedValues) const
{
// We simply remain at our intrinsic height.
« no previous file with comments | « Source/core/rendering/RenderMultiColumnFlowThread.h ('k') | Source/core/rendering/RenderMultiColumnSpannerPlaceholder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698