Closed Bug 1828469 Opened 2 years ago Closed 2 years ago

Display StaticRanges in custom highlights

Categories

(Core :: DOM: Selection, task)

task

Tracking

()

RESOLVED FIXED
115 Branch
Tracking Status
firefox115 --- fixed

People

(Reporter: jjaschke, Assigned: jjaschke)

References

(Blocks 1 open bug)

Details

Attachments

(2 files)

Currently StaticRanges of custom highlights are not painted. This is due to nsINode::IsSelected() not taking them into account and returning false. This should be solvable by moving some logic from nsRange to AbstractRange.

With this change, Selections are also registered into StaticRanges,
ultimately making them visible to nsINode::IsSelected(),
which is necessary to paint them.

In order to support StaticRanges, which are not MutationObservers, RangeBoundaries need to have an alternative way of ensuring that mRef points to the correct node.
This is now done by validating mRef every time Ref() is called using the parent and offset.
For performance reasons, this is disabled by default and should only be used for StaticRanges.

Attachment #9329087 - Attachment description: Bug 1828469: Moved some logic from `nsRange` to `AbstractRange` to support `StaticRange`s in custom highlights. r=masayuki! → Bug 1828469, part 2: Moved some logic from `nsRange` to `AbstractRange` to support `StaticRange`s in custom highlights. r=masayuki!
Pushed by jjaschke@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/c78c717e4ec9 part 1: Prepare `RangeBoundaryBase` to be able to handle non-`MutationObserver` Range classes. r=masayuki https://hg.mozilla.org/integration/autoland/rev/217801294c41 part 2: Moved some logic from `nsRange` to `AbstractRange` to support `StaticRange`s in custom highlights. r=masayuki https://hg.mozilla.org/integration/autoland/rev/ab92a12ba6ea apply code formatting via Lando
Pushed by jjaschke@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/b1014972dcb6 part 1: Prepare `RangeBoundaryBase` to be able to handle non-`MutationObserver` Range classes. r=masayuki https://hg.mozilla.org/integration/autoland/rev/d1863c09bc4e part 2: Moved some logic from `nsRange` to `AbstractRange` to support `StaticRange`s in custom highlights. r=masayuki
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 115 Branch
Flags: needinfo?(jjaschke)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: