Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CSS highlight pseudo system #95

Closed
delan opened this issue Nov 22, 2022 · 5 comments
Closed

CSS highlight pseudo system #95

delan opened this issue Nov 22, 2022 · 5 comments
Assignees
Labels
from: Bloomberg Proposed, edited, or co-edited by Bloomberg. from: Igalia Proposed, edited, or co-edited by Igalia. position: support topic: css Spec relates to CSS (Cascading Style Sheets) venue: W3C CSS WG

Comments

@delan
Copy link

delan commented Nov 22, 2022

Request for position on an emerging web specification

Information about the spec

Design reviews and vendor positions

Bugs tracking this feature

Anything else we need to know

css-pseudo-4 specifies the widely-supported but previously non-standard ::selection as one of several “highlight pseudos”, along with things like spelling/grammar errors and author-defined custom highlights. The highlight pseudos include a more powerful processing model:

  • highlights can now add their own decorations and shadows
  • highlights can now inherit applicable properties from ancestor highlight styles (was also true for Presto!)

This is mostly compatible with older ::selection impls but not completely:

  • originating shadows now paint below the backgrounds of ::selection and other highlights
  • ::selection can no longer remove or (in general) change the color of originating decorations and shadows
  • it was possible (albeit unlikely) for existing content to rely on ::selection styles not being inherited
  • custom properties on :root are no longer visible to ::selection pseudos unless defined on :root::selection

For more details, check out our explainer.

Although this new system is complex, we have successfully implemented it in Blink, and we’re planning to send an intent to ship for it soon. We recently shared our techniques for making it performant at BlinkOn 17. The main Blink features are HighlightOverlayPainting (stable in M105) and HighlightInheritance (stable in M105 for custom highlights only).

@smfr
Copy link

smfr commented Nov 22, 2022

@anttijk @megangardner

@delan
Copy link
Author

delan commented Nov 29, 2022

Hi, just following up on this, any thoughts? Happy to answer any questions you might have.

@mrego mrego added from: Bloomberg Proposed, edited, or co-edited by Bloomberg. from: Igalia Proposed, edited, or co-edited by Igalia. topic: css Spec relates to CSS (Cascading Style Sheets) venue: W3C CSS WG labels Nov 30, 2022
@anttijk
Copy link

anttijk commented Nov 30, 2022

These special inheritance rules are annoying (inheriting non-inherited properties?) and require special handling but I suppose they are implementable.

@delan
Copy link
Author

delan commented Dec 14, 2022

Yeah, it’s more complicated than I would like, but I don’t think there’s an easier way to introduce inheritance while preserving the “innermost” behaviour of backgrounds and (now) decorations.

Would “support” (positive) best represent WebKit’s position overall, despite those drawbacks of inheritance?

@nt1m
Copy link
Member

nt1m commented Aug 15, 2023

We'll add position: support in a week pending objections.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
from: Bloomberg Proposed, edited, or co-edited by Bloomberg. from: Igalia Proposed, edited, or co-edited by Igalia. position: support topic: css Spec relates to CSS (Cascading Style Sheets) venue: W3C CSS WG
Development

No branches or pull requests

6 participants