Allow aspect ratio to expand beyond bounds of parent
Reviewed By: passy Differential Revision: D4397547 fbshipit-source-id: d2b1ca7b096f2f17b3efbd8f47a50678bfe7bb5f
This commit is contained in:
parent
da428d6c3d
commit
7c2f8a9e14
|
@ -2239,8 +2239,11 @@ static void YGNodelayoutImpl(const YGNodeRef node,
|
||||||
availableInnerWidth));
|
availableInnerWidth));
|
||||||
childHeightMeasureMode = YGMeasureModeExactly;
|
childHeightMeasureMode = YGMeasureModeExactly;
|
||||||
|
|
||||||
childHeight = fminf(childHeight, availableInnerHeight);
|
// Parent size constraint should have higher priority than flex
|
||||||
childWidth = childHeight * currentRelativeChild->style.aspectRatio;
|
if (YGNodeIsFlex(currentRelativeChild)) {
|
||||||
|
childHeight = fminf(childHeight, availableInnerHeight);
|
||||||
|
childWidth = childHeight * currentRelativeChild->style.aspectRatio;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
childWidth = fmaxf(childHeight * currentRelativeChild->style.aspectRatio,
|
childWidth = fmaxf(childHeight * currentRelativeChild->style.aspectRatio,
|
||||||
YGNodePaddingAndBorderForAxis(currentRelativeChild,
|
YGNodePaddingAndBorderForAxis(currentRelativeChild,
|
||||||
|
@ -2248,8 +2251,11 @@ static void YGNodelayoutImpl(const YGNodeRef node,
|
||||||
availableInnerWidth));
|
availableInnerWidth));
|
||||||
childWidthMeasureMode = YGMeasureModeExactly;
|
childWidthMeasureMode = YGMeasureModeExactly;
|
||||||
|
|
||||||
childWidth = fminf(childWidth, availableInnerWidth);
|
// Parent size constraint should have higher priority than flex
|
||||||
childHeight = childWidth / currentRelativeChild->style.aspectRatio;
|
if (YGNodeIsFlex(currentRelativeChild)) {
|
||||||
|
childWidth = fminf(childWidth, availableInnerWidth);
|
||||||
|
childHeight = childWidth / currentRelativeChild->style.aspectRatio;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue