RESOLVED FIXED 278928
AX: AXTextOperation over multiple ranges is entirely broken
https://bugs.webkit.org/show_bug.cgi?id=278928
Summary AX: AXTextOperation over multiple ranges is entirely broken
Samar Sunkaria
Reported 2024-08-30 09:13:50 PDT
When performing an AXTextOperation over multiple ranges (_in descending order of their position_), typically only the first range is replaced. In a contenteditable, multiple ranges might be replaced correctly if they aren’t located within the same node. This problem is consistently reproducible. However, it is much harder (though not impossible) to reproduce when a non-smart replacement is performed (as proposed in https://bugs.webkit.org/show_bug.cgi?id=278458). This seems to happen whenever the replacement isn't executed using the `ReplaceSelectionCommand::performTrivialReplace` and instead takes the longer path in `ReplaceSelectionCommand::doApply`. While the initial replacement is performed correctly, subsequent replacements fail because text selection fails on the following iteration of `AccessibilityObject::performTextOperation`. After the first replacement the SimpleRanges stored in `AccessibilityTextOperation` are orphaned, and can no longer be used for performing a selection; ever since https://bugs.webkit.org/show_bug.cgi?id=221942 was introduced. That change likely caused this bug.
Attachments
Radar WebKit Bug Importer
Comment 1 2024-08-30 09:14:01 PDT
Samar Sunkaria
Comment 2 2024-08-31 08:18:49 PDT
In particular I am hitting the ASSERT_NOT_REACHED() for an orphaned selection in FrameSelection::setSelectionWithoutUpdatingAppearance, for the second selection range in the same node as a previous replacement. ``` if (newSelection.isOrphan()) { ASSERT_NOT_REACHED(); clear(); return false; } ```
Samar Sunkaria
Comment 3 2024-10-01 16:17:50 PDT
EWS
Comment 4 2024-10-07 19:17:22 PDT
Committed 284801@main (4b8b62af6ff6): <https://commits.webkit.org/284801@main> Reviewed commits have been landed. Closing PR #34534 and removing active labels.
EWS
Comment 5 2024-10-08 14:33:44 PDT
Committed 283286.232@safari-7620-branch (6f342184a21d): <https://commits.webkit.org/283286.232@safari-7620-branch> Reviewed commits have been landed. Closing PR #1992 and removing active labels.
Note You need to log in before you can comment on or make changes to this bug.