flex and position absolute
This commit is contained in:
@@ -183,7 +183,9 @@ var computeLayout = (function() {
|
|||||||
var/*int*/ absoluteChildrenCount = 0;
|
var/*int*/ absoluteChildrenCount = 0;
|
||||||
for (var/*int*/ i = 0; i < node.children.length; ++i) {
|
for (var/*int*/ i = 0; i < node.children.length; ++i) {
|
||||||
var/*css_node_t**/ child = node.children[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);
|
layoutNode(child);
|
||||||
if (getPositionType(child) === 'relative') {
|
if (getPositionType(child) === 'relative') {
|
||||||
mainContentDim += getDimWithMargin(child, mainAxis);
|
mainContentDim += getDimWithMargin(child, mainAxis);
|
||||||
|
@@ -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;
|
return node;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (var i = 0; i < 100; ++i) {
|
for (var i = 0; i < 1000; ++i) {
|
||||||
var node = generateRandomNode();
|
var node = generateRandomNode();
|
||||||
|
|
||||||
if (JSON.stringify(computeLayout(node)) !== JSON.stringify(computeDOMLayout)) {
|
if (JSON.stringify(computeLayout(node)) !== JSON.stringify(computeDOMLayout)) {
|
||||||
|
Reference in New Issue
Block a user