Closed Bug 1811823 Opened 1 year ago Closed 1 year ago

CSS Custom Highlight API: Invalidation and prioritization

Categories

(Core :: CSS Parsing and Computation, task)

task

Tracking

()

RESOLVED FIXED
116 Branch
Tracking Status
firefox116 --- fixed

People

(Reporter: jjaschke, Assigned: jjaschke)

References

(Blocks 1 open bug)

Details

Attachments

(2 files, 2 obsolete files)

Main part of this patch is a refactoring of nsTextFrame::ResolveSelections(),
which was necessary in order to determine the correct highlight selection to be painted.
Instead of returning the prevailing selection for a segment, it now returns
an array of Selections per segment, ordered by the priority.
In the future, this array can be used to combine different selection types properly:

  • overlapping highlights where the higher prioritized highlight does not define text color,
    and therefore the next-lower-priority text color should be used
  • When a highlighted segment is also selected by normal selection, the selections could be blended together. Right now only normal selection is painted.

Depends on D174480

Attachment #9326634 - Attachment description: WIP: Bug 1811823, part 1: Order highlight selections by insertion order. r=masayuki → Bug 1811823, part 1: Order highlight selections by insertion order. r=masayuki
Attachment #9326635 - Attachment description: WIP: Bug 1811823, part 2: Fixed prioritization issues for Custom Highlight API. → Bug 1811823, part 2: Fixed some prioritization issues for Custom Highlight API. r=emilio!
Attachment #9326634 - Attachment description: Bug 1811823, part 1: Order highlight selections by insertion order. r=masayuki → WIP: Bug 1811823, part 1: Order highlight selections by insertion order. r=masayuki
Attachment #9326635 - Attachment description: Bug 1811823, part 2: Fixed some prioritization issues for Custom Highlight API. r=emilio! → WIP: Bug 1811823, part 2: Fixed some prioritization issues for Custom Highlight API. r=emilio!
Depends on: 1836013

Comment on attachment 9326634 [details]
WIP: Bug 1811823, part 1: Order highlight selections by insertion order. r=masayuki

Revision D174480 was moved to bug 1836013. Setting attachment 9326634 [details] to obsolete.

Attachment #9326634 - Attachment is obsolete: true

The idea of this struct is to allow live data of a highlight selection to be passed into layout.
Layout needs highlight properties such as priority or type to resolve combinations of highlights correctly.

Due to the prioritization rules for custom highlights, it is not feasible to rely on cascading.
Instead, highlights need to be stacked by their priority (and order of insertion).
Text and background color of the highest-prioritized highlight which defines that property should be used.

Since highlights are implemented as special Selections, the algorithm that determines the prevailing selection for a text frame needed to be adapted to instead return a list of selections.

Depends on D181142

Attachment #9326635 - Attachment is obsolete: true
See Also: → 1840089
Pushed by jjaschke@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/a8cecdf5e3ff
part 1: Added `HighlightSelectionData` struct. r=emilio
https://hg.mozilla.org/integration/autoland/rev/7a9232452ebf
part 2: Add correct prioritization for custom highlights. r=emilio
Status: NEW → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → 116 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: