Re: [css-scoping] Scoping @font-face defined in shadow DOM

On 11/10/15 9:44 PM, Ryosuke Niwa wrote:
>
>> On Nov 10, 2015, at 6:28 PM, Boris Zbarsky <bzbarsky@mit.edu> wrote:
>> So just to make sure I understand, if I have this light DOM:
>>
>>   <body>
>>     <x-foo>Some text</x-foo>
>>   </body>
>>
>> and x-foo has a shadow DOM attached that makes the flattened tree look kinda like this:
>>
>>   <body>
>>     <x-foo>
>>       <some-stuff>
>>         Some text
>>       </some-stuff>
>>     </x-foo>
>>   </body>
>>
>> then should @font-face rules from inside that shadow DOM affect "Some text"?
>
> It does if "some-stuff" element is in the shadow DOM.

Even though the textnode is not in the shadow DOM?

>> What if "Some text" were inside a <span> inside the <x-foo>?
>
> By inside <x-foo>, do you mean inside the shadow DOM of the x-foo? (1)
> Or outside the shadow DOM but as an immediate child of the x-foo element? (2)

The latter.

> For (1), yes (@font-face rules inside shadow DOM would affect) since its parent element is in the shadow DOM.
> For (2), no since its parent element is not in the shadow DOM.

This is not making sense to me yet, but maybe we have different 
definitions of "affect"?  I'm talking about the case when "x-foo" has a 
"font-family" rule, nothing else here has any font-family styles (so 
that font-family) value is inherited to everything we're talking about) 
and the shadow DOM has an @font-face for that family name.

So the state attached to a textnode is the font family style and a font 
face set.  Then, per character, you look for glyphs in that font face 
set, right?  It sounds like you're suggesting that conceptually we 
attach font face sets to every _element_, have a textnode use the font 
face set of the element that is its parent in the shadow tree, and have 
the font face set of an element depend on whether it's in a shadow DOM 
or not.  But why the indirection via the parent element instead of 
directly attaching a font face set to every node directly if we want to 
go in that direction?

-Boris

Received on Wednesday, 11 November 2015 07:11:19 UTC