Cleanup some multiline code

Reviewed By: lucasr

Differential Revision: D3886866

fbshipit-source-id: e19c1be4af58605933f90b5bf381008338be2236
This commit is contained in:
Emil Sjolander 2016-09-20 10:16:16 -07:00 committed by Facebook Github Bot 5
parent 10601c921e
commit 375a5805d1

View File

@ -1700,16 +1700,17 @@ static void layoutNodeImpl(const CSSNodeRef node,
float lineHeight = 0; float lineHeight = 0;
for (ii = startIndex; ii < childCount; ii++) { for (ii = startIndex; ii < childCount; ii++) {
const CSSNodeRef child = CSSNodeListGet(node->children, ii); const CSSNodeRef child = CSSNodeListGet(node->children, ii);
if (child->style.positionType != CSSPositionTypeRelative) {
continue; if (child->style.positionType == CSSPositionTypeAbsolute) {
} if (child->lineIndex != i) {
if (child->lineIndex != i) { break;
break; }
}
if (isLayoutDimDefined(child, crossAxis)) { if (isLayoutDimDefined(child, crossAxis)) {
lineHeight = fmaxf(lineHeight, lineHeight = fmaxf(lineHeight,
child->layout.measuredDimensions[dim[crossAxis]] + child->layout.measuredDimensions[dim[crossAxis]] +
getMarginAxis(child, crossAxis)); getMarginAxis(child, crossAxis));
}
} }
} }
endIndex = ii; endIndex = ii;
@ -1718,26 +1719,32 @@ static void layoutNodeImpl(const CSSNodeRef node,
if (performLayout) { if (performLayout) {
for (ii = startIndex; ii < endIndex; ii++) { for (ii = startIndex; ii < endIndex; ii++) {
const CSSNodeRef child = CSSNodeListGet(node->children, ii); const CSSNodeRef child = CSSNodeListGet(node->children, ii);
if (child->style.positionType != CSSPositionTypeRelative) {
continue;
}
const CSSAlign alignContentAlignItem = getAlignItem(node, child); if (child->style.positionType == CSSPositionTypeAbsolute) {
if (alignContentAlignItem == CSSAlignFlexStart) { switch (getAlignItem(node, child)) {
child->layout.position[pos[crossAxis]] = case CSSAlignFlexStart:
currentLead + getLeadingMargin(child, crossAxis); child->layout.position[pos[crossAxis]] =
} else if (alignContentAlignItem == CSSAlignFlexEnd) { currentLead + getLeadingMargin(child, crossAxis);
child->layout.position[pos[crossAxis]] = break;
currentLead + lineHeight - getTrailingMargin(child, crossAxis) - case CSSAlignFlexEnd:
child->layout.measuredDimensions[dim[crossAxis]]; child->layout.position[pos[crossAxis]] =
} else if (alignContentAlignItem == CSSAlignCenter) { currentLead + lineHeight - getTrailingMargin(child, crossAxis) -
childHeight = child->layout.measuredDimensions[dim[crossAxis]]; child->layout.measuredDimensions[dim[crossAxis]];
child->layout.position[pos[crossAxis]] = currentLead + (lineHeight - childHeight) / 2; break;
} else if (alignContentAlignItem == CSSAlignStretch) { case CSSAlignCenter:
child->layout.position[pos[crossAxis]] = childHeight = child->layout.measuredDimensions[dim[crossAxis]];
currentLead + getLeadingMargin(child, crossAxis); child->layout.position[pos[crossAxis]] =
// TODO(prenaux): Correctly set the height of items with indefinite currentLead + (lineHeight - childHeight) / 2;
// (auto) crossAxis dimension. break;
case CSSAlignStretch:
child->layout.position[pos[crossAxis]] =
currentLead + getLeadingMargin(child, crossAxis);
// TODO(prenaux): Correctly set the height of items with indefinite
// (auto) crossAxis dimension.
break;
default:
break;
}
} }
} }
} }