Page MenuHomePhabricator

Improve line breaking behavior in Firefox and Chrome under complex conditions
ClosedPublic

Authored by epriestley on May 13 2020, 6:52 PM.
Tags
None
Referenced Files
F18819467: D21247.id50597.diff
Wed, Oct 22, 6:30 AM
F18817521: D21247.diff
Tue, Oct 21, 4:14 PM
F18811278: D21247.id.diff
Mon, Oct 20, 2:24 AM
F18809605: D21247.diff
Sun, Oct 19, 3:28 PM
F18809583: D21247.diff
Sun, Oct 19, 3:14 PM
F18734293: D21247.id.diff
Tue, Sep 30, 10:51 PM
F18651413: D21247.id50596.diff
Sep 21 2025, 4:20 AM
F18643706: D21247.id.diff
Sep 19 2025, 3:06 AM
Subscribers
None

Details

Summary

See https://github.com/phacility/phabricator/pull/854. In some situations, line-break: anywhere produces better behavior than word-break: break-all. It never appears to produce worse behavior.

Test Plan
  • Break behavior changes if a line contains "<span />" elements caused by syntax highlighting. This CSS adjustment only appears to apply to text with internal "<span />" elements.
  • This specifically impacts certain internal breakpoints adjacent to punctuation, so the test case is highly specific. Generic test cases with latin word characters do not evidence any behavioral changes.
  • This change appears to have no impact on Safari, which uses the better behavior in all cases.
  • Before Patch: In Firefox and Chrome, this specific change breaks awkwardly. There is more room for text to fit on the broken line:

Firefox

firefox-highlight.png (142×631 px, 15 KB)

Chrome

chrome-highlight.png (128×641 px, 13 KB)

  • After Patch: Firefox and Chrome break the line better. Here's Firefox:

firefox-fixed.png (181×632 px, 16 KB)

  • Additional context:

Safari Behavior (Unchanged)

safari-highlight.png (123×619 px, 13 KB)

Chrome with no highlighting (desirable behavior). Firefox does the same thing.

chrome-no-highlight.png (128×642 px, 12 KB)

Also tested other cases, which seem never-worse in any browser.

anywhere.png (1×1 px, 369 KB)

Diff Detail

Repository
rP Phabricator
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

This revision was not accepted when it landed; it landed in state Needs Review.May 13 2020, 6:54 PM
epriestley requested review of this revision.
This revision was automatically updated to reflect the committed changes.