height overrides top+bottom

This commit is contained in:
Christopher Chedeau
2014-06-12 11:43:30 -07:00
parent 51957d5645
commit 900beefa1e
2 changed files with 24 additions and 6 deletions

View File

@@ -484,6 +484,12 @@ var computeLayout = (function() {
getPosition(child, trailing[mainAxis]); getPosition(child, trailing[mainAxis]);
} }
if (leadingPos && trailingPos) { if (leadingPos && trailingPos) {
if (isDimDefined(child, mainAxis)) {
child.layout[dim[mainAxis]] = fmaxf(
child.style[dim[mainAxis]],
getPaddingAndBorderAxis(node, mainAxis)
);
} else {
child.layout[dim[mainAxis]] = fmaxf(0, child.layout[dim[mainAxis]] = fmaxf(0,
node.layout[dim[mainAxis]] - node.layout[dim[mainAxis]] -
child.layout[pos[mainAxis]] - child.layout[pos[mainAxis]] -
@@ -493,6 +499,7 @@ var computeLayout = (function() {
} }
} }
} }
}
// <Loop D> Position elements in the cross axis // <Loop D> Position elements in the cross axis

View File

@@ -972,6 +972,17 @@ describe('Layout', function() {
); );
}); });
it('should layout with position absolute top, bottom and height', function() {
testLayout(
{style: {}, children: [
{style: {top: 5, bottom: 5, height: 900, position: 'absolute'}}
]},
{width: 0, height: 0, top: 0, left: 0, children: [
{width: 0, height: 900, top: 5, left: 0}
]}
);
});
xit('should layout text with alignItems: stretch', function() { xit('should layout text with alignItems: stretch', function() {
testLayout( testLayout(
{style: {width: 80, padding: 7, alignItems: 'stretch', measure: text('loooooooooong with space')}}, {style: {width: 80, padding: 7, alignItems: 'stretch', measure: text('loooooooooong with space')}},