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 0a7572f7a7f0e4aa2ec4a84f2e3f2b828c1c6118..356840210efd670620905492f9456e0805c76514 100644 |
--- a/third_party/WebKit/Source/core/layout/LayoutBlock.cpp |
+++ b/third_party/WebKit/Source/core/layout/LayoutBlock.cpp |
@@ -2144,8 +2144,27 @@ void LayoutBlock::computeChildPreferredLogicalWidths(LayoutObject& child, Layout |
minPreferredLogicalWidth = maxPreferredLogicalWidth = toLayoutBox(child).computeLogicalHeightWithoutLayout(); |
return; |
} |
- minPreferredLogicalWidth = child.minPreferredLogicalWidth(); |
- maxPreferredLogicalWidth = child.maxPreferredLogicalWidth(); |
+ |
+ if (child.isLayoutBlock() && !child.isReplaced()) { |
+ const Length& computedInlineSize = child.styleRef().logicalWidth(); |
+ LayoutBlock& blockChild = toLayoutBlock(child); |
+ if (computedInlineSize.isFitContent() || computedInlineSize.isFillAvailable() || computedInlineSize.isAuto() |
+ || (computedInlineSize.hasPercent() && !toLayoutBox(child).percentageLogicalHeightIsResolvable())) { |
+ minPreferredLogicalWidth = blockChild.minPreferredLogicalWidth(); |
+ maxPreferredLogicalWidth = blockChild.maxPreferredLogicalWidth(); |
+ } else { |
+ ASSERT(computedInlineSize.isMinContent() || computedInlineSize.isMaxContent() || computedInlineSize.isSpecified()); |
mstensho (USE GERRIT)
2015/12/09 13:19:52
This is heavy. Start with bogus initial values. La
|
+ m_needsRecalcLogicalWidthAfterLayoutChildren = child.needsLayout(); |
+ minPreferredLogicalWidth = blockChild.logicalWidth(); |
+ maxPreferredLogicalWidth = blockChild.logicalWidth(); |
+ } |
+ } else { |
+ // TODO(svillar): we leave the original implementation as default fallback. Still need to specialcase |
+ // some other situations: https://drafts.csswg.org/css-sizing/#intrinsic |
+ minPreferredLogicalWidth = child.minPreferredLogicalWidth(); |
+ maxPreferredLogicalWidth = child.maxPreferredLogicalWidth(); |
+ } |
+ |
if (child.isLayoutBlock() && toLayoutBlock(child).needsRecalcLogicalWidthAfterLayoutChildren()) |
m_needsRecalcLogicalWidthAfterLayoutChildren = true; |
} |