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

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: Do not apply the modifications to tables which behave differently. Also there is no need to relayou… 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
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/css-intrinsic-dimensions/resources/intrinsic-size-contribution.css ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..f4f1e846b6df33fbfa69be5eb41cae33f587dace 100644
--- a/third_party/WebKit/Source/core/layout/LayoutBlock.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutBlock.cpp
@@ -2144,8 +2144,26 @@ void LayoutBlock::computeChildPreferredLogicalWidths(LayoutObject& child, Layout
minPreferredLogicalWidth = maxPreferredLogicalWidth = toLayoutBox(child).computeLogicalHeightWithoutLayout();
return;
}
- minPreferredLogicalWidth = child.minPreferredLogicalWidth();
- maxPreferredLogicalWidth = child.maxPreferredLogicalWidth();
+
+ if (child.isLayoutBlock() && !child.isTable() && !child.isReplaced()) {
mstensho (USE GERRIT) 2015/12/09 16:56:04 Why exclude table?
svillar 2015/12/09 17:41:32 Because there is a different section in the spec f
mstensho (USE GERRIT) 2015/12/09 19:17:33 This? http://imgur.com/osjEW7F I think we should
+ const Length& computedInlineSize = child.styleRef().logicalWidth();
+ if (computedInlineSize.isFitContent() || computedInlineSize.isFillAvailable() || computedInlineSize.isAuto()
+ || (computedInlineSize.hasPercent() && !toLayoutBox(child).percentageLogicalHeightIsResolvable())) {
+ minPreferredLogicalWidth = child.minPreferredLogicalWidth();
+ maxPreferredLogicalWidth = child.maxPreferredLogicalWidth();
+ } else {
+ ASSERT(computedInlineSize.isMinContent() || computedInlineSize.isMaxContent() || computedInlineSize.isSpecified());
+ LogicalExtentComputedValues computedValues;
+ toLayoutBlock(child).computeLogicalWidth(computedValues);
mstensho (USE GERRIT) 2015/12/09 16:56:04 How is this supposed to work if we haven't laid ou
svillar 2015/12/09 17:41:32 It will work because for min|max-content computeLo
mstensho (USE GERRIT) 2015/12/09 19:17:33 OK, that should work. But I still think my sugges
+ minPreferredLogicalWidth = maxPreferredLogicalWidth = computedValues.m_extent;
+ }
+ } 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;
}
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/css-intrinsic-dimensions/resources/intrinsic-size-contribution.css ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698