Last Comment Bug 830056 - scoped style sheets should allow scoped effects of @font-face and @keyframes
: scoped style sheets should allow scoped effects of @font-face and @keyframes
Status: NEW
:
Product: Core
Classification: Components
Component: CSS Parsing and Computation (show other bugs)
: Trunk
: All All
: -- normal with 6 votes (vote)
: ---
Assigned To: Nobody; OK to take it and work on it
:
Mentors:
Depends on:
Blocks: 1018269
  Show dependency treegraph
 
Reported: 2013-01-12 21:24 PST by Cameron McCormack (:heycam)
Modified: 2015-01-20 18:48 PST (History)
9 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments

Description Cameron McCormack (:heycam) 2013-01-12 21:24:28 PST
The HTML specification states that at-rules with global effects, such as @font-face and @keyframes, should have their effect scoped to the style scope.  Currently we just do not process these at-rules at all within scoped style sheets.
Comment 1 Boris Zbarsky [:bz] 2013-01-13 06:49:43 PST
The HTML specification here is on crack, as far as dbaron and I can tell.  Certainly for @font-face....
Comment 2 David Baron :dbaron: ⌚️UTC-7 (review requests must explain patch) 2013-01-13 09:54:54 PST
Yep; we shouldn't implement this.  (I think we may have even discussed it in the CSS working group and agreed that HTML was wrong here.)
Comment 3 David Baron :dbaron: ⌚️UTC-7 (review requests must explain patch) 2013-01-13 10:01:54 PST
We should probably bring up the issue, though; I though I'd raised it before, but all I can find is https://www.w3.org/Bugs/Public/show_bug.cgi?id=15821
Comment 4 Cameron McCormack (:heycam) 2013-01-13 14:45:35 PST
Why is it that @font-face shouldn't be processed and declare fonts that only get resolved in font-family properties on elements within the scope?  It seems kind of reasonable to me.
Comment 5 Boris Zbarsky [:bz] 2013-01-14 10:17:00 PST
Because font-family inherits, so the value on elements from within the scope can come from outside the scope, and usually does.
Comment 6 Cameron McCormack (:heycam) 2013-01-14 14:40:14 PST
But why is that bad?

Do you think that it's unreasonable for the meaning of a given font family name to change due to it being inherited into the scope?  Would it be OK if scoped style rules set font-family to that same name explicitly and had it resolve to the scoped @font-face?

To me, from an authoring PoV, it's straightforward to think of the font family names inheriting as names, and allowing the resolution of that to an actual font, which happens at the element, to be influenced by the scoped @font-face rule.
Comment 7 Boris Zbarsky [:bz] 2013-01-14 14:50:45 PST
It's unreasonable because font-family names are done on a per-character basis.

So you'd end up in a situation where some characters used downloadable fonts and some did not depending on where in the fallback chain the family names fell and what the scoped style rules were...
Comment 8 David Baron :dbaron: ⌚️UTC-7 (review requests must explain patch) 2013-01-21 06:40:42 PST
I sent http://lists.w3.org/Archives/Public/public-whatwg-archive/2013Jan/0251.html suggesting that the spec be changed to say @font-face and @keyframes should be ignored.
Comment 9 Chris Lord [:cwiiis] 2014-05-31 00:01:53 PDT
I don't know about @font-face, but ignoring @keyframes in scoped style-sheets basically means you can't use CSS animations without keyframes being declared separately in a global style-sheet(?) This seems very unintuitive to me.
Comment 10 Kevin Grandon :kgrandon 2014-06-05 16:24:55 PDT
We lost a few developer hours on this today not realizing that @keyframes did not work. Our use case in gaia is that we have several apps which use the same component. This component defines an animation, and because we don't have keyframes in scoped stylesheets, we have to have each app define the same keyframes as well. It's quite messy, so after using this a bit I would love to have @keyframes if possible.
Comment 11 Cameron McCormack (:heycam) 2014-06-05 18:13:55 PDT
I still don't understand the concern in comment 7.

Regardless, the animation-name property isn't inherited, so you're much less likely to run up against the problem where a @keyframes name you write outside a style scope ends up being used, and re-defined, inside a style scope.

Note You need to log in before you can comment on or make changes to this bug.