Fix flex within max width constraint
Summary: Max dimension constraints were not correctly passed down to children. see https://github.com/facebook/css-layout/issues/230 for more info fixes #230 Reviewed By: gkassabli Differential Revision: D4147199 fbshipit-source-id: feb335eb8687a1b7939ee8cd8649e455e0c069a9
This commit is contained in:
committed by
Facebook Github Bot
parent
1baa239389
commit
3e567fdcae
@@ -964,6 +964,16 @@ static void computeChildFlexBasis(const CSSNodeRef node,
|
||||
childHeightMeasureMode = CSSMeasureModeExactly;
|
||||
}
|
||||
|
||||
if (!CSSValueIsUndefined(child->style.maxDimensions[CSSDimensionWidth])) {
|
||||
childWidth = child->style.maxDimensions[CSSDimensionWidth];
|
||||
childWidthMeasureMode = CSSMeasureModeAtMost;
|
||||
}
|
||||
|
||||
if (!CSSValueIsUndefined(child->style.maxDimensions[CSSDimensionHeight])) {
|
||||
childHeight = child->style.maxDimensions[CSSDimensionHeight];
|
||||
childHeightMeasureMode = CSSMeasureModeAtMost;
|
||||
}
|
||||
|
||||
// Measure the child
|
||||
layoutNodeInternal(child,
|
||||
childWidth,
|
||||
@@ -1670,6 +1680,16 @@ static void layoutNodeImpl(const CSSNodeRef node,
|
||||
}
|
||||
}
|
||||
|
||||
if (!CSSValueIsUndefined(currentRelativeChild->style.maxDimensions[CSSDimensionWidth])) {
|
||||
childWidth = currentRelativeChild->style.maxDimensions[CSSDimensionWidth];
|
||||
childWidthMeasureMode = CSSMeasureModeAtMost;
|
||||
}
|
||||
|
||||
if (!CSSValueIsUndefined(currentRelativeChild->style.maxDimensions[CSSDimensionHeight])) {
|
||||
childHeight = currentRelativeChild->style.maxDimensions[CSSDimensionHeight];
|
||||
childHeightMeasureMode = CSSMeasureModeAtMost;
|
||||
}
|
||||
|
||||
const bool requiresStretchLayout =
|
||||
!isStyleDimDefined(currentRelativeChild, crossAxis) &&
|
||||
getAlignItem(node, currentRelativeChild) == CSSAlignStretch;
|
||||
@@ -1859,6 +1879,16 @@ static void layoutNodeImpl(const CSSNodeRef node,
|
||||
getMarginAxis(child, CSSFlexDirectionColumn);
|
||||
}
|
||||
|
||||
if (!CSSValueIsUndefined(child->style.maxDimensions[CSSDimensionWidth])) {
|
||||
childWidth = child->style.maxDimensions[CSSDimensionWidth];
|
||||
childWidthMeasureMode = CSSMeasureModeAtMost;
|
||||
}
|
||||
|
||||
if (!CSSValueIsUndefined(child->style.maxDimensions[CSSDimensionHeight])) {
|
||||
childHeight = child->style.maxDimensions[CSSDimensionHeight];
|
||||
childHeightMeasureMode = CSSMeasureModeAtMost;
|
||||
}
|
||||
|
||||
// If the child defines a definite size for its cross axis, there's
|
||||
// no need to stretch.
|
||||
if (!isCrossSizeDefinite) {
|
||||
|
Reference in New Issue
Block a user