Change flex basis to override main axis size
Reviewed By: gkassabli Differential Revision: D4029374 fbshipit-source-id: bc3c72879f3937a50bf8a636b547adc7b9a4f5a7
This commit is contained in:
parent
2e06e708fe
commit
a9d94c2dfb
|
@ -839,7 +839,13 @@ static void computeChildFlexBasis(
|
||||||
CSSMeasureMode childWidthMeasureMode;
|
CSSMeasureMode childWidthMeasureMode;
|
||||||
CSSMeasureMode childHeightMeasureMode;
|
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.
|
// The width is definite, so use that as the flex basis.
|
||||||
child->layout.computedFlexBasis =
|
child->layout.computedFlexBasis =
|
||||||
fmaxf(child->style.dimensions[CSSDimensionWidth],
|
fmaxf(child->style.dimensions[CSSDimensionWidth],
|
||||||
|
@ -849,12 +855,6 @@ static void computeChildFlexBasis(
|
||||||
child->layout.computedFlexBasis =
|
child->layout.computedFlexBasis =
|
||||||
fmaxf(child->style.dimensions[CSSDimensionHeight],
|
fmaxf(child->style.dimensions[CSSDimensionHeight],
|
||||||
getPaddingAndBorderAxis(child, CSSFlexDirectionColumn));
|
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 {
|
} else {
|
||||||
// Compute the flex basis and hypothetical main size (i.e. the clamped
|
// Compute the flex basis and hypothetical main size (i.e. the clamped
|
||||||
// flex basis).
|
// flex basis).
|
||||||
|
|
Loading…
Reference in New Issue