fix test case not passing because of div by 0

This commit is contained in:
Christopher Chedeau
2014-12-11 14:22:04 +00:00
parent 5a3303ac5e
commit 570f7bf98a
2 changed files with 20 additions and 6 deletions

View File

@@ -353,7 +353,6 @@ var computeLayout = (function() {
}
}
// <Loop B> Layout flexible children and allocate empty space
// In order to position the elements in the main axis, we have two
@@ -422,8 +421,12 @@ var computeLayout = (function() {
leadingMainDim = remainingMainDim;
} else if (justifyContent === CSS_JUSTIFY_SPACE_BETWEEN) {
remainingMainDim = fmaxf(remainingMainDim, 0);
betweenMainDim = remainingMainDim /
(flexibleChildrenCount + nonFlexibleChildrenCount - 1);
if (flexibleChildrenCount + nonFlexibleChildrenCount - 1 !== 0) {
betweenMainDim = remainingMainDim /
(flexibleChildrenCount + nonFlexibleChildrenCount - 1);
} else {
betweenMainDim = 0;
}
} else if (justifyContent === CSS_JUSTIFY_SPACE_AROUND) {
// Space on the edges is half of the space between elements
betweenMainDim = remainingMainDim /