[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

@@ -700,18 +700,9 @@ var computeLayout = (function() {
}
}
// find the first node on the first line
for (i = 0; i < node.children.length; ) {
var/*int*/ startIndex = i;
var/*int*/ lineIndex = -1;
// get the first child on the current line
child = node.children[i];
if (getPositionType(child) !== CSS_POSITION_RELATIVE) {
++i;
continue;
}
lineIndex = child.lineIndex;
var/*int*/ endIndex = 0;
for (i = 0; i < linesCount; ++i) {
var/*int*/ startIndex = endIndex;
// compute the line's height and find the endIndex
var/*float*/ lineHeight = 0;
@@ -720,7 +711,7 @@ var computeLayout = (function() {
if (getPositionType(child) !== CSS_POSITION_RELATIVE) {
continue;
}
if (child.lineIndex !== lineIndex) {
if (child.lineIndex !== i) {
break;
}
if (!isUndefined(child.layout[dim[crossAxis]])) {
@@ -730,7 +721,7 @@ var computeLayout = (function() {
);
}
}
var/*int*/ endIndex = ii;
endIndex = ii;
lineHeight += crossDimLead;
for (ii = startIndex; ii < endIndex; ++ii) {
@@ -755,7 +746,6 @@ var computeLayout = (function() {
}
currentLead += lineHeight;
i = endIndex;
}
}