Closed Bug 1793381 Opened 2 years ago Closed 2 years ago

Do some clean up around `HTMLEditor::InsertObject`

Categories

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

task

Tracking

()

RESOLVED FIXED
107 Branch
Tracking Status
firefox107 --- fixed

People

(Reporter: masayuki, Assigned: masayuki)

References

(Blocks 1 open bug)

Details

Attachments

(3 files)

I worked on bug 1791695 without enough understanding of the code. Therefore, for understanding the code, I cleaned up some code. For now, I think that bug 1778565 which blocked by bug 1791695 should be fixed first because it's worked by non-editor-folks, and it does not require of the fix of bug 1791695 anymore.

Therefore, I think that I should land the clean up patches only for making the code clearer.

They use bool arguments a lot. Therefore, some call-sites are hard to read.
They should be replaced with enum classes. Note that this patch does not
make the raw value of new enum classes to bool unless they are used in the
heap.

Depends on D158339

It just creates HTMLWithContextInserter and calls its Run(). Then, Run()
works as a sub action handler. Therefore, we can make DoInsertHTMLWithContext
(which sounds like a helper class of a handler method) a sub action handler.

Then, it can handle the optional insertion point in it and
HTMLWithContextInserter::Run does not need to handle it.

Depends on D158481

It's always called with DeleteSelectedContent::Yes. Therefore, the argument
is not required. Then, its name can be InsertFromTransferableAtSelection.

Depends on D158482

Pushed by masayuki@d-toybox.com: https://hg.mozilla.org/integration/autoland/rev/9822a6f424d4 part 1: Make `HTMLEditor::InsertObject` and related methods use `enum class` instead of `bool` r=m_kato https://hg.mozilla.org/integration/autoland/rev/b370875c1966 part 2: Make `HTMLEditor::DoInsertHTMLWithContext` as a sub action handler r=m_kato https://hg.mozilla.org/integration/autoland/rev/1e29e76c1d7c part 3: Drop `DeleteSelectedContent` argument from `HTMLEditor::InsertFromTransferable` r=m_kato
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 107 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: