Closed Bug 1658536 Opened 4 years ago Closed 4 years ago

Encapsulate `HTMLEditor::HandleDeleteSelectionInternal()` and helper methods into a stack only class

Categories

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

task

Tracking

()

RESOLVED FIXED
82 Branch
Tracking Status
firefox82 --- fixed

People

(Reporter: masayuki, Assigned: masayuki)

References

Details

Attachments

(8 files)

47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review

For managing recursive calls, it should be reimplemented with a new stack only class.

Summary: Encapsulate `HTMLEditor::HandleDeleteAroundCollapsedRanges()` into a stack only class → Encapsulate `HTMLEditor::HandleDeleteSelectionInternal()` and helper methods into a stack only class

This patch just moves them into the new stack only class and make each of them
take HTMLEditor& as their first argument.

Depends on D87035

Even though their method names in stack trace become too long, but we can
guarantee that they are used only at handling deletion.

Depends on D87432

For avoiding infinite recursive calls, AutoDeleteRangesHandler returns
EditActionIgnored() when it needs to fall it back to
DeleteRangesWithTransaction() after modifying the DOM tree or the ranges
to delete. However, this makes developers understand the code harder.
And now, with making constructor of AutoDeleteRangesHandler manage the
recursive call state, we can make HandleDeleteSelection() stop handling
the fallback path.

Depends on D87437

When it returns EditActionIgnored(),
AutoDeleteRangesHandler::HandleDeleteAroundCollapsedRanges() creates another
AutoDeleteRangesHandler instance to delete leaf content node in another
block element. However, this dependency makes developers understand the
behavior harder. Therefore, we should make the method do it instead.

Depends on D87438

Pushed by masayuki@d-toybox.com:
https://hg.mozilla.org/integration/autoland/rev/cfcc43e6e3b3
part 1: Move methods called by `HTMLEditor::HandleDeleteSelectionInternal()` to `AutoDeleteRangesHandler` r=m_kato
https://hg.mozilla.org/integration/autoland/rev/f79a9d5e908a
part 2: Move `AutoBlockElementsJoiner` and `AutoInclusiveAncestorBlockElementsJoiner` into `AutoDeleteRangesHandler` r=m_kato
https://hg.mozilla.org/integration/autoland/rev/f47acf69dc40
part 3: Move `HTMLEditor::SelectionWasCollapsed` into `AutoDeleteRangesHandler` r=m_kato
https://hg.mozilla.org/integration/autoland/rev/28af71207f2e
part 4: Move some methods used only in `AutoDeleteRangesHandler` into the class r=m_kato
https://hg.mozilla.org/integration/autoland/rev/0249f69af08d
part 5: Move `HTMLEditor::HandleDeleteSelectionInternal()` into `AutoDeleteRangesHandler` r=m_kato
https://hg.mozilla.org/integration/autoland/rev/0698263c5203
part 6: Move `AutoEmptyBlockAncestorDeleter` into `AutoDeleteRangesHandler` r=m_kato
https://hg.mozilla.org/integration/autoland/rev/5550f1f7b49d
part 7: Make `HTMLEditor::HandleDeleteSelection()` stop calling `DeleteRangesWithTransaction()` a fallback when `AutoDeleteRangesHandler::Run()` returns "ignored" r=m_kato
https://hg.mozilla.org/integration/autoland/rev/22d075d9eec9
part 8: Make `AutoBlockElementsJoiner::HandleDeleteCollapsedSelectionAtOtherBlockBoundary()` creates another instance of `AutoDeleteRangesHandler` by itself r=m_kato
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: