Fixed failing snapshot test

Summary: Fixed failing snapshot test

Reviewed By: emilsjolander

Differential Revision: D6901242

fbshipit-source-id: 7391d6a34fa28e9f92f4ff834755a89dd876fdad
This commit is contained in:
Pritesh Nandgaonkar
2018-02-06 07:05:18 -08:00
committed by Facebook Github Bot
parent 9718c517d9
commit 1e775ecb83

View File

@@ -1705,7 +1705,7 @@ static YGCollectFlexItemsRowValues YGCalculateCollectFlexItemsRowValues(
// of the flex items abide the min and max constraints. At the end of this // of the flex items abide the min and max constraints. At the end of this
// function the child nodes would have proper size. Prior using this function // function the child nodes would have proper size. Prior using this function
// please ensure that YGDistributeFreeSpaceFirstPass is called. // please ensure that YGDistributeFreeSpaceFirstPass is called.
static void YGDistributeFreeSpaceSecondPass( static float YGDistributeFreeSpaceSecondPass(
YGCollectFlexItemsRowValues& collectedFlexItemsValues, YGCollectFlexItemsRowValues& collectedFlexItemsValues,
const YGNodeRef node, const YGNodeRef node,
const YGFlexDirection mainAxis, const YGFlexDirection mainAxis,
@@ -1774,7 +1774,7 @@ static void YGDistributeFreeSpaceSecondPass(
} }
} }
deltaFreeSpace -= updatedMainSize - childFlexBasis; deltaFreeSpace += updatedMainSize - childFlexBasis;
const float marginMain = YGNodeMarginForAxis( const float marginMain = YGNodeMarginForAxis(
currentRelativeChild, mainAxis, availableInnerWidth); currentRelativeChild, mainAxis, availableInnerWidth);
@@ -1878,8 +1878,7 @@ static void YGDistributeFreeSpaceSecondPass(
node->getLayout().hadOverflow | node->getLayout().hadOverflow |
currentRelativeChild->getLayout().hadOverflow); currentRelativeChild->getLayout().hadOverflow);
} }
return deltaFreeSpace;
collectedFlexItemsValues.remainingFreeSpace += deltaFreeSpace;
} }
// It distributes the free space to the flexible items.For those flexible items // It distributes the free space to the flexible items.For those flexible items
@@ -2002,6 +2001,7 @@ static void YGResolveFlexibleLength(
const YGMeasureMode measureModeCrossDim, const YGMeasureMode measureModeCrossDim,
const bool performLayout, const bool performLayout,
const YGConfigRef config) { const YGConfigRef config) {
const float originalFreeSpace = collectedFlexItemsValues.remainingFreeSpace;
// First pass: detect the flex items whose min/max constraints trigger // First pass: detect the flex items whose min/max constraints trigger
YGDistributeFreeSpaceFirstPass( YGDistributeFreeSpaceFirstPass(
collectedFlexItemsValues, collectedFlexItemsValues,
@@ -2011,7 +2011,7 @@ static void YGResolveFlexibleLength(
availableInnerWidth); availableInnerWidth);
// Second pass: resolve the sizes of the flexible items // Second pass: resolve the sizes of the flexible items
YGDistributeFreeSpaceSecondPass( const float distributedFreeSpace = YGDistributeFreeSpaceSecondPass(
collectedFlexItemsValues, collectedFlexItemsValues,
node, node,
mainAxis, mainAxis,
@@ -2025,6 +2025,9 @@ static void YGResolveFlexibleLength(
measureModeCrossDim, measureModeCrossDim,
performLayout, performLayout,
config); config);
collectedFlexItemsValues.remainingFreeSpace =
originalFreeSpace - distributedFreeSpace;
} }
// //