Closed Bug 1739315 Opened 3 years ago Closed 3 years ago

Make `HTMLEditor::JoinNodesWithTransaction()` return error if cannot join given nodes

Categories

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

enhancement

Tracking

()

RESOLVED FIXED
96 Branch
Tracking Status
firefox96 --- fixed

People

(Reporter: masayuki, Assigned: masayuki)

References

Details

Attachments

(2 files)

No description provided.

TopLevelEditSubActionData::WillJoinNodes() and
TopLevelEditSubActionData::DidJoinNodes() are called only by
HTMLEditor::JoinNodesWithTransaction(). WillJoinNodes() assumes that
all children or text data in aLeftContent is moved to head of aRightContent.
Therefore, it just stores length of aLeftContent and DidJoinNodes() lets
AddPointToChangedRange() know the joined point.

Same value is stored by HTMLEditor::JoinNodesWithTransaction(). Therefore,
it can create same DOM point at calling DidJoinNodes() so that we can get
rid of WillJoinNodes().

Now, it does not notify nobody before joining the nodes. Therefore, it can
return error immediately if it fails to create a transaction to join the given
nodes.

Additionally, this patch makes it return NS_ERROR_EDITOR_DESTROYED if the
editor is destroyed while it handles to join nodes. Therefore, we can get rid
of the check by the callers.

Depends on D130348

Pushed by masayuki@d-toybox.com: https://hg.mozilla.org/integration/autoland/rev/c50c8ac11ff7 part 1: Make `HTMLEditor::JoinNodesWithTransaction()` directly notify `TopLevelEditSubActionData::DidJoinNodes()` of joined position r=m_kato https://hg.mozilla.org/integration/autoland/rev/cef70047defb part 2: Make `HTMLEditor::JoinNodesWithTransaction()` return error if failed r=m_kato
Backout by ctuns@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/e8f7a1b60409 Backed out 2 changesets for causing android wpt failures.
Pushed by ctuns@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/c8325dd6a09d part 1: Make `HTMLEditor::JoinNodesWithTransaction()` directly notify `TopLevelEditSubActionData::DidJoinNodes()` of joined position r=m_kato https://hg.mozilla.org/integration/autoland/rev/734d287e2f28 part 2: Make `HTMLEditor::JoinNodesWithTransaction()` return error if failed r=m_kato

Sorry for the trouble, relanded here:.

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: