mirror of
https://github.com/status-im/react-native.git
synced 2025-01-14 19:44:13 +00:00
Cleanup some multiline code
Reviewed By: lucasr Differential Revision: D3886866 fbshipit-source-id: e19c1be4af58605933f90b5bf381008338be2236
This commit is contained in:
parent
10601c921e
commit
375a5805d1
@ -1700,44 +1700,51 @@ 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;
|
||||||
lineHeight += crossDimLead;
|
lineHeight += crossDimLead;
|
||||||
|
|
||||||
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)) {
|
||||||
|
case CSSAlignFlexStart:
|
||||||
child->layout.position[pos[crossAxis]] =
|
child->layout.position[pos[crossAxis]] =
|
||||||
currentLead + getLeadingMargin(child, crossAxis);
|
currentLead + getLeadingMargin(child, crossAxis);
|
||||||
} else if (alignContentAlignItem == CSSAlignFlexEnd) {
|
break;
|
||||||
|
case CSSAlignFlexEnd:
|
||||||
child->layout.position[pos[crossAxis]] =
|
child->layout.position[pos[crossAxis]] =
|
||||||
currentLead + lineHeight - getTrailingMargin(child, crossAxis) -
|
currentLead + lineHeight - getTrailingMargin(child, crossAxis) -
|
||||||
child->layout.measuredDimensions[dim[crossAxis]];
|
child->layout.measuredDimensions[dim[crossAxis]];
|
||||||
} else if (alignContentAlignItem == CSSAlignCenter) {
|
break;
|
||||||
|
case CSSAlignCenter:
|
||||||
childHeight = child->layout.measuredDimensions[dim[crossAxis]];
|
childHeight = child->layout.measuredDimensions[dim[crossAxis]];
|
||||||
child->layout.position[pos[crossAxis]] = currentLead + (lineHeight - childHeight) / 2;
|
child->layout.position[pos[crossAxis]] =
|
||||||
} else if (alignContentAlignItem == CSSAlignStretch) {
|
currentLead + (lineHeight - childHeight) / 2;
|
||||||
|
break;
|
||||||
|
case CSSAlignStretch:
|
||||||
child->layout.position[pos[crossAxis]] =
|
child->layout.position[pos[crossAxis]] =
|
||||||
currentLead + getLeadingMargin(child, crossAxis);
|
currentLead + getLeadingMargin(child, crossAxis);
|
||||||
// TODO(prenaux): Correctly set the height of items with indefinite
|
// TODO(prenaux): Correctly set the height of items with indefinite
|
||||||
// (auto) crossAxis dimension.
|
// (auto) crossAxis dimension.
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user