RESOLVED FIXED Bug 164608
keyframes do not work when defined inside a style in a shadowRoot
https://bugs.webkit.org/show_bug.cgi?id=164608
Summary keyframes do not work when defined inside a style in a shadowRoot
Keanu Lee
Reported 2016-11-10 12:31:16 PST
@keyframes defined inside shadow roots don't work: http://jsbin.com/yibeca/edit?html,output However, @keyframes defined in the main document work inside shadow roots: http://jsbin.com/pelaqob/edit?html,output
Attachments
patch (40.01 KB, patch)
2016-12-05 07:41 PST, Antti Koivisto
darin: review+
buildbot: commit-queue-
Archive of layout-test-results from ews102 for mac-yosemite (1.14 MB, application/zip)
2016-12-05 10:00 PST, Build Bot
no flags
patch (41.11 KB, patch)
2016-12-05 11:54 PST, Antti Koivisto
no flags
Radar WebKit Bug Importer
Comment 1 2016-11-10 16:42:54 PST
Dean Jackson
Comment 2 2016-11-14 16:06:56 PST
It appears that KeyframeAnimation::resolveKeyframeStyles() calls into Element::styleResolver(), but that gets null for containingShadowRoot() so returns the Document's style resolver. I think the keyframes rule is in the shadow root's style resolver. But I'm not sure if containingShadowRoot should be null here.
Dean Jackson
Comment 3 2016-11-14 16:08:57 PST
The animation is connected to the x-foo element. I don't really understand the shadow tree - which style resolver should that get?
Ryosuke Niwa
Comment 4 2016-11-14 16:44:51 PST
It's a bit tricker than that. If the keyframe is used by a rule inside the shadow tree, then it should see the keyframe rule but the rule outside the shadow tree shouldn't see it.
Antti Koivisto
Comment 5 2016-12-05 07:41:25 PST
Sam Weinig
Comment 6 2016-12-05 08:40:49 PST
Comment on attachment 296138 [details] patch View in context: https://bugs.webkit.org/attachment.cgi?id=296138&action=review > Source/WebCore/ChangeLog:17 > + Test: fast/shadow-dom/shadow-host-animation.html I don't see this test in the patch. Did you forget to add it?
Darin Adler
Comment 7 2016-12-05 09:20:00 PST
Comment on attachment 296138 [details] patch View in context: https://bugs.webkit.org/attachment.cgi?id=296138&action=review > Source/WebCore/page/animation/KeyframeAnimation.cpp:369 > + auto* styleScope = Style::Scope::forOrdinal(element, m_animation->name().scopeOrdinal); > + if (styleScope) > + styleScope->resolver().keyframeStylesForAnimation(*m_object->element(), m_unanimatedStyle.get(), m_keyframes); Could define the variable inside the if. > Source/WebCore/platform/animation/Animation.cpp:167 > -const String& Animation::initialName() > +Style::ScopedName Animation::initialName() > { > static NeverDestroyed<String> initialValue(ASCIILiteral("none")); > - return initialValue; > + return { initialValue.get(), Style::ScopeOrdinal::Element }; > } Could just have this return const Style::ScopedName& instead and have the global be a NeverDestroyed<Style::ScopedName>; would be slightly more efficient.
Build Bot
Comment 8 2016-12-05 10:00:44 PST
Comment on attachment 296138 [details] patch Attachment 296138 [details] did not pass mac-ews (mac): Output: http://webkit-queues.webkit.org/results/2627250 New failing tests: media/modern-media-controls/media-controller/media-controller-resize.html
Build Bot
Comment 9 2016-12-05 10:00:48 PST
Created attachment 296153 [details] Archive of layout-test-results from ews102 for mac-yosemite The attached test failures were seen while running run-webkit-tests on the mac-ews. Bot: ews102 Port: mac-yosemite Platform: Mac OS X 10.10.5
Antti Koivisto
Comment 10 2016-12-05 11:54:27 PST
Created attachment 296168 [details] patch Slightly simplified version.
WebKit Commit Bot
Comment 11 2016-12-05 14:42:54 PST
Comment on attachment 296168 [details] patch Clearing flags on attachment: 296168 Committed r209352: <http://trac.webkit.org/changeset/209352>
WebKit Commit Bot
Comment 12 2016-12-05 14:42:59 PST
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.