position: absolute and alignSelf
This commit is contained in:
@@ -243,6 +243,8 @@ var computeLayout = (function() {
|
|||||||
|
|
||||||
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 (getPositionType(child) === 'relative') {
|
||||||
var/*css_align_t*/ alignItem = getAlignItem(node, child);
|
var/*css_align_t*/ alignItem = getAlignItem(node, child);
|
||||||
var/*float*/ remainingCrossDim = node.layout[dim[crossAxis]] -
|
var/*float*/ remainingCrossDim = node.layout[dim[crossAxis]] -
|
||||||
getDimWithMargin(child, crossAxis) -
|
getDimWithMargin(child, crossAxis) -
|
||||||
@@ -265,6 +267,7 @@ var computeLayout = (function() {
|
|||||||
}
|
}
|
||||||
child.layout[pos[crossAxis]] += leadingCrossDim;
|
child.layout[pos[crossAxis]] += leadingCrossDim;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
node.layout[leading[mainAxis]] += getMargin(node, leading[mainAxis]) +
|
node.layout[leading[mainAxis]] += getMargin(node, leading[mainAxis]) +
|
||||||
getRelativePosition(node, mainAxis);
|
getRelativePosition(node, mainAxis);
|
||||||
|
@@ -493,6 +493,17 @@ describe('Layout', function() {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should layout node with position: absolute, padding and alignSelf: center', function() {
|
||||||
|
testLayout(
|
||||||
|
{style : {}, children : [
|
||||||
|
{style: {paddingRight: 12, alignSelf: 'center', position: 'absolute'}}
|
||||||
|
]},
|
||||||
|
{width: 0, height: 0, top: 0, left: 0, children: [
|
||||||
|
{width: 12, height: 0, top: 0, left: 0}
|
||||||
|
]}
|
||||||
|
);
|
||||||
|
})
|
||||||
|
|
||||||
it('should layout randomly', function() {
|
it('should layout randomly', function() {
|
||||||
function RNG(seed) {
|
function RNG(seed) {
|
||||||
this.state = seed;
|
this.state = seed;
|
||||||
|
Reference in New Issue
Block a user