Move YGNodeResolveFlexShrink to a method on YGNode

Summary: Move YGNodeResolveFlexShrink to a method on YGNode

Reviewed By: emilsjolander

Differential Revision: D6611418

fbshipit-source-id: 6e5ba39b555d313a967800589891027920112c15
This commit is contained in:
Pritesh Nandgaonkar
2018-01-08 02:48:39 -08:00
committed by Facebook Github Bot
parent 40eeefd4f7
commit 348dd368b5
3 changed files with 22 additions and 22 deletions

View File

@@ -435,3 +435,17 @@ float YGNode::resolveFlexGrow() {
}
return kDefaultFlexGrow;
}
float YGNode::resolveFlexShrink() {
if (parent_ == nullptr) {
return 0.0;
}
if (!YGFloatIsUndefined(style_.flexShrink)) {
return style_.flexShrink;
}
if (!config_->useWebDefaults && !YGFloatIsUndefined(style_.flex) &&
style_.flex < 0.0f) {
return -style_.flex;
}
return config_->useWebDefaults ? kWebDefaultFlexShrink : kDefaultFlexShrink;
}