Closed Bug 1646296 Opened 4 years ago Closed 4 years ago

Group `WSRunScanner` members with stack only classes

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

(8 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
(deleted), text/x-phabricator-request
Details
(deleted), text/x-phabricator-request
Details

Some members of WSRunScanner should be grouped for managing them easily and making easier to create WSFragment without WSRunScanner.

The result should never be modified so that it should return const-pointer.

Despite the name, it stores range of white-space sequence and/or start/end
reason. Initializing start and end are completely independent. Therefore,
we can move them into independent methods.

Depends on D79964

There are duplicated code in both WSRunScanner::InitializeRangeStart()
and WSRunScanner::InitializeRangeEnd(). They scan text node to store
first and last NBSP positions and initialize start/end with found visible
character position. This patch makes the loop clearer.

Depends on D79965

Their topmost else blocks mean there is no visible content before/after the
point. In this case, the initialization is simpler. So, they should be
handled first, and make the other blocks outdented.

Depends on D79966

Similar to the previous patch, this patch moves the last else block of
the loops in WSRunScanner::InitializeRangeStart() and
WSRunScanner::InitializeRangeEnd() to before the text node handling case.
This makes that clearer that the loops are continued only when text node
has no text or only white-spaces.

Depends on D79969

With the previous patches, we know that the loops in
WSRunScanner::InitializeRangeStart() and WSRunScanner::InitializeRangeEnd()
rarely run twice and more. Therefore, we can make use recursive calls instead
of the loop.

Depends on D79970

Pushed by masayuki@d-toybox.com: https://hg.mozilla.org/integration/autoland/rev/8d950fc8920f part 1: Make `WSRunScanner::FindNearestRun()` return `const WSFragment*` instead of `WSFragment*` r=m_kato
Pushed by masayuki@d-toybox.com: https://hg.mozilla.org/integration/autoland/rev/20ea75a91be0 part 2: Split `WSRunScanner::GetWSNodes()` r=m_kato
Pushed by masayuki@d-toybox.com: https://hg.mozilla.org/integration/autoland/rev/dd3b637431ab part 3: Create helper methods of `WSRunScanner::InitializeRange*()` to scan a text node r=m_kato
Pushed by masayuki@d-toybox.com: https://hg.mozilla.org/integration/autoland/rev/dcc4bbf0b662 part 4: Make the loops in `WSRunScanner::InitializeRange*()` handle topmost `else` block first r=m_kato
Pushed by masayuki@d-toybox.com: https://hg.mozilla.org/integration/autoland/rev/26b6a6de28a3 part 5: Make the last `else` block in the loops of `WSRunScanner::InitializeRange*()` handled before the text node case r=m_kato
Pushed by masayuki@d-toybox.com: https://hg.mozilla.org/integration/autoland/rev/eaffca941228 part 6: Make `WSRunScanner::InitializeRange*()` stop using the loops which are rarely run twice and more r=m_kato
Pushed by masayuki@d-toybox.com: https://hg.mozilla.org/integration/autoland/rev/75d781b31267 part 7: Make `WSRunScanner::InitializeRange*()` template methods r=m_kato
Pushed by masayuki@d-toybox.com: https://hg.mozilla.org/integration/autoland/rev/135eb1ba22b6 part 8: Make stack only classes to group start/end boundary information of `WSRunScanner` r=m_kato
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
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: