Open Bug 1839469 Opened 10 months ago Updated 9 months ago

'Bad Apple' CSS Custom Highlight demo is slower in Firefox than Chromium

Categories

(Core :: CSS Parsing and Computation, defect)

Firefox 116
x86_64
Linux
defect

Tracking

()

Tracking Status
firefox116 --- affected

People

(Reporter: gregp, Unassigned)

References

(Blocks 1 open bug, )

Details

Steps to reproduce:

  1. Navigate to about:config
  2. Set dom.customHighlightAPI.enabled to true
  3. Navigate to https://bucket.daz.cat/work/igalia/0/highlightroll.blinkon.html
  4. Press play

Actual results:
Jank

Expected results:
Less jank

https://share.firefox.dev/3CDcPJn

There is fps in the title of the page. Chrome gets to 16fps at some point where Nightly is around 10fps.
The profile nicely points to the exact thing being slow. It is mostly mozilla::dom::Selection::StyledRanges::FindInsertionPoint
nsTextPaintStyle::GetCustomHighlightColors also shows up quite a bit.

Yeah, it looks like nsTextFrame queries the selection details quite often (nsTextFrame::GetSelectionDetails()), like in every frame or so (?). I wonder if it would be feasible of caching the selection details for as long as there are no DOM mutations?

I would guess the same behaviour could be reproduced by using find on a page with many results. So this showing up for custom highlight may just be a symptom of a more general issue.

The severity field is not set for this bug.
:dholbert, could you have a look please?

For more information, please visit BugBot documentation.

Flags: needinfo?(dholbert)
Severity: -- → S3
Flags: needinfo?(dholbert)
You need to log in before you can comment on or make changes to this bug.