Fix aspect ratio when stretching with main axis margin #834

Closed
emilsjolander wants to merge 2 commits from aspect-ratio-with-margin into master
2 changed files with 31 additions and 0 deletions
Showing only changes of commit 58af41b546 - Show all commits

View File

@@ -1371,6 +1371,16 @@ static void YGNodeComputeFlexBasisForChild(
auto marginColumn = YGUnwrapFloatOptional(
child->getMarginForAxis(YGFlexDirectionColumn, ownerWidth));
if (YGNodeAlignItem(node, child) == YGAlignStretch) {
if (isMainAxisRow && !YGFloatIsUndefined(height)) {
childHeight = height;
childHeightMeasureMode = YGMeasureModeExactly;
} else if (!isMainAxisRow && !YGFloatIsUndefined(width)) {
childWidth = width;
childWidthMeasureMode = YGMeasureModeExactly;
}
}
if (isRowStyleDimDefined) {
childWidth =
YGUnwrapFloatOptional(YGResolveValue(