Closed Bug 1656432 Opened 5 years ago Closed 5 years ago

Redesign `nsIEditActionListener::WillDeleteSelection()`

Categories

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

enhancement

Tracking

()

RESOLVED FIXED
81 Branch
Tracking Status
firefox81 --- fixed

People

(Reporter: masayuki, Assigned: masayuki)

References

Details

Attachments

(3 files)

It takes Selection and it's called by EditorBase::DeleteSelectionWithTransaction(). However, its user is only FinderHighlighter and it just wants the ranges. So, we should make it take array of ranges instead of Selection.

(Although, nsIEditActionListener has negative effect for editor performance, so, we should make FinderHighligher stop using it as soon as possible.)

Currently, nsIEditActionListener::WillDeleteSelection() notifies
FinderHighliter of deleting selection ranges. But it's referred only
the ranges, not selection object itself and editor shouldn't modify
Selection as far as possible for reducing the runtime cost.

Therefore, it should be replaced with this new API. Then,
EditorBase::WillDeleteSelectionWithTransaction() can be rewritten as
EditorBase::WillDeleteRangesWithTransaction() later.

Depends on D85578

For making editor performance better and editor code simpler, I want to
stop modifying Selection as far as possible. Therefore, I'd like to
get rid of nsIEditActionListener. Instead, there is new API,
nsIEditActionListener::WillDeleteRanges(). This patch rewrites
FinderHighlighter#WillDeleteSelection() to
FinderHighlighter#WillDeleteRanges().

Depends on D85681

Attachment #9167547 - Attachment description: Bug 1656432 - part 2: Make `FinderHighlighter` use `nsIEditActionListener::WillDeleteRanges()` instead of `nsIEditActionListener::WillDeleteSelection()` → Bug 1656432 - part 2: Make `FinderHighlighter` use `nsIEditActionListener::WillDeleteRanges()` instead of `nsIEditActionListener::WillDeleteSelection()` r=Gijs
Attachment #9167547 - Attachment description: Bug 1656432 - part 2: Make `FinderHighlighter` use `nsIEditActionListener::WillDeleteRanges()` instead of `nsIEditActionListener::WillDeleteSelection()` r=Gijs → Bug 1656432 - part 2: Make `FinderHighlighter` use `nsIEditActionListener::WillDeleteRanges()` instead of `nsIEditActionListener::WillDeleteSelection()` r=Gijs!
Pushed by masayuki@d-toybox.com: https://hg.mozilla.org/integration/autoland/rev/383394e45625 part 1: Create `nsIEditActionListener::WillDeleteRanges()` r=m_kato https://hg.mozilla.org/integration/autoland/rev/ae648f1dd7c9 part 2: Make `FinderHighlighter` use `nsIEditActionListener::WillDeleteRanges()` instead of `nsIEditActionListener::WillDeleteSelection()` r=Gijs https://hg.mozilla.org/integration/autoland/rev/86048138135b part 3: Get rid of `nsIEditActionListener::WillDeleteSelection()` r=m_kato
Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → 81 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: