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

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: add assert in adjustIntrinsicLogicalWidthsForColumns() 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..047c75c0a750d25d5d2eba96b13a9f0546670e23 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.
+ RenderBlockFlow* multicolContainer = multiColumnBlockFlow();
Julien - ping for review 2015/01/27 11:02:43 const RenderBlockFlow* (you're not supposed to mod
mstensho (USE GERRIT) 2015/01/27 11:54:42 Done.
+ 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);
+ }
+ // FIXME: 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.
Julien - ping for review 2015/01/27 11:02:43 In the end, is that really a FIXME? (seems like th
mstensho (USE GERRIT) 2015/01/27 11:54:41 Done.
+ 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