- From: Sebastian Zartner <sebastianzartner@gmail.com>
- Date: Tue, 13 Jan 2015 13:20:46 +0100
- To: "Tab Atkins Jr." <jackalmage@gmail.com>
- Cc: Rune Lillesveen <rune@opera.com>, fantasai <fantasai.lists@inkedblade.net>, "www-style@w3.org" <www-style@w3.org>
On 12 January 2015 at 20:48, Tab Atkins Jr. <jackalmage@gmail.com> wrote: > > On Wed, Jan 7, 2015 at 4:57 AM, Rune Lillesveen <rune@opera.com> wrote: > > On Wed, Jan 7, 2015 at 1:31 AM, fantasai <fantasai.lists@inkedblade.net> wrote: > >> Testcase: > >> data:text/html;charset=utf-8,<!DOCTYPE > >> html>%0D%0A<style>%0D%0Ap%3A%3Aselection { background%3A > >> rgba(0%2C255%2C0%2C0.5)%3B }%0D%0A<%2Fstyle>%0D%0A<p>Test me <em>and > >> me<%2Fem>.<%2Fp> > >> > >> Given > >> > >> p::selection { background: <color> } > >> > >> and > >> > >> <p>Some <em>text</em>.</p> > >> > >> I would expect (from an authoring perspective) that, in the absence > >> of rules to the contrary, <em> gets the same highlight styles as <p>. > >> However, only Presto does this. Gecko, Trident, and Blink style the > >> <em>'s highlight using the system default colors. > >> (This probably relates to how Presto handles inheritance.) > > > > In Presto, we implemented ::selection color/background-color as > > synthesized properties that cascaded/inherited independently of > > color/background-color. So, > > > > p::selection { background-color: pink } > > > > was represented internally as > > > > p { selection-background-color: pink } > > > > I assume selection-background-color had inherited:yes (as opposed to > > background-color). > > Ah, that's a fascinating way to handle it, and seems like it would be > pretty effective. It cuts out a lot of the confusion about how things > inherit, I think. > > It does involve some weirdness, like the fact that in the rule > "p::selection, div { background-color: pink; }", this sets the > 'background-color' for div, but the 'selection-background-color' for > p::selection. But maybe that's not too horrible. It looks like this could also be solved by explicitly defining the inheritance for ::selection pseudo-elements. Sebastian
Received on Tuesday, 13 January 2015 12:21:33 UTC