Closed Bug 1742744 Opened 3 years ago Closed 3 years ago

Stop using `CreateElementTransaction` in `HTMLEditor`

Categories

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

task

Tracking

()

RESOLVED FIXED
96 Branch
Tracking Status
firefox96 --- fixed

People

(Reporter: masayuki, Assigned: masayuki)

References

(Blocks 1 open bug)

Details

Attachments

(2 files)

CreateElementTransaction is too similar to InsertNodeTransaction. Only the difference is, CreateElementTransaction::DoTransaction() creates an element via editor instance and marks it dirty before inserting the new element. E.g., selection management and whether inserting new node or not at "redo" are same.

So, for the maintenance cost reason, we should get rid of CreateElementTransaction, but for now, we should just make HTMLEditor use InsertNodeTransaction instead with a new pref to make it possible to back it out the new behavior.

This is a different point from InsertNodeTransaction. If reference node has
been removed from the DOM tree, it tries to insert the given node to end of
the container instead of returning error. This is an edge case of "redo", and
this is tested by WPT. If we'd need to back it out with Normandy after shipping
this changes, we'd need to uplift WPT expectation change. However, we should
avoid this situation. Therefore, this patch fixes the bug of
CreateElementTransaction first.

Assignee: nobody → masayuki
Status: NEW → ASSIGNED

CreateElementTransaction is too similar to InsertNodeTransaction. Only the
difference is, CreateElementTransaction::DoTransaction() creates an element via
editor instance and marks it dirty before inserting the new element. E.g.,
selection management and whether inserting new node or not at "redo" are same.

So, for the maintenance cost reason, we should get rid of
CreateElementTransaction, but for now, we should just make HTMLEditor use
InsertNodeTransaction instead, with a new pref to make it possible to back it
out the new behavior even after shipping.

Depends on D132118

Pushed by masayuki@d-toybox.com:
https://hg.mozilla.org/integration/autoland/rev/8a151455283b
part 1: Make `CreateElementTransaction::InsertNode()` not return error if reference child is disconnected r=m_kato
https://hg.mozilla.org/integration/autoland/rev/d4bd94bc7b58
part 2: Make `HTMLEditor` stop using `CreateElementTransaction` by default r=m_kato
Status: ASSIGNED → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 96 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: