Bug 173027

Summary: Pseudo-elements (::after) in shadow roots don't animate
Product: WebKit Reporter: Keanu Lee <webkit>
Component: CSSAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: dino, graouts, graouts, koivisto, laurent.pellegrino, maarten, rniwa, simon.fraser, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 148695    
Attachments:
Description Flags
Test
none
patch
graouts: review+
patch none

Description Keanu Lee 2017-06-06 12:14:45 PDT
E.g. Inside a shadow root:

<style>
    div::after {
      display: inline-block;
      content: 'boo';
      animation: spin 1s infinite;
    }
</style>

Repo: http://output.jsbin.com/kuwado

Expected: The text should have a rotate animation.

Actual: It does not.
Comment 1 Laurent Pellegrino 2018-01-24 12:27:01 PST
The issue is still present in Safari 11.0.2. Any updates?
Comment 2 Radar WebKit Bug Importer 2018-08-01 22:41:01 PDT
<rdar://problem/42842994>
Comment 3 Antoine Quint 2018-08-14 08:04:21 PDT
I tried and this test fails with the new animation code path as well as the old one. The test works fine in Chrome Canary and Firefox Nightly.
Comment 4 Antoine Quint 2020-05-27 06:22:30 PDT
We fail to start the animation under AnimationTimeline::updateCSSAnimationsForElement() because shouldConsiderAnimation() returns false in this statement:

    if (auto* styleScope = Style::Scope::forOrdinal(element, animation.nameStyleScopeOrdinal()))
        return styleScope->resolver().isAnimationNameValid(name);

Indeed, m_keyframesRuleMap is empty and so we cannot validate the animation name.
Comment 5 Antoine Quint 2020-05-27 06:24:33 PDT
Style::Resolver::addKeyframeStyle() is called but not on the same style resolver used in shouldConsiderAnimation().
Comment 6 Antoine Quint 2020-05-27 06:33:28 PDT
Created attachment 400329 [details]
Test
Comment 7 Antti Koivisto 2020-06-08 05:57:06 PDT
Created attachment 401327 [details]
patch
Comment 8 Antoine Quint 2020-06-08 06:02:14 PDT
Comment on attachment 401327 [details]
patch

View in context: https://bugs.webkit.org/attachment.cgi?id=401327&action=review

> Source/WebCore/ChangeLog:15
> +        The keyfram code that computes the style already does this correctly.

Typo: keyfram.
Comment 9 Antti Koivisto 2020-06-08 06:41:53 PDT
Created attachment 401329 [details]
patch
Comment 10 EWS 2020-06-08 07:24:19 PDT
Committed r262711: <https://trac.webkit.org/changeset/262711>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 401329 [details].