Allow aspect ratio to expand beyond bounds of parent

Reviewed By: passy

Differential Revision: D4397547

fbshipit-source-id: d2b1ca7b096f2f17b3efbd8f47a50678bfe7bb5f
This commit is contained in:
Emil Sjolander 2017-01-10 08:26:50 -08:00 коммит произвёл Facebook Github Bot
Родитель da428d6c3d
Коммит 7c2f8a9e14
1 изменённых файлов: 10 добавлений и 4 удалений

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

@ -2239,8 +2239,11 @@ static void YGNodelayoutImpl(const YGNodeRef node,
availableInnerWidth));
childHeightMeasureMode = YGMeasureModeExactly;
// Parent size constraint should have higher priority than flex
if (YGNodeIsFlex(currentRelativeChild)) {
childHeight = fminf(childHeight, availableInnerHeight);
childWidth = childHeight * currentRelativeChild->style.aspectRatio;
}
} else {
childWidth = fmaxf(childHeight * currentRelativeChild->style.aspectRatio,
YGNodePaddingAndBorderForAxis(currentRelativeChild,
@ -2248,10 +2251,13 @@ static void YGNodelayoutImpl(const YGNodeRef node,
availableInnerWidth));
childWidthMeasureMode = YGMeasureModeExactly;
// Parent size constraint should have higher priority than flex
if (YGNodeIsFlex(currentRelativeChild)) {
childWidth = fminf(childWidth, availableInnerWidth);
childHeight = childWidth / currentRelativeChild->style.aspectRatio;
}
}
}
YGConstrainMaxSizeForMode(
YGValueResolve(&currentRelativeChild->style.maxDimensions[YGDimensionWidth],