- From: Ryosuke Niwa <rniwa@apple.com>
- Date: Tue, 10 Nov 2015 18:22:40 -0800
- To: John Daggett <jdaggett@mozilla.com>
- Cc: www-style list <www-style@w3.org>
> On Nov 9, 2015, at 9:43 PM, John Daggett <jdaggett@mozilla.com> wrote: > > Ryosuke Niwa wrote: > > > We would like to make a declaration of @font-face scoped to the shadow > > DOM in which it is defined and have a higher precedence over > > @font-face defined outside the shadow DOM. > > > > While not ideal, we think it's okay to let @font-face defined outside > > the shadow DOM to bleed into the shadow DOM since that is needed to > > support the common scenario of matching the style outside the shadow > > DOM. We can solve this problem in the future by providing a mechanism > > to hide @font-face. > > I don't know what precisely you're proposing here but @font-face rules don't have "precedence", they don't override one another. Ah, I see. Thanks for the clarification. > > Example: > > @font-face { font-family: test; src: url(xxx.woff); } > @font-face { font-family: test; src: url(yyy.woff); } > > <p style="font-family: test">Hello</p> > > This produces a font family for which yyy.woff will be loaded first. After it's loaded, if the font in yyy.woff doesn't cover all glyphs in content, xxx.woff will then be loaded. The second @font-face rule is added to the family. > > So I think you need to define more precisely what you'd like here. Do you want @font-face rules defined in the shadow DOM to be scoped to only affect font usage within the shadow DOM? That's what we're proposing. > Define a separate FontFaceSet that contains the @font-face rules in the DOM along with the ones in the shadow DOM, with ordering in document definition order. That will have no affect on @font-face rules in the DOM other than their load state. Yeah, for FontFaceSet, we would like to expose a separate set in shadow DOM. More precisely, document.fonts as well as fontfaces on FontFaceSetLoadEvent will not contain any fonts loaded inside shadow DOMs. We would then make ShadowRoot implements FontFaceSource, and expose "fonts" on shadowRoot which includes all the fonts loaded outside the shadow DOM as well as ones loaded in the shadow DOM. Furthermore, we propose not to propagate font's load event across the shadow boundary. > > On the other hand, @font-face inside a shadow DOM overriding > > @font-face outside the shadow DOM will break one major feature of > > shadow DOM: style rules in a shadow DOM do not affect nodes outside > > the shadow DOM. In particular, @font-face defined in one shadow DOM > > should not affect fonts used in another shadow DOM. > > Here again, not sure what you mean by "overriding". @font-face rules accumulate, they don't override. And how is any node affected outside the shadow DOM's with whatever you're imagining? What I mean is that @font-face rules inside a shadow DOM should not affect what fonts are used inside another shadow DOM. - R. Niwa
Received on Wednesday, 11 November 2015 02:23:08 UTC