layout flex-end should take into account margin

This commit is contained in:
Christopher Chedeau
2014-04-14 12:00:16 -07:00
parent 57dd9e3e28
commit d65d15cc41
2 changed files with 17 additions and 1 deletions

View File

@@ -493,6 +493,20 @@ describe('Layout', function() {
}); });
}); });
it('should layout flex-end taking into account margin', function() {
testLayout({
style: {height: 100, justifyContent: 'flex-end'},
children: [
{style: {marginTop: 10}}
]
}, {
width: 0, height: 100, top: 0, left: 0,
children: [
{width: 0, height: 0, top: 100, left: 0}
]
});
});
it('should layout randomly', function() { it('should layout randomly', function() {
function RNG(seed) { function RNG(seed) {
this.state = seed; this.state = seed;

View File

@@ -111,7 +111,9 @@ function computeLayout(node) {
children.forEach(function(child) { children.forEach(function(child) {
if (!child.style.flex) { if (!child.style.flex) {
layoutNode(child); layoutNode(child);
mainContentDim += child.layout[dim[mainAxis]]; mainContentDim += child.layout[dim[mainAxis]] +
getMargin(leading[mainAxis], child) +
getMargin(trailing[mainAxis], child);
} else { } else {
flexibleChildrenCount++; flexibleChildrenCount++;
} }