Skip to content

Commit 9e3fd36

Browse files
committed
wrong intrinsics of an box with inequal margin sizes
bug introduced in c440e11
1 parent 93fa9f9 commit 9e3fd36

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
@@ -1201,7 +1201,7 @@ export function layoutContribution(
12011201
) {
12021202
const containingBlock = box.getContainingBlock();
12031203
const marginLineLeft = box.style.getMarginLineLeft(containingBlock);
1204-
const marginLineRight = box.style.getMarginLineLeft(containingBlock);
1204+
const marginLineRight = box.style.getMarginLineRight(containingBlock);
12051205
const borderLineLeftWidth = box.style.getBorderLineLeftWidth(containingBlock);
12061206
const paddingLineLeft = box.style.getPaddingLineLeft(containingBlock);
12071207
const paddingLineRight = box.style.getPaddingLineRight(containingBlock);

test/flow.spec.js

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

1575+
it('calculates contribution from inequal margin sides correctly', function () {
1576+
this.reflow(`
1577+
<div style="width: 200px;">
1578+
<div id="t" style="float: left; margin: 0 30px 0 10px;">
1579+
<div style="width: 50px; height: 10px;"></div>
1580+
</div>
1581+
</div>
1582+
`);
1583+
1584+
const t = this.get('#t');
1585+
expect(t.getContentArea().width).to.equal(50);
1586+
});
1587+
15751588
it('considers margin, border, padding part of the intrinsic size', function () {
15761589
this.reflow(`
15771590
<div style="width: 200px; font: 16px Arimo;">

0 commit comments

Comments
 (0)