Include margin when calculating if children overflow

Reviewed By: passy

Differential Revision: D5044471

fbshipit-source-id: e7c1eb694445ffb898bcf375d9deefc558c49f11
This commit is contained in:
Emil Sjolander 2017-05-12 09:03:23 -07:00 committed by Facebook Github Bot
parent 54548894d0
commit 67b96fc0ce
1 changed files with 7 additions and 4 deletions

View File

@ -2109,7 +2109,7 @@ static void YGNodelayoutImpl(const YGNodeRef node,
}
}
float totalFlexBasis = 0;
float totalOuterFlexBasis = 0;
// STEP 3: DETERMINE FLEX BASIS FOR EACH ITEM
for (uint32_t i = 0; i < childCount; i++) {
@ -2162,11 +2162,14 @@ static void YGNodelayoutImpl(const YGNodeRef node,
}
}
totalFlexBasis += child->layout.computedFlexBasis;
totalOuterFlexBasis +=
child->layout.computedFlexBasis + YGNodeMarginForAxis(child, mainAxis, availableInnerWidth);
;
}
const bool flexBasisOverflows =
measureModeMainDim == YGMeasureModeUndefined ? false : totalFlexBasis > availableInnerMainDim;
const bool flexBasisOverflows = measureModeMainDim == YGMeasureModeUndefined
? false
: totalOuterFlexBasis > availableInnerMainDim;
if (isNodeFlexWrap && flexBasisOverflows && measureModeMainDim == YGMeasureModeAtMost) {
measureModeMainDim = YGMeasureModeExactly;
}