Change flex basis to override main axis size

Summary: Flex basis should override height/width. Not the other way around.

Reviewed By: gkassabli

Differential Revision: D4029374

fbshipit-source-id: bc3c72879f3937a50bf8a636b547adc7b9a4f5a7
This commit is contained in:
Emil Sjolander
2016-10-19 06:39:34 -07:00
committed by Facebook Github Bot
parent fa2ffc72a4
commit e4ad7d3c12
2 changed files with 80 additions and 7 deletions

View File

@@ -839,7 +839,13 @@ static void computeChildFlexBasis(
CSSMeasureMode childWidthMeasureMode;
CSSMeasureMode childHeightMeasureMode;
if (isMainAxisRow && isStyleDimDefined(child, CSSFlexDirectionRow)) {
if (!CSSValueIsUndefined(child->style.flexBasis) &&
!CSSValueIsUndefined(isMainAxisRow ? width : height)) {
if (CSSValueIsUndefined(child->layout.computedFlexBasis)) {
child->layout.computedFlexBasis =
fmaxf(child->style.flexBasis, getPaddingAndBorderAxis(child, mainAxis));
}
} else if (isMainAxisRow && isStyleDimDefined(child, CSSFlexDirectionRow)) {
// The width is definite, so use that as the flex basis.
child->layout.computedFlexBasis =
fmaxf(child->style.dimensions[CSSDimensionWidth],
@@ -849,12 +855,6 @@ static void computeChildFlexBasis(
child->layout.computedFlexBasis =
fmaxf(child->style.dimensions[CSSDimensionHeight],
getPaddingAndBorderAxis(child, CSSFlexDirectionColumn));
} else if (!CSSValueIsUndefined(child->style.flexBasis) &&
!CSSValueIsUndefined(isMainAxisRow ? width : height)) {
if (CSSValueIsUndefined(child->layout.computedFlexBasis)) {
child->layout.computedFlexBasis =
fmaxf(child->style.flexBasis, getPaddingAndBorderAxis(child, mainAxis));
}
} else {
// Compute the flex basis and hypothetical main size (i.e. the clamped
// flex basis).