Skip to content

Commit 3c3d245

Browse files
committed
wrong intrinsics of an box with inequal margin sizes
bug introduced in c440e11
1 parent 5d09de6 commit 3c3d245

2 files changed

Lines changed: 14 additions & 1 deletion

File tree

src/layout-flow.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1137,7 +1137,7 @@ export function layoutContribution(
11371137
) {
11381138
const containingBlock = box.getContainingBlock();
11391139
const marginLineLeft = box.style.getMarginLineLeft(containingBlock);
1140-
const marginLineRight = box.style.getMarginLineLeft(containingBlock);
1140+
const marginLineRight = box.style.getMarginLineRight(containingBlock);
11411141
const borderLineLeftWidth = box.style.getBorderLineLeftWidth(containingBlock);
11421142
const paddingLineLeft = box.style.getPaddingLineLeft(containingBlock);
11431143
const paddingLineRight = box.style.getPaddingLineRight(containingBlock);

test/flow.spec.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1560,6 +1560,19 @@ describe('Flow', function () {
15601560
expect(t.getContentArea().width).to.equal(500);
15611561
});
15621562

1563+
it('calculates contribution from inequal margin sides correctly', function () {
1564+
this.reflow(`
1565+
<div style="width: 200px;">
1566+
<div id="t" style="float: left; margin: 0 30px 0 10px;">
1567+
<div style="width: 50px; height: 10px;"></div>
1568+
</div>
1569+
</div>
1570+
`);
1571+
1572+
const t = this.get('#t');
1573+
expect(t.getContentArea().width).to.equal(50);
1574+
});
1575+
15631576
it('considers margin, border, padding part of the intrinsic size', function () {
15641577
this.layout(`
15651578
<div style="width: 200px; font: 16px Arimo;">

0 commit comments

Comments
 (0)