Closed Bug 1632726 Opened 5 years ago Closed 5 years ago

Make `*ExtendForDelete()` of `nsISelectionController` and `nsFrameSelection` just return extended range instead of updating selection ranges

Categories

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

task

Tracking

()

RESOLVED FIXED
mozilla77
Tracking Status
firefox77 --- fixed

People

(Reporter: masayuki, Assigned: masayuki)

References

Details

Attachments

(2 files)

For bug 1618457, editor needs to compute delete range which is computed by nsFrameSelection via nsISelectionController. However, current their APIs always update the selection ranges.

Currently, EditorBase::ExtendSelectionForDelete() depends on some
nsISelectionController methods to compute extended range for deletion
from collapsed selection. They are implemented by
nsFrameSelection::MoveCaret() and nsFrameSelection::TakeFocus().
Ideally, we should split these methods for computation part and performing
part. However, they change selection with updating other selection state,
for example, table selection state and bidi information. Therefore, it's
impossible to split them with simple code. However, I need to change
EditorBase::ExtendSelectionForDelete() just return extended range.

Therefore, this patch creates nsFrameSelection::PeekOffsetForMoveCaret()
which has the main path in MoveCaret() for the EditorBase method.

Then, MoveCaret() and new nsFrameSelection::GetExtendedRangeCommon()
share the computation code of expanding normal selection.

Finally, this patch wraps nsFrameSelection::GetExtendedRangeCommon() with
new public inline methods for EditorBase.

The following patch will remove no-user methods of nsISelectionController.

Depends on D72294

Even in comm-central and BlueGriffon, nsISelectionController::*ForDelete()
are not used. Therefore, we can remove them safely.

Depends on D72295

Pushed by masayuki@d-toybox.com: https://hg.mozilla.org/integration/autoland/rev/3baf6ee966a6 part 1: Create utility methods to compute delete range from collapsed selection in `nsFrameSelection` r=smaug https://hg.mozilla.org/integration/autoland/rev/f678ce3e8aa0 part 2: Remove some unused `nsISelectionController` methods r=smaug
Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla77
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: