From 78315b5bbfec8758541f0325b58d975c549813c4 Mon Sep 17 00:00:00 2001 From: Christopher Chedeau Date: Mon, 21 Apr 2014 18:45:57 -0700 Subject: [PATCH] absolute, left, marginLeft --- src/Layout.js | 3 ++- src/__tests__/Layout-test.js | 11 +++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/Layout.js b/src/Layout.js index e297c496..54ded250 100755 --- a/src/Layout.js +++ b/src/Layout.js @@ -287,7 +287,8 @@ var computeLayout = (function() { child.layout[pos[crossAxis]] += leadingCrossDim; } else { if (isPosDefined(child, leading[crossAxis])) { - child.layout[pos[crossAxis]] = getPosition(child, leading[crossAxis]); + child.layout[pos[crossAxis]] = getPosition(child, leading[crossAxis]) + + getMargin(child, leading[crossAxis]); } else { child.layout[pos[crossAxis]] += getPadding(node, leading[crossAxis]); } diff --git a/src/__tests__/Layout-test.js b/src/__tests__/Layout-test.js index 39fba088..d72f686f 100755 --- a/src/__tests__/Layout-test.js +++ b/src/__tests__/Layout-test.js @@ -581,6 +581,17 @@ describe('Layout', function() { ); }); + it('should layout node with position: absolute, left and marginLeft', function() { + testLayout( + {style: {}, children: [ + {style: {left: 5, marginLeft: 5, position: 'absolute'}} + ]}, + {width: 0, height: 0, top: 0, left: 0, children: [ + {width: 0, height: 0, top: 0, left: 10} + ]} + ); + }); + it('should layout randomly', function() { function RNG(seed) { this.state = seed;