flex and main axis margin

This commit is contained in:
Christopher Chedeau
2014-04-22 09:38:17 -07:00
parent f5b738338d
commit bda6b23b8b
2 changed files with 15 additions and 2 deletions

View File

@@ -208,7 +208,9 @@ var computeLayout = (function() {
for (var/*int*/ i = 0; i < node.children.length; ++i) {
var/*css_node_t**/ child = node.children[i];
if (getFlex(child)) {
child.layout[dim[mainAxis]] = flexibleMainDim;
child.layout[dim[mainAxis]] = flexibleMainDim -
getMargin(child, leading[mainAxis]) -
getMargin(child, trailing[mainAxis]);
layoutNode(child);
}
}

View File

@@ -606,7 +606,18 @@ describe('Layout', function() {
{width: 0, height: 0, top: 100, left: 0}
]}
);
})
});
it('should llll', function() {
testLayout(
{style: {width: 700, flexDirection: 'row'}, children: [
{style: {marginLeft: 5, flex: 1}}
]},
{width: 700, height: 0, top: 0, left: 0, children: [
{width: 695, height: 0, top: 0, left: 5}
]}
);
});
it('should layout randomly', function() {
function RNG(seed) {