Add support for StaticRange in Selection
Categories
(Core :: DOM: Selection, enhancement)
Tracking
()
Tracking | Status | |
---|---|---|
firefox112 | --- | fixed |
People
(Reporter: jjaschke, Assigned: jjaschke)
References
(Blocks 1 open bug, )
Details
Attachments
(2 files)
The Custom Highlight API dictates that highlights can be created from AbstractRange
s, i.e. both static and dynamic ranges. Internally, highlights are implemented as a Selection
. Selections currently only support dynamic ranges (nsRange
), not StaticRanges. Therefore, support for StaticRanges in Selection must be added to support the Highlight API.
Assignee | ||
Comment 1•2 years ago
|
||
This change is necessary to support the CSS Highlight API,
which uses Selection
internally.
To replace nsRange
with AbstractRange
, some sections needed to be
adapted since nsRange
-specific features were used.
Therefore, some methods (such as GetRangeAt()
) may only be called if
the Selection
is not of type SelectionType::eHighlight
,
as it (per spec) returns an nsRange
.
These methods will now MOZ_ASSERT
if called for a highlight selection.
Additional methods are implemented which return AbstractRange
instead and are safe to be called for every selection type.
This commit also improves support of highlight features:
- Invalidation of highlight ranges: adding/removing Ranges in-place instead of
removing and re-adding the Selection object associated with the highlight. - Ranges are only associated with the Selection that shares the same Document
- Fixed minor IDL issue
Updated•2 years ago
|
Updated•2 years ago
|
Assignee | ||
Comment 2•2 years ago
|
||
Depends on D170582
Comment 4•2 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/d0efd5366ad0
https://hg.mozilla.org/mozilla-central/rev/328335bf81de
Description
•