Skip to content

Commit

Permalink
overflow-wrap with only a float ininite looped
Browse files Browse the repository at this point in the history
  • Loading branch information
chearon committed Apr 14, 2024
1 parent 89be0c0 commit 9629575
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/layout-text.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2112,9 +2112,13 @@ export class Paragraph {
}
}

if (graphemeBreakMark === mark.position && this.ifc.hasText()) {
mark.isGraphemeBreak = true;
graphemeBreakMark = nextGraphemeBreak(this.string, graphemeBreakMark);
if (graphemeBreakMark === mark.position) {
if (this.ifc.hasText()) {
mark.isGraphemeBreak = true;
graphemeBreakMark = nextGraphemeBreak(this.string, graphemeBreakMark);
} else {
graphemeBreakMark = end;
}
}

if (!inline.done && inlineMark === mark.position && inline.value.state === 'breakspot') {
Expand Down
8 changes: 8 additions & 0 deletions test/text.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -1388,6 +1388,14 @@ describe('Lines', function () {

expect(this.get('#t').contentArea.width).to.equal(50);
});

it('anywhere doesn\'t infinite loop on an ifc with only floats', function () {
this.layout(`
<div style="overflow-wrap: anywhere;">
<div style="float: left;"></div>
</div>
`);
});
});
});

Expand Down

0 comments on commit 9629575

Please sign in to comment.