Commit cfd46d0
Register the collapsed range before clearing the old ones.
Selection::CollapseInternal() unregistered every current range and then
registered a new collapsed one. When both use the same node as their closest
common inclusive ancestor, that node's range list momentarily became empty, so
UnregisterClosestCommonInclusiveAncestor() unmarked its whole flattened
subtree and the following MarkDescendants() marked it again.
Register the new range first. The node's list then never becomes empty, and
the existing guards in both functions skip the two walks on their own. The
same holds when either node is an ancestor of the other, where the walk that
does happen now stops at the other node instead of covering it.
AddRangesForSelectableNodes() adds nothing at all when it goes through
AddRangesForUserSelectableNodes() and no part of the range is selectable,
which leaves the registration backed by no range of this selection. Clear()
has emptied the ranges by then, so the range took index 0 if it was added at
all: unregister it again when it was not, and on the error path.
Differential Revision: https://phabricator.services.mozilla.com/D317252
bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1968416
gecko-commit: 93284149ba817a492f8e55cf0bab8db6a4ac3aec
gecko-commit-git: 52a52f64306f9113dab5a028ba7472c677c46eb9
gecko-reviewers: masayuki1 parent db80bd2 commit cfd46d0
4 files changed
Lines changed: 60 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
0 commit comments