Skip to content

Commit

Permalink
float context inline offsets should be positive
Browse files Browse the repository at this point in the history
I remember having a reason for having negative offsets against the
bfc, but flipping it to be positive makes sense and the tests all
pass
  • Loading branch information
chearon committed Apr 16, 2024
1 parent aa36004 commit ad997b2
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/layout-flow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ class FloatSide {
let max = 0;
for (let i = start; i < end; ++i) {
if (this.floatCounts[i] > 0) {
max = Math.max(max, inlineOffset + this.inlineSizes[i] - this.inlineOffsets[i]);
max = Math.max(max, inlineOffset + this.inlineSizes[i] + this.inlineOffsets[i]);
}
}
return max;
Expand Down Expand Up @@ -500,10 +500,10 @@ class FloatSide {

for (let track = startTrack; track < endTrack; track += 1) {
if (this.floatCounts[track] === 0) {
this.inlineOffsets[track] = -cbOffset;
this.inlineOffsets[track] = cbOffset;
this.inlineSizes[track] = marginOffset + box.borderArea.width + marginEnd;
} else {
this.inlineSizes[track] = this.inlineOffsets[track] + cbOffset + marginOffset + box.borderArea.width + marginEnd;
this.inlineSizes[track] = cbOffset - this.inlineOffsets[track] + marginOffset + box.borderArea.width + marginEnd;
}
this.floatCounts[track] += 1;
}
Expand Down

0 comments on commit ad997b2

Please sign in to comment.