Dont measure single flex grow+shrink child

Summary:
If there is a single child which is flex grow and flex shrink then instead of measuring and then shrinking we can just set the flex basis to zero as we know the final result will be that the child take up all remaining space.

This is a re-land of D4147298. I have updated the diff to check explicitly for exact measure mode to also handle at_most case correctly.

Reviewed By: gkassabli

Differential Revision: D4153133

fbshipit-source-id: 2333150a83857cc30078cc8d52761cbd00652830
This commit is contained in:
Emil Sjolander
2016-11-09 11:23:21 -08:00
committed by Facebook Github Bot
parent 863378d74e
commit a253c6fbb7
8 changed files with 260 additions and 38 deletions

View File

@@ -17,7 +17,8 @@ static CSSSize _measureMax(CSSNodeRef node,
CSSMeasureMode heightMode) {
int *measureCount = (int *)CSSNodeGetContext(node);
*measureCount = *measureCount + 1;
(*measureCount)++;
return CSSSize {
.width = widthMode == CSSMeasureModeUndefined ? 10 : width,
.height = heightMode == CSSMeasureModeUndefined ? 10 : height,