[csswg-drafts] [css-pseudo-4] need for clarification on how ::selection text-shadows work (#3932)

Gankro has just created a new issue for https://github.com/w3c/csswg-drafts:

== [css-pseudo-4] need for clarification on how ::selection text-shadows work ==
* [Relevant Part Of The Spec](https://drafts.csswg.org/css-pseudo-4/#highlight-pseudos)
* [Additional Discussion in Firefox's Issue Tracker](https://bugzilla.mozilla.org/show_bug.cgi?id=1543773#c6)

The spec doesn't seem completely clear on what should happen when there are text-shadows defined by a ::selection pseudo-selector.

I have written a [live demo that demonstrates/discusses how different browsers work here](https://bug1543773.bmoattachments.org/attachment.cgi?id=9064764). But here's a better description:

* **Chrome**: clips ::selection shadows to the highlight, but doesn't disable non-::selection shadows (as if the ::selection was a distinct element, and not a restyling?). More specifically, if a character is a selected, it's ::selection shadows will be drawn clipped to the highlight, but its non-::selection shadows will be drawn clipped-out from the highlight. Notably, shadows of characters that *aren't* selected but still from the same element *aren't* clipped by the highlight.

* **Safari**: seems to be implementing the same logic as chrome, but has extremely buggy clipping/invalidation of the shadows and sometimes ends up drawing shadows outside of the highlight or even when the text isn't selected.

* **Firefox**: clips ::selection shadows to the bounds of the entire text frame. This lets shadows escape the highlight as long as there's text there, but will clip them otherwise. However, the bounds used by firefox for this clipping include the area covered by non-::selection shadows, so non-::selection shadows can expand the area ::selection shadows can escape to. Unlike chrome/safari, firefox completely disables all the non-::selection shadows for the characters that are selected (as if they were being normally overridden by cascading).
  * **Webrender Backend**: Inherits firefox's shadow cascading logic, but doesn't yet clip ::selection shadows any differently from normal ones.


So the questions we have are:

* Should ::selection text-shadows be clipped differently from normal text-shadows? And if so, should they specifically be clipped to the highlight?

* Should ::selection text-shadows cascade and overwrite normal text-shadows, or are selections supposed to act like a new element with a separate text-shadow property? If the latter, should normal shadows be clipped/overwritten by the highlight?

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/3932 using your GitHub account

Received on Tuesday, 14 May 2019 17:11:39 UTC