Revert D9286928: [yoga] Solve width bug when the size is less than min

Differential Revision:
D9286928

Original commit changeset: 915269602cda

fbshipit-source-id: a4c23bf335b82fbbf3928a524a61374a6cf6ffb1
This commit is contained in:
Roman Kushnarenko 2018-08-16 03:12:17 -07:00 committed by Facebook Github Bot
parent af49568482
commit f0631b11f5
1 changed files with 12 additions and 5 deletions

View File

@ -2396,13 +2396,20 @@ static void YGJustifyMainAxis(
const bool& performLayout) { const bool& performLayout) {
const YGStyle& style = node->getStyle(); const YGStyle& style = node->getStyle();
// If we are using "at most" rules in the main axis, make sure that // If we are using "at most" rules in the main axis. Calculate the remaining
// remainingFreeSpace is 0 when min main dimension is not given // space when constraint by the min size defined for the main axis.
if (measureModeMainDim == YGMeasureModeAtMost && if (measureModeMainDim == YGMeasureModeAtMost &&
collectedFlexItemsValues.remainingFreeSpace > 0) { collectedFlexItemsValues.remainingFreeSpace > 0) {
if (style.minDimensions[dim[mainAxis]].unit == YGUnitUndefined || if (style.minDimensions[dim[mainAxis]].unit != YGUnitUndefined &&
YGResolveValue(style.minDimensions[dim[mainAxis]], mainAxisownerSize) !YGResolveValue(style.minDimensions[dim[mainAxis]], mainAxisownerSize)
.isUndefined()) { .isUndefined()) {
collectedFlexItemsValues.remainingFreeSpace = YGFloatMax(
0,
YGUnwrapFloatOptional(YGResolveValue(
style.minDimensions[dim[mainAxis]], mainAxisownerSize)) -
(availableInnerMainDim -
collectedFlexItemsValues.remainingFreeSpace));
} else {
collectedFlexItemsValues.remainingFreeSpace = 0; collectedFlexItemsValues.remainingFreeSpace = 0;
} }
} }