Closed Bug 1733009 Opened 2 months ago Closed 2 months ago

Get rid of LineBreaker::Prev()

Categories

(Core :: Internationalization, task)

task

Tracking

()

RESOLVED FIXED
95 Branch
Tracking Status
firefox95 --- fixed

People

(Reporter: TYLin, Assigned: TYLin)

References

Details

Attachments

(1 file)

Filed per Makoto's bug 1722484 comment 2.

Prev() is used by serializer (xml and text) and quote wrap. But I guess that we can avoid Prev() by rewriting serializer, Or we provide simple text character width wrap API.

So we should remove LineBreaker::Prev(), and rewrite the callers. If possible, provider a general API for text wrapping.

Depends on: 1733872
Depends on: 1733876
Depends on: 1733877
Depends on: 1733878

To minimize the disruption to callers, one possible approach here would be not to remove Prev() but instead to reimplement it in a form that doesn't depend on the underlying break-finding engine to support backward iteration.

A fairly simple strategy would be to do a naïve backwards scan for whitespace, and then use Next() to look forwards for any potential break within the range just scanned. In principle this would be slightly less performant than a backwards-iterator that directly finds breaks, but for our (very limited) use cases I don't think it would matter.

Depends on D128558

Assignee: nobody → aethanyc
Status: NEW → ASSIGNED
Pushed by tlin@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/3d2f9569baee
Remove LineBreaker::Prev(). r=jfkthame,m_kato
Status: ASSIGNED → RESOLVED
Closed: 2 months ago
Resolution: --- → FIXED
Target Milestone: --- → 95 Branch
You need to log in before you can comment on or make changes to this bug.