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

Unified Diff: Source/core/rendering/RenderFlexibleBox.cpp

Issue 289903007: Inline flexbox width is wrongly calculated when wrapping vertically (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 7 months 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: Source/core/rendering/RenderFlexibleBox.cpp
diff --git a/Source/core/rendering/RenderFlexibleBox.cpp b/Source/core/rendering/RenderFlexibleBox.cpp
index 2395e4a874a331f929f40bc64fa489fd9b48fc2c..ad224368fd5a11e1116fd7f08adeb02a30dd4f1b 100644
--- a/Source/core/rendering/RenderFlexibleBox.cpp
+++ b/Source/core/rendering/RenderFlexibleBox.cpp
@@ -96,6 +96,16 @@ void RenderFlexibleBox::computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidt
// FIXME: We're ignoring flex-basis here and we shouldn't. We can't start honoring it though until
// the flex shorthand stops setting it to 0.
// See https://bugs.webkit.org/show_bug.cgi?id=116117 and http://crbug.com/240765.
+ float totalChildHeight = 0;
+
+ for (RenderBox* child = firstChildBox(); child; child = child->nextSiblingBox()) {
+ if (child->isOutOfFlowPositioned())
+ continue;
+ totalChildHeight += child->style()->height().value();
tony 2014/05/19 16:14:43 Is this correct? What about min-height? Also, it
harpreet.sk 2014/07/18 15:46:48 Sorry this is incorrect. It not correct to use hei
+ }
+
+ bool boxMightWrap = totalChildHeight > this->style()->height().value();
+
for (RenderBox* child = firstChildBox(); child; child = child->nextSiblingBox()) {
if (child->isOutOfFlowPositioned())
continue;
@@ -115,7 +125,7 @@ void RenderFlexibleBox::computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidt
minLogicalWidth += minPreferredLogicalWidth;
} else {
minLogicalWidth = std::max(minPreferredLogicalWidth, minLogicalWidth);
- if (isMultiline()) {
+ if (isMultiline() && boxMightWrap) {
tony 2014/05/19 16:14:43 If boxMightWrap is true, then we assume that all t
harpreet.sk 2014/07/18 15:46:49 Done.
// For multiline, the max preferred width is if you never break between items.
maxLogicalWidth += maxPreferredLogicalWidth;
} else

Powered by Google App Engine
This is Rietveld 408576698