gecko-dev/extensions/spellcheck
Jan-Niklas Jaeschke 2243494a74 Bug 1810403: Allow nsRanges to be in multiple Selections. r=masayuki
The Custom Highlight API allows a use case where a `Range` of a `Highlight`
is also used as `Selection`. Due to the decision to use the `Selection` mechanism
to display `Highlight`s, a `Range` can be part of several `Selection`s.
Since the `Range` has a pointer to its associated `Selection`
to notify about changes, this must be adapted to allow several `Selections`.

As a tradeoff of performance and memory usage, the `Selection`s are stored
as `mozilla::LinkedList`. A helper class `mozilla::SelectionListWrapper`
was implemented to allow `Selection`s to be in multiple of these lists
and without having to be derived from `LinkedListElement<T>`.

To simplify usage of the list, the use case  "does this range belong to Selection x?"
is wrapped into the convenience method`IsInSelection(Selection&)`;
The method previously named like this was renamed to `IsInAnySelection()`
to be named more precisely.

Registering and unregistering of the closest common inclusive ancestor
of the `Range` is done when the first `Selection` is registered and
the last `Selection` is unregistered.

Differential Revision: https://phabricator.services.mozilla.com/D169597
2023-02-21 12:25:28 +00:00
..
docs Bug 1808875 - Documentation: link to bug alias for requesting new words instead of requiring a new bug, r=bolsson 2023-01-06 18:29:25 +00:00
hunspell
idl
locales Bug 1808872 - Add new words to en-US dictionary, r=bolsson 2023-01-25 18:40:14 +00:00
src Bug 1810403: Allow nsRanges to be in multiple Selections. r=masayuki 2023-02-21 12:25:28 +00:00
tests
moz.build