Closed Bug 1789344 Opened 2 years ago Closed 2 years ago

Selection after inserting paragraph at `abc<span>[def</span>]ghi` is wrong

Categories

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

defect

Tracking

()

RESOLVED FIXED
106 Branch
Tracking Status
firefox-esr91 --- wontfix
firefox-esr102 --- wontfix
firefox104 --- wontfix
firefox105 --- wontfix
firefox106 --- fixed

People

(Reporter: masayuki, Assigned: masayuki)

References

(Regression, )

Details

(Keywords: regression)

Attachments

(1 file)

STR

  1. Load https://jsfiddle.net/d_toybox/bs9ym2cf/

Actual Result

Caret appears at end of the line

Expected Result

Caret should appear between "c" and "g".

This is reproducible even in ESR 91.

Severity: -- → S3
Priority: -- → P2

Set release status flags based on info from the regressing bug 1297414

When selection is abc<b>[def</b>]ghi, insertParagraph command will delete
the <b> element first, then, Selection becomes abc{}ghi. Then,
HTMLEditor::InsertParagraphSeparatorAsSubAction wraps all of the line in
the default paragraph, <div>, with
HTMLEditor::FormatBlockContainerWithTransaction (although this is incompatible
behavior with the other browsers). At this time, new <div> is inserted before
the first text node and then, move the text nodes into the new <div>.

However, RangeUpdater::DidMoveNode just slides the offsets if containers of
registered DOM points are the ex-parent of the moving nodes. Therefore, the
tracked selection range in HTMLEditor::FormatBlockContainerWithTransaction
become <div></div>abc{}def, then, <div>abcdef</div>{}, but the expected
behavior is of course, <div>abc{}def</div>, then, split the new <div>.

So the problem is, DidMoveNode assumes that DOM points won't point the moving
content node. If the node is pointed, it should keep pointing in the new
parent.

Note that the expectations of new tests are based on Chrome, therefore, the
new known failures are incompatible with Chrome.

Pushed by masayuki@d-toybox.com:
https://hg.mozilla.org/integration/autoland/rev/713c1697c555
Make `SelectionState::DidMoveNode` track DOM points having pointed the moved content correctly r=m_kato
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/35870 for changes under testing/web-platform/tests
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 106 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: