Closed Bug 1825983 Opened 2 years ago Closed 2 years ago

Refactor handling of trailing trimmable whitespace

Categories

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

task

Tracking

()

RESOLVED FIXED
113 Branch
Tracking Status
firefox113 --- fixed

People

(Reporter: jfkthame, Assigned: jfkthame)

References

Details

Attachments

(1 file)

The current handling of trimmable whitespace, handled by nsTextFrame and gfxTextRun, is needlessly complex, and makes it difficult to reason about the changes needed for bugs like 1712703 and 1253840.

Currently, depending on the aTrimWhitespace and aHangWhitespace parameters, gfxTextRun::BreakAndMeasureText may "trim" trailing whitespace from the metrics it returns, and return the advance of the trimmed space separately. But then nsTextFrame::ReflowText may add this advance back, if it cannot be sure at reflow time that the frame will be at end-of-line; and then we'll potentially remove it again in nsTextFrame::TrimTrailingWhiteSpace.

I think a cleaner model will be to always have BreakAndMeasureText simply return the true metrics of the full range being measured, and the amount of this that is trimmable-or-hangable trailing whitespace.

This slightly simplifies gfxTextRun::BreakAndMeasureText, and should make it less confusing
to reason about trailing whitespace in nsTextFrame/nsLineLayout.

Assignee: nobody → jfkthame
Status: NEW → ASSIGNED
Blocks: 1826013
Pushed by jkew@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/67ac0c8e9a5f Refactor handling of trailing trimmable whitespace. r=emilio
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 113 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: