Index: third_party/WebKit/Source/core/layout/LayoutBlock.cpp |
diff --git a/third_party/WebKit/Source/core/layout/LayoutBlock.cpp b/third_party/WebKit/Source/core/layout/LayoutBlock.cpp |
index ecc2c5f603b3f702b735d680bb7c5d9a35b678e4..6a0b95bf6a2c827dcf34c20f26052341555cfba8 100644 |
--- a/third_party/WebKit/Source/core/layout/LayoutBlock.cpp |
+++ b/third_party/WebKit/Source/core/layout/LayoutBlock.cpp |
@@ -2126,6 +2126,17 @@ void LayoutBlock::computeChildPreferredLogicalWidths(LayoutObject& child, Layout |
} |
minPreferredLogicalWidth = child.minPreferredLogicalWidth(); |
maxPreferredLogicalWidth = child.maxPreferredLogicalWidth(); |
+ |
+ // For non-replaced blocks if the inline size is min|max-content or a definite size the min|max-content contribution |
+ // is that size plus border, padding and margin https://drafts.csswg.org/css-sizing/#block-intrinsic |
+ if (child.isLayoutBlock()) { |
+ const Length& computedInlineSize = child.styleRef().logicalWidth(); |
+ if (computedInlineSize.isMaxContent()) |
+ minPreferredLogicalWidth = maxPreferredLogicalWidth; |
+ else if (computedInlineSize.isMinContent()) |
+ maxPreferredLogicalWidth = minPreferredLogicalWidth; |
+ } |
+ |
if (child.isLayoutBlock() && toLayoutBlock(child).needsRecalcLogicalWidthAfterLayoutChildren()) |
m_needsRecalcLogicalWidthAfterLayoutChildren = true; |
} |