Move justifyContent check into switch statement
Summary: some general cleanup Reviewed By: lucasr Differential Revision: D3886861 fbshipit-source-id: 17ba2962016af34b5add3ce6d8355c9c305a35c0
This commit is contained in:
committed by
Facebook Github Bot 5
parent
1415a5d7fd
commit
8fd14c710c
@@ -1497,25 +1497,27 @@ static void layoutNodeImpl(const CSSNodeRef node,
|
|||||||
remainingFreeSpace = 0;
|
remainingFreeSpace = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Use justifyContent to figure out how to allocate the remaining space
|
switch (justifyContent) {
|
||||||
// available in the main axis.
|
case CSSJustifyCenter:
|
||||||
if (justifyContent != CSSJustifyFlexStart) {
|
|
||||||
if (justifyContent == CSSJustifyCenter) {
|
|
||||||
leadingMainDim = remainingFreeSpace / 2;
|
leadingMainDim = remainingFreeSpace / 2;
|
||||||
} else if (justifyContent == CSSJustifyFlexEnd) {
|
break;
|
||||||
|
case CSSJustifyFlexEnd:
|
||||||
leadingMainDim = remainingFreeSpace;
|
leadingMainDim = remainingFreeSpace;
|
||||||
} else if (justifyContent == CSSJustifySpaceBetween) {
|
break;
|
||||||
remainingFreeSpace = fmaxf(remainingFreeSpace, 0);
|
case CSSJustifySpaceBetween:
|
||||||
if (itemsOnLine > 1) {
|
if (itemsOnLine > 1) {
|
||||||
betweenMainDim = remainingFreeSpace / (itemsOnLine - 1);
|
betweenMainDim = fmaxf(remainingFreeSpace, 0) / (itemsOnLine - 1);
|
||||||
} else {
|
} else {
|
||||||
betweenMainDim = 0;
|
betweenMainDim = 0;
|
||||||
}
|
}
|
||||||
} else if (justifyContent == CSSJustifySpaceAround) {
|
break;
|
||||||
|
case CSSJustifySpaceAround:
|
||||||
// Space on the edges is half of the space between elements
|
// Space on the edges is half of the space between elements
|
||||||
betweenMainDim = remainingFreeSpace / itemsOnLine;
|
betweenMainDim = remainingFreeSpace / itemsOnLine;
|
||||||
leadingMainDim = betweenMainDim / 2;
|
leadingMainDim = betweenMainDim / 2;
|
||||||
}
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
float mainDim = leadingPaddingAndBorderMain + leadingMainDim;
|
float mainDim = leadingPaddingAndBorderMain + leadingMainDim;
|
||||||
|
@@ -6,7 +6,7 @@ clang-format \
|
|||||||
AlignOperands: true, \
|
AlignOperands: true, \
|
||||||
AllowAllParametersOfDeclarationOnNextLine: false, \
|
AllowAllParametersOfDeclarationOnNextLine: false, \
|
||||||
AllowShortBlocksOnASingleLine: false, \
|
AllowShortBlocksOnASingleLine: false, \
|
||||||
AllowShortCaseLabelsOnASingleLine: true, \
|
AllowShortCaseLabelsOnASingleLine: false, \
|
||||||
AllowShortFunctionsOnASingleLine: false, \
|
AllowShortFunctionsOnASingleLine: false, \
|
||||||
AllowShortIfStatementsOnASingleLine: false, \
|
AllowShortIfStatementsOnASingleLine: false, \
|
||||||
AllowShortLoopsOnASingleLine: false, \
|
AllowShortLoopsOnASingleLine: false, \
|
||||||
|
Reference in New Issue
Block a user