Closed Bug 1891659 Opened 5 months ago Closed 5 months ago

`HTMLEditor::AutoDeleteRangesHandler::AutoBlockElementsJoiner::DeleteTextAtStartAndEndOfRange()` may delete the text node

Categories

(Core :: DOM: Editor, defect)

defect

Tracking

()

RESOLVED FIXED
127 Branch
Tracking Status
firefox127 --- fixed

People

(Reporter: masayuki, Assigned: masayuki)

References

Details

Attachments

(1 file)

The method does not assume that given range is in a text node. Therefore, it may delete all text in the text node.

It assumes that the range is always starts and ends in different node. This
is true for now, but this will be called with a text node to delete only
preformatted line break. Note that the only caller of it does not need the
text node(s) if it becomes empty. Therefore, this patch makes it remove the
text node in such case.

Note that the test changed in
input-events-get-target-ranges-deleting-in-list-items.tentative.html was
wrong and only Firefox passed it because the range description was
(#text "", 0) - (#text "", 10) since the text nodes are removed after
deleting the text data of them. Now, they become
(#text "list-item1", 0) - (#text "list-item2", 10).

Depends on D207688

Pushed by masayuki@d-toybox.com: https://hg.mozilla.org/integration/autoland/rev/75ecbad035af Make `AutoBlockElementsJoiner::DeleteTextAtStartAndEndOfRange()` handle the case when the range in a text node r=m_kato
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/45900 for changes under testing/web-platform/tests
Status: ASSIGNED → RESOLVED
Closed: 5 months ago
Resolution: --- → FIXED
Target Milestone: --- → 127 Branch
Upstream PR merged by moz-wptsync-bot
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: