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

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

Issue 1870163004: [css-flexbox] slight improvements to mainSizeForPercentageResolution (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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
« no previous file with comments | « no previous file | 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/LayoutFlexibleBox.cpp
diff --git a/third_party/WebKit/Source/core/layout/LayoutFlexibleBox.cpp b/third_party/WebKit/Source/core/layout/LayoutFlexibleBox.cpp
index 382d87c48c8c460ef294f8eb247b94af338adc53..b517444e81864051b7b341e750143b5522341242 100644
--- a/third_party/WebKit/Source/core/layout/LayoutFlexibleBox.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutFlexibleBox.cpp
@@ -1109,9 +1109,14 @@ LayoutUnit LayoutFlexibleBox::mainSizeForPercentageResolution(const LayoutBox& c
const Length& flexBasis = flexBasisForChild(child);
if (!mainAxisLengthIsDefinite(child, flexBasis))
return LayoutUnit(-1);
- LayoutUnit mainSize = isColumnFlow() ? computeDefiniteLogicalHeight() : computeDefiniteLogicalWidth();
- if (mainSize == LayoutUnit(-1))
- return mainSize;
+ if (!flexBasis.hasPercent()) {
+ // If flex basis had a percentage, our size is guaranteed to be definite or the flex item's
+ // size could not be definite.
+ // Otherwise, we make up a percentage to check whether we have a definite size.
+ // TODO(cbiesinger): cache this somewhere
+ if (!mainAxisLengthIsDefinite(child, Length(0, Percent)))
+ return LayoutUnit(-1);
+ }
if (hasOrthogonalFlow(child))
return child.hasOverrideLogicalContentHeight() ? child.overrideLogicalContentHeight() : LayoutUnit(-1);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698