Fix Yoga flexshrink with min-width sizing issue

Summary:
While resolving the flexible items we calculate totalFlexShrinkScaledFactors which uses the flexBasis or initial width of node (Not min-width).

At a later stage during distribution of space we are subtracting value from this which also takes care of min-width.

For example
If node has flexShrink 1 and width 100 and min-width 301  then totalFlexShrinkScaledFactors will become -1*100 = -100
but later we are subtracting -1 * 301 (min-width) = -301 which is ambiguous and causing layout inconsistencies with how web behaves.

Fixed this by only using the flexBasis or width for these calculations.

Changelog:
[Internal][Yoga] Fix layout issue when flexShrink and min-width are used together

Reviewed By: pasqualeanatriello

Differential Revision: D20219419

fbshipit-source-id: 948fbc06ca541d4ad307c88c8a2df65d157778b1
This commit is contained in:
Sidharth Guglani 2020-04-01 14:37:45 -07:00 коммит произвёл Facebook GitHub Bot
Родитель 8970ee9f32
Коммит 2e085a388b
2 изменённых файлов: 7 добавлений и 1 удалений

Просмотреть файл

@ -0,0 +1,5 @@
---
Checks: '>
clang-diagnostic-*,
'
...

Просмотреть файл

@ -2338,7 +2338,8 @@ static void YGDistributeFreeSpaceFirstPass(
// first and second passes.
deltaFreeSpace += boundMainSize - childFlexBasis;
collectedFlexItemsValues.totalFlexShrinkScaledFactors -=
flexShrinkScaledFactor;
(-currentRelativeChild->resolveFlexShrink() *
currentRelativeChild->getLayout().computedFlexBasis.unwrap());
}
}
} else if (