Closed Bug 1878865 Opened 3 months ago Closed 3 months ago

overflow-wrap may interfere with text-wrap:balance reflow

Categories

(Core :: Layout: Text and Fonts, defect)

defect

Tracking

()

RESOLVED FIXED
124 Branch
Tracking Status
firefox124 --- fixed

People

(Reporter: jfkthame, Assigned: jfkthame)

References

Details

Attachments

(1 file)

From bug 1872929 comment 8:

Chrome and Safari Technical Preview balance correctly with overflow-wrap: break-word or anywhere. However, in Firefox Nightly 124.0a1 (2024-02-05) and the same overflow styles, text-wrap: balance has no effect on page load. I noticed that it does appear to work after resizing the browser horizontally after each load. It occurs when resizing wider and narrower - sounds like triggered by a reflow?

Here's a new reproduction Codepen with the container expanded to test for balancing of the second word: https://codepen.io/evelynhathaway/pen/jOJKvMX

Here's a comparison between Chrome, Firefox Dev 123.0b2 (original bug where letters are orphaned), and Firefox Nightly 124.0a1 (new related bug, before resizing)
https://bugzilla.mozilla.org/attachment.cgi?id=9378439

So the patch landed in bug 1872929 prevents us using overflow-wrap breaks during balancing, as intended, but in this example it looks like the presence of overflow-wrap is also interfering with the initial reflow of the block, which should be able to "balance" even without breaking within words.

Oh, I see... we're hitting an edge-case when the last line of the "initial" reflow of the text -- before any attempt to balance -- contains just a single word ("build" in the example here). So if we change "build" to "bu ld" in the example, the problem no longer occurs.

It looks like what happens is that during the initial reflow of that last line, we incorrectly think overflow-wrap got used (because we didn't find an inter-word break position), and that suppresses balancing.

Assignee: nobody → jfkthame
Status: NEW → ASSIGNED
Pushed by jkew@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/07c6057bdf29
Only record that breakPriority indicated use of overflow-wrap if we actually needed to break the text. r=layout-reviewers,emilio
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/44423 for changes under testing/web-platform/tests
Upstream PR was closed without merging
Pushed by jkew@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/ffcccf20cd2f
Only record that breakPriority indicated use of overflow-wrap if we actually needed to break the text. r=layout-reviewers,emilio
Flags: needinfo?(jfkthame)
Status: ASSIGNED → RESOLVED
Closed: 3 months ago
Resolution: --- → FIXED
Target Milestone: --- → 124 Branch
Upstream PR merged by moz-wptsync-bot
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: