Closed Bug 1850910 Opened 3 years ago Closed 3 years ago

`WhiteSpaceVisibilityKeepers::DeleteContentNodeAndJoinTextNodesAroundIt()` may not suggest caret position

Categories

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

defect

Tracking

()

RESOLVED FIXED
119 Branch
Tracking Status
firefox119 --- fixed

People

(Reporter: masayuki, Assigned: masayuki)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

It's called when deleting invisible <br> element, then, if it does not suggest valid caret position, it stops handling the deletion. The method returns the result of WhiteSpaceVisibilityKeeper::MakeSureToKeepVisibleStateOfWhiteSpacesAroundDeletingRange(). However, it may not suggest caret position if it does not touch the DOM tree, e.g., when the caret point is surrounded by <img>s because it does not take the default caret position. Therefore, DeleteContentNodeAndJoinTextNodesAroundIt() should return default caret position instead if MakeSureToKeepVisibleStateOfWhiteSpacesAroundDeletingRange() does not suggest caret position.

It returns the result of
MakeSureToKeepVisibleStateOfWhiteSpacesAroundDeletingRange(), but it suggests
caret position only when it modifies the DOM tree since it does not take the
default caret position.

So, DeleteContentNodeAndJoinTextNodesAroundIt() does need to return
aCaretPoint with tracking it during DOM mutations if
MakeSureToKeepVisibleStateOfWhiteSpacesAroundDeletingRange() does not
suggest caret point.

I found this bug when I was trying to fix the unexpected failing of
forward delete at end of the last block in the editing host (bug 1850666)
because changing the error handling anyway cause another error at this line.
https://searchfox.org/mozilla-central/rev/bdd5b85b56885cd48bd91d262647e0d3499b3a27/editor/libeditor/HTMLEditorDeleteHandler.cpp#1652

Therefore, without fixing bug 1850666, I have no idea how to check this fix.

Pushed by masayuki@d-toybox.com: https://hg.mozilla.org/integration/autoland/rev/75a26c4410dc Make `WhiteSpaceVisibilityKeepers::DeleteContentNodeAndJoinTextNodesAroundIt()` return caret point correctly r=m_kato
Status: ASSIGNED → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 119 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: