Index: Source/core/rendering/RenderBlock.cpp |
diff --git a/Source/core/rendering/RenderBlock.cpp b/Source/core/rendering/RenderBlock.cpp |
index e0d02f6d870ea9ff9a3ad3318a8ab27db2b15446..967e669c5fa58f34e4c80478d56fecf99ead6c5c 100644 |
--- a/Source/core/rendering/RenderBlock.cpp |
+++ b/Source/core/rendering/RenderBlock.cpp |
@@ -5711,6 +5711,8 @@ void RenderBlock::computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidth, Lay |
maxLogicalWidth = max(minLogicalWidth, maxLogicalWidth); |
+ adjustIntrinsicLogicalWidthsForColumns(minLogicalWidth, maxLogicalWidth); |
+ |
// A horizontal marquee with inline children has no minimum width. |
if (childrenInline() && isMarquee() && toRenderMarquee(this)->isHorizontal()) |
minLogicalWidth = 0; |
@@ -5767,6 +5769,33 @@ void RenderBlock::computePreferredLogicalWidths() |
clearPreferredLogicalWidthsDirty(); |
} |
+void RenderBlock::adjustIntrinsicLogicalWidthsForColumns(LayoutUnit& minLogicalWidth, LayoutUnit& maxLogicalWidth) const |
+{ |
+ // FIXME: make this method virtual and move the code to RenderMultiColumnBlock once the old |
+ // multicol code is gone. |
+ |
+ if (!style()->hasAutoColumnCount() || !style()->hasAutoColumnWidth()) { |
+ // 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. |
+ int columnCount = style()->hasAutoColumnCount() ? 1 : style()->columnCount(); |
+ LayoutUnit columnWidth; |
+ LayoutUnit gapExtra = (columnCount - 1) * columnGap(); |
+ if (style()->hasAutoColumnWidth()) { |
+ minLogicalWidth = minLogicalWidth * columnCount + gapExtra; |
+ } else { |
+ columnWidth = style()->columnWidth(); |
+ minLogicalWidth = min(minLogicalWidth, 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. |
+ maxLogicalWidth = max(maxLogicalWidth, columnWidth) * columnCount + gapExtra; |
+ } |
+} |
+ |
struct InlineMinMaxIterator { |
/* InlineMinMaxIterator is a class that will iterate over all render objects that contribute to |
inline min/max width calculations. Note the following about the way it walks: |