Closed Bug 1646325 Opened 4 years ago Closed 4 years ago

Make `WSRunScanner` create `WSFragment`s only when needed

Categories

(Core :: DOM: Editor, task, P2)

task

Tracking

()

RESOLVED FIXED
mozilla79
Tracking Status
firefox79 --- fixed

People

(Reporter: masayuki, Assigned: masayuki)

References

Details

(Whiteboard: [h2review-noted])

Attachments

(6 files, 8 obsolete files)

(deleted), text/x-phabricator-request
Details
(deleted), text/x-phabricator-request
Details
(deleted), text/x-phabricator-request
Details
(deleted), text/x-phabricator-request
Details
(deleted), text/x-phabricator-request
Details
(deleted), text/x-phabricator-request
Details

In most WSRunScanner methods, WSFragments are not used, but they are initialized when WSRunScanner is created. For stopping unnecessary things, WSRunScanner should create part of them or all of them when they are needed.

Part 1-* rewrite WSRunScanner::GetRuns() with early-return style, but it's
hard to review if changing it with a patch.

This just swaps the if and else block because the else block is
shorter than the if block.

Depends on D79973

WSFragment is created at least one instance, and at most 3 instances per
WSRunScanner instance. They can be managed with AutoTArray simpler and
we can avoid heap allocation with this approach.

Depends on D80313

Now, WSFragment is managed by AutoTArray so that it does not need to
be double-linked-list.

Depends on D80314

The last fragment which is for trailing white-spaces can be created with
previous fragment and end boundary data. Therefore, we can make WSFragment
create it by itself with taking WSRunScanner::mEnd.

Depends on D80315

Similarly, it can handle 2nd fragment which is needed for leading white-spaces.

Depends on D80316

Unfortunately, in both CreateFirstOne() and CreateNextOne(), a lot of
checks are duplicated for avoiding to create unnecessary fragments. They
will be sorted out in the following patch.

Depends on D80320

Unfortunately, mRightWSType may be different from end reason. Therefore,
the checker methods need to take end BoundaryData.

Depends on D80321

In most methods of WSRunScanner, WSFragments are never used. Therefore,
this patch makes them created when they are necessary.

Depends on D80322

Attachment #9157838 - Attachment is obsolete: true
Attachment #9157839 - Attachment is obsolete: true
Attachment #9157840 - Attachment is obsolete: true
Attachment #9157841 - Attachment is obsolete: true
Attachment #9157842 - Attachment is obsolete: true
Attachment #9157843 - Attachment is obsolete: true
Attachment #9157844 - Attachment is obsolete: true
Attachment #9157845 - Attachment is obsolete: true
Pushed by masayuki@d-toybox.com: https://hg.mozilla.org/integration/autoland/rev/1c0f0b027ad4 part 1-1: Make `WSRunScanner::GetRuns()` handle the case not starting from hard line break first r=m_kato

In most methods of WSRunScanner, WSFragments are never used. Therefore,
this patch makes them created when they are necessary.

Depends on D80315

Pushed by masayuki@d-toybox.com: https://hg.mozilla.org/integration/autoland/rev/299013aba1c6 part 1-2: Rewrite the new `if` block in `WSRunScanner::GetRuns()` with early-return style r=m_kato
Pushed by masayuki@d-toybox.com: https://hg.mozilla.org/integration/autoland/rev/fd4c91558120 part 1-3: Rewrite remaining part of `WSRunScanner::GetRuns()` with early-return style r=m_kato
Pushed by masayuki@d-toybox.com: https://hg.mozilla.org/integration/autoland/rev/ae9a82a6a0f0 part 2: Manage `WSFragment`s with array r=m_kato
Pushed by masayuki@d-toybox.com: https://hg.mozilla.org/integration/autoland/rev/19ac1eb89426 part 3: Make `WSFragment` non-double-linked-list r=m_kato
Pushed by masayuki@d-toybox.com: https://hg.mozilla.org/integration/autoland/rev/a5281b36d858 part 4: Make `WSRunScanner` create `WSFragment` when it's needed r=m_kato
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Keywords: leave-open
Resolution: --- → FIXED
Target Milestone: --- → mozilla79
Whiteboard: [h2review-noted]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: