From e5743e851bde6611529a8c57401ad6445ca57b32 Mon Sep 17 00:00:00 2001 From: Sidharth Guglani Date: Tue, 14 Apr 2020 02:04:17 -0700 Subject: [PATCH] Set width/height also to Undefined when we change the measure mode to Undefined Summary: Make sure width/height is always passed as Undefined when measure mode is changed to Undefined. Changelog: [Internal][Yoga] Set width and height as Undefined when we change measure mode to Undefined Reviewed By: alickbass Differential Revision: D20029838 fbshipit-source-id: b9931f6ddb13ffd1565889535ade5bbffbe0c304 --- yoga/Yoga.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/yoga/Yoga.cpp b/yoga/Yoga.cpp index d916a45f..d6f4a114 100644 --- a/yoga/Yoga.cpp +++ b/yoga/Yoga.cpp @@ -1663,8 +1663,8 @@ static void YGNodeAbsoluteLayoutChild( static void YGNodeWithMeasureFuncSetMeasuredDimensions( const YGNodeRef node, - const float availableWidth, - const float availableHeight, + float availableWidth, + float availableHeight, const YGMeasureMode widthMeasureMode, const YGMeasureMode heightMeasureMode, const float ownerWidth, @@ -1677,6 +1677,13 @@ static void YGNodeWithMeasureFuncSetMeasuredDimensions( node->hasMeasureFunc(), "Expected node to have custom measure function"); + if (widthMeasureMode == YGMeasureModeUndefined) { + availableWidth = YGUndefined; + } + if (heightMeasureMode == YGMeasureModeUndefined) { + availableHeight = YGUndefined; + } + const float paddingAndBorderAxisRow = YGNodePaddingAndBorderForAxis(node, YGFlexDirectionRow, ownerWidth); const float paddingAndBorderAxisColumn =