Closed Bug 1733872 Opened 4 months ago Closed 4 months ago

Add a new LineBreak::Next() that treat text end a line break opportunity

Categories

(Core :: Internationalization, task)

task

Tracking

()

RESOLVED FIXED
95 Branch
Tracking Status
firefox95 --- fixed

People

(Reporter: TYLin, Assigned: TYLin)

References

Details

Attachments

(2 files)

I notice LineBreaker::Next() doesn't treat text end a line break opportunity. To make the integration of ICU4X line segmenter easier, we should audit the existing users of this API.

After Bug 1728708 Part 4 [1], WordBreaker always breaks at the end of
text. Therefore, we don't need to manually record the end of text as a
word break opportunity when we see NS_WORDBREAKER_NEED_MORE_TEXT.

[1] https://hg.mozilla.org/mozilla-central/rev/55efff2d5628

The motivation of this patch is similar to Bug 1728708 Part 4, which
should make the future integration of ICU4X line segmenter easier. A
UAX14 compatible line breaker always breaks at the end of text
(rule LB3 [1]), and ICU4X line segmenter has this behavior, too.

Current LineBreaker::Next() doesn't treat the end of text as a line
break opportunity, so this patch deprecates it by renaming it, and add a
new Next() method.

TestASCIILB() has adopted the new Next(). All the other callers of the
DeprecatedNext() should be audited later, possibly with the removal of
Prev() because the all the usages are very close.

[1] https://www.unicode.org/reports/tr14/#LB3

Depends on D127378

Blocks: 1733876
Blocks: 1733877
Blocks: 1733878
Attachment #9244119 - Attachment description: Bug 1733872 Part 1 - Simplify a helper function TestASCIIWB. → Bug 1733872 Part 1 - Modernize TestASCIILB and TestASCIIWB.
Pushed by aethanyc@gmail.com:
https://hg.mozilla.org/integration/autoland/rev/8f0754b30e5f
Part 1 - Modernize TestASCIILB and TestASCIIWB. r=m_kato
https://hg.mozilla.org/integration/autoland/rev/d84f81974d8a
Part 2 - Add a new LineBreaker::Next(), and deprecate the old Next(). r=m_kato
Blocks: 1734590
Status: NEW → RESOLVED
Closed: 4 months ago
Resolution: --- → FIXED
Target Milestone: --- → 95 Branch
You need to log in before you can comment on or make changes to this bug.