Closed Bug 2072095 Opened 13 days ago Closed 6 days ago

Make `nsRange::CharacterDataChanged` stop droing wrong handling at split text

Categories

(Core :: DOM: Selection, defect)

defect

Tracking

()

RESOLVED FIXED
158 Branch
Tracking Status
firefox-esr140 --- unaffected
firefox-esr153 --- unaffected
firefox156 --- unaffected
firefox157 --- unaffected
firefox158 --- fixed

People

(Reporter: masayuki, Assigned: masayuki)

References

(Regression)

Details

(Keywords: regression)

Attachments

(1 file)

AI review pointed an extant bug of nsRange::CharacterDataChanged:
https://phabricator.services.mozilla.com/D323941#inline-1733034

The comment on line 630 says "register the range to the new common ancestor", but when only the end boundary moves to the new sibling (start stays on the original node), the registered node is not the actual common ancestor — it's just the new end container. The true common ancestor (the parent of both sibling nodes) is computed later by DoSetRange → UpdateCommonAncestorIfNecessary.

Perhaps, nsRange::CharacterDataChanged does not need to do it by itself...

Summary: Make `nsRange::CharacterDataChanged` stopped droing wrong handling at split text → Make `nsRange::CharacterDataChanged` stop droing wrong handling at split text

Oh, when aContent is split, the new node has not been inserted to the DOM yet. So, nsRange needs to do that.

If the range starts from the old Text and ends in new Text, the
closest common inclusive ancestor is the parent element, but current
code always treats the new Text as the closest common inclusive
ancestor.

This is caused by a regression of bug 2069772. So, we have to fix this soon.

No longer depends on: 2069772
Keywords: regression
Regressed by: 2069772

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

Pushed by masayuki@d-toybox.com: https://github.com/mozilla-firefox/firefox/commit/26694a6cbac7 https://hg.mozilla.org/integration/autoland/rev/a4dffbf0b408 Make `nsRange::CharacterDataChanged` maintain selection state of new `Text` and its closest common inclusive ancestor at split correctly r=jjaschke

Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/62842 for changes under testing/web-platform/tests

Status: ASSIGNED → RESOLVED
Closed: 6 days ago
Resolution: --- → FIXED
Target Milestone: --- → 158 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: