Fixing using flex in root node
Reviewed By: emilsjolander Differential Revision: D5071164 fbshipit-source-id: b8afef42477d0ed87d0c9fcfd26349e0a0babd6e
This commit is contained in:
parent
cce99f44fd
commit
c785763773
|
@ -525,6 +525,10 @@ void YGNodeCopyStyle(const YGNodeRef dstNode, const YGNodeRef srcNode) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline float YGResolveFlexGrow(const YGNodeRef node) {
|
static inline float YGResolveFlexGrow(const YGNodeRef node) {
|
||||||
|
// Root nodes flexGrow should always be 0
|
||||||
|
if (node->parent == NULL) {
|
||||||
|
return 0.0;
|
||||||
|
}
|
||||||
if (!YGFloatIsUndefined(node->style.flexGrow)) {
|
if (!YGFloatIsUndefined(node->style.flexGrow)) {
|
||||||
return node->style.flexGrow;
|
return node->style.flexGrow;
|
||||||
}
|
}
|
||||||
|
@ -545,6 +549,10 @@ float YGNodeStyleGetFlexShrink(const YGNodeRef node) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline float YGNodeResolveFlexShrink(const YGNodeRef node) {
|
static inline float YGNodeResolveFlexShrink(const YGNodeRef node) {
|
||||||
|
// Root nodes flexShrink should always be 0
|
||||||
|
if (node->parent == NULL) {
|
||||||
|
return 0.0;
|
||||||
|
}
|
||||||
if (!YGFloatIsUndefined(node->style.flexShrink)) {
|
if (!YGFloatIsUndefined(node->style.flexShrink)) {
|
||||||
return node->style.flexShrink;
|
return node->style.flexShrink;
|
||||||
}
|
}
|
||||||
|
@ -2293,7 +2301,7 @@ static void YGNodelayoutImpl(const YGNodeRef node,
|
||||||
if (!node->config->useLegacyStretchBehaviour &&
|
if (!node->config->useLegacyStretchBehaviour &&
|
||||||
(totalFlexGrowFactors == 0 || YGResolveFlexGrow(node) == 0)) {
|
(totalFlexGrowFactors == 0 || YGResolveFlexGrow(node) == 0)) {
|
||||||
// If we don't have any children to flex or we can't flex the node itself,
|
// If we don't have any children to flex or we can't flex the node itself,
|
||||||
// space we've used is all space we need
|
// space we've used is all space we need. Root node also should be shrunk to minimum
|
||||||
availableInnerMainDim = sizeConsumedOnCurrentLine;
|
availableInnerMainDim = sizeConsumedOnCurrentLine;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue