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

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: Reworked patch & tests 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 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;
}
« 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