Use switch instead of ifelse chain

Reviewed By: gkassabli

Differential Revision: D4036445

fbshipit-source-id: 2159946f53507ff3d7505795e5baa5f820cdb65c
This commit is contained in:
Emil Sjolander 2016-10-18 10:01:16 -07:00 committed by Facebook Github Bot
parent 0699a30980
commit c805cf8376
1 changed files with 15 additions and 9 deletions

View File

@ -1855,15 +1855,21 @@ static void layoutNodeImpl(const CSSNodeRef node,
float crossDimLead = 0;
float currentLead = leadingPaddingAndBorderCross;
const CSSAlign alignContent = node->style.alignContent;
if (alignContent == CSSAlignFlexEnd) {
currentLead += remainingAlignContentDim;
} else if (alignContent == CSSAlignCenter) {
currentLead += remainingAlignContentDim / 2;
} else if (alignContent == CSSAlignStretch) {
if (availableInnerCrossDim > totalLineCrossDim) {
crossDimLead = (remainingAlignContentDim / lineCount);
}
switch (node->style.alignContent) {
case CSSAlignFlexEnd:
currentLead += remainingAlignContentDim;
break;
case CSSAlignCenter:
currentLead += remainingAlignContentDim / 2;
break;
case CSSAlignStretch:
if (availableInnerCrossDim > totalLineCrossDim) {
crossDimLead = (remainingAlignContentDim / lineCount);
}
break;
case CSSAlignAuto:
case CSSAlignFlexStart:
break;
}
uint32_t endIndex = 0;