[css-highlight-api] CSS custom highlights (and ::selection) are not invalidated on style changes
Categories
(Core :: CSS Parsing and Computation, defect)
Tracking
()
People
(Reporter: bartveneman, Unassigned, NeedInfo)
References
(Blocks 1 open bug)
Details
Attachments
(1 file)
44.85 KB,
image/png
|
Details |
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:142.0) Gecko/20100101 Firefox/142.0
Steps to reproduce:
- Create a text element
- Create a Range() or StaticRange() and a Highlight() within the text node to highlight text
- Apply a ::highlight(my-thing) color
- toggle a classname on the text element to change the color
CodePen repro: https://codepen.io/bartveneman/pen/KwdeyOp
Actual results:
Nothing happened
Expected results:
The highlight color should have been updated to blue when the toggle was enabled. This only happens when I resize the browser or select all the text and then unselecting it.
Comment 1•1 month ago
|
||
I believe our invalidation for these pseudo-elements is sketchy. We would end up in here and invalidate the element's style, but not trigger a repaint.
I think something like propagating an Option<RestyleDamage>
from there, rather than an invalidate_self
, and making that a repaint hint if changing ::selection
/ ::highlight
would work here. It'd over-invalidate in some cases (if the color didn't actually change). One alternative would somehow keep around whether we have an active ::highlight
and diff those styles around here...
Jan, mind setting a severity on this?
Comment 2•1 month ago
|
||
We have a few failing WPT for this, for example custom-highlight-painting-invalidation-007.html.
I can take a look.
Updated•1 month ago
|
Description
•