Allow Ranges to be in multiple Selections
Categories
(Core :: DOM: Selection, task)
Tracking
()
Tracking | Status | |
---|---|---|
firefox112 | --- | fixed |
People
(Reporter: jjaschke, Assigned: jjaschke)
References
(Blocks 1 open bug)
Details
Attachments
(1 file)
Currently a nsRange
can only be associated with one Selection
instance. To support the custom highlight API, for which we use the Selection mechanism to display highlights, it must be possible for a Range to be part of multiple Selections.
This should be as simple as replacing nsRange::mSelection
with a nsTArray<RefPtr<Selection>>
and updating the RegisterSelection()
/UnregisterSelection()
methods.
Assignee | ||
Updated•2 years ago
|
Assignee | ||
Comment 1•2 years ago
|
||
The Custom Highlight API allows a use case where a Range
of a Highlight
is used as Selection
. Due to the decision to use the Selection
mechanism
to display Highlight
s, this results in the possibility of a Range
being 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
.
For performance and memory reasons and acknowledging that
in the overwhelming majority of cases only one Selection
will
be associated with a nsRange
, the Selection
s are divided into
one single Selection
(mSelection
) and an array of additional
Selection
s (mAdditionalSelections
).
When several Selection
s are present and the first one is removed,
one of the other Selection
s is moved out of the array,
guaranteeing that mSelection
is not null.
Registering and unregistering of the closest common inclusive ancestor
of the Range
happens when the first Selection
is registered and
the last Selection
is unregistered.
Updated•2 years ago
|
Comment 3•2 years ago
|
||
bugherder |
Description
•