flex and position absolute

This commit is contained in:
Christopher Chedeau
2014-04-22 10:02:33 -07:00
parent f564effb5c
commit a18bc27c6b
2 changed files with 15 additions and 2 deletions

View File

@@ -183,7 +183,9 @@ var computeLayout = (function() {
var/*int*/ absoluteChildrenCount = 0;
for (var/*int*/ i = 0; i < node.children.length; ++i) {
var/*css_node_t**/ child = node.children[i];
if (isUndefined(node.layout[dim[mainAxis]]) || !getFlex(child)) {
if (isUndefined(node.layout[dim[mainAxis]]) ||
getPositionType(child) === 'absolute' ||
!getFlex(child)) {
layoutNode(child);
if (getPositionType(child) === 'relative') {
mainContentDim += getDimWithMargin(child, mainAxis);

View File

@@ -658,6 +658,17 @@ describe('Layout', function() {
);
});
it('should layout node with flex and position absolute', function() {
testLayout(
{style: {width: 600, flexDirection: 'row'}, children: [
{style: {flex: 1, position: 'absolute'}}
]},
{width: 600, height: 0, top: 0, left: 0, children: [
{width: 0, height: 0, top: 0, left: 0}
]}
);
});
@@ -720,7 +731,7 @@ describe('Layout', function() {
return node;
}
for (var i = 0; i < 100; ++i) {
for (var i = 0; i < 1000; ++i) {
var node = generateRandomNode();
if (JSON.stringify(computeLayout(node)) !== JSON.stringify(computeDOMLayout)) {