[src/Layout.js]: Cleaner line loop in <Loop E> (alignContent layout) ;
This commit is contained in:
20
src/Layout.c
20
src/Layout.c
@@ -822,18 +822,9 @@ static void layoutNodeImpl(css_node_t *node, float parentMaxWidth) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// find the first node on the first line
|
int endIndex = 0;
|
||||||
for (i = 0; i < node->children_count; ) {
|
for (i = 0; i < linesCount; ++i) {
|
||||||
int startIndex = i;
|
int startIndex = endIndex;
|
||||||
int lineIndex = -1;
|
|
||||||
|
|
||||||
// get the first child on the current line
|
|
||||||
child = node->get_child(node->context, i);
|
|
||||||
if (getPositionType(child) != CSS_POSITION_RELATIVE) {
|
|
||||||
++i;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
lineIndex = child->line_index;
|
|
||||||
|
|
||||||
// compute the line's height and find the endIndex
|
// compute the line's height and find the endIndex
|
||||||
float lineHeight = 0;
|
float lineHeight = 0;
|
||||||
@@ -842,7 +833,7 @@ static void layoutNodeImpl(css_node_t *node, float parentMaxWidth) {
|
|||||||
if (getPositionType(child) != CSS_POSITION_RELATIVE) {
|
if (getPositionType(child) != CSS_POSITION_RELATIVE) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (child->line_index != lineIndex) {
|
if (child->line_index != i) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (!isUndefined(child->layout.dimensions[dim[crossAxis]])) {
|
if (!isUndefined(child->layout.dimensions[dim[crossAxis]])) {
|
||||||
@@ -852,7 +843,7 @@ static void layoutNodeImpl(css_node_t *node, float parentMaxWidth) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
int endIndex = ii;
|
endIndex = ii;
|
||||||
lineHeight += crossDimLead;
|
lineHeight += crossDimLead;
|
||||||
|
|
||||||
for (ii = startIndex; ii < endIndex; ++ii) {
|
for (ii = startIndex; ii < endIndex; ++ii) {
|
||||||
@@ -877,7 +868,6 @@ static void layoutNodeImpl(css_node_t *node, float parentMaxWidth) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
currentLead += lineHeight;
|
currentLead += lineHeight;
|
||||||
i = endIndex;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -700,18 +700,9 @@ var computeLayout = (function() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// find the first node on the first line
|
var/*int*/ endIndex = 0;
|
||||||
for (i = 0; i < node.children.length; ) {
|
for (i = 0; i < linesCount; ++i) {
|
||||||
var/*int*/ startIndex = i;
|
var/*int*/ startIndex = endIndex;
|
||||||
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;
|
|
||||||
|
|
||||||
// compute the line's height and find the endIndex
|
// compute the line's height and find the endIndex
|
||||||
var/*float*/ lineHeight = 0;
|
var/*float*/ lineHeight = 0;
|
||||||
@@ -720,7 +711,7 @@ var computeLayout = (function() {
|
|||||||
if (getPositionType(child) !== CSS_POSITION_RELATIVE) {
|
if (getPositionType(child) !== CSS_POSITION_RELATIVE) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (child.lineIndex !== lineIndex) {
|
if (child.lineIndex !== i) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (!isUndefined(child.layout[dim[crossAxis]])) {
|
if (!isUndefined(child.layout[dim[crossAxis]])) {
|
||||||
@@ -730,7 +721,7 @@ var computeLayout = (function() {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var/*int*/ endIndex = ii;
|
endIndex = ii;
|
||||||
lineHeight += crossDimLead;
|
lineHeight += crossDimLead;
|
||||||
|
|
||||||
for (ii = startIndex; ii < endIndex; ++ii) {
|
for (ii = startIndex; ii < endIndex; ++ii) {
|
||||||
@@ -755,7 +746,6 @@ var computeLayout = (function() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
currentLead += lineHeight;
|
currentLead += lineHeight;
|
||||||
i = endIndex;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -751,18 +751,9 @@ public class LayoutEngine {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// find the first node on the first line
|
int endIndex = 0;
|
||||||
for (i = 0; i < node.getChildCount(); ) {
|
for (i = 0; i < linesCount; ++i) {
|
||||||
int startIndex = i;
|
int startIndex = endIndex;
|
||||||
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;
|
|
||||||
|
|
||||||
// compute the line's height and find the endIndex
|
// compute the line's height and find the endIndex
|
||||||
float lineHeight = 0;
|
float lineHeight = 0;
|
||||||
@@ -771,7 +762,7 @@ public class LayoutEngine {
|
|||||||
if (getPositionType(child) != CSSPositionType.RELATIVE) {
|
if (getPositionType(child) != CSSPositionType.RELATIVE) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (child.lineIndex != lineIndex) {
|
if (child.lineIndex != i) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (!CSSConstants.isUndefined(getLayoutDimension(child, getDim(crossAxis)))) {
|
if (!CSSConstants.isUndefined(getLayoutDimension(child, getDim(crossAxis)))) {
|
||||||
@@ -781,7 +772,7 @@ public class LayoutEngine {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
int endIndex = ii;
|
endIndex = ii;
|
||||||
lineHeight = lineHeight + crossDimLead;
|
lineHeight = lineHeight + crossDimLead;
|
||||||
|
|
||||||
for (ii = startIndex; ii < endIndex; ++ii) {
|
for (ii = startIndex; ii < endIndex; ++ii) {
|
||||||
@@ -806,7 +797,6 @@ public class LayoutEngine {
|
|||||||
}
|
}
|
||||||
|
|
||||||
currentLead = currentLead + lineHeight;
|
currentLead = currentLead + lineHeight;
|
||||||
i = endIndex;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user