[src/Layout.js]: Cleaner line loop in <Loop E> (alignContent layout) ;

This commit is contained in:
Pierre Renaux
2015-05-09 13:10:26 +08:00
parent 14e264f5be
commit 09f0c12a8f
3 changed files with 15 additions and 45 deletions

View File

@@ -751,18 +751,9 @@ public class LayoutEngine {
}
}
// find the first node on the first line
for (i = 0; i < node.getChildCount(); ) {
int startIndex = i;
int lineIndex = -1;
// get the first child on the current line
child = node.getChildAt(i);
if (getPositionType(child) != CSSPositionType.RELATIVE) {
++i;
continue;
}
lineIndex = child.lineIndex;
int endIndex = 0;
for (i = 0; i < linesCount; ++i) {
int startIndex = endIndex;
// compute the line's height and find the endIndex
float lineHeight = 0;
@@ -771,7 +762,7 @@ public class LayoutEngine {
if (getPositionType(child) != CSSPositionType.RELATIVE) {
continue;
}
if (child.lineIndex != lineIndex) {
if (child.lineIndex != i) {
break;
}
if (!CSSConstants.isUndefined(getLayoutDimension(child, getDim(crossAxis)))) {
@@ -781,7 +772,7 @@ public class LayoutEngine {
);
}
}
int endIndex = ii;
endIndex = ii;
lineHeight = lineHeight + crossDimLead;
for (ii = startIndex; ii < endIndex; ++ii) {
@@ -806,7 +797,6 @@ public class LayoutEngine {
}
currentLead = currentLead + lineHeight;
i = endIndex;
}
}