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

Unified Diff: third_party/WebKit/Source/core/layout/LayoutBlock.cpp

Issue 1504403002: Fix computation of min|max-content contribution of non-replaced blocks (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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: 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;
}

Powered by Google App Engine
This is Rietveld 408576698