Bug 235028

Summary: [Web Animations] getKeyframes() for a CSS Animation should not use computed style for keyframes (part 2)
Product: WebKit Reporter: Antoine Quint <graouts>
Component: AnimationsAssignee: Antoine Quint <graouts>
Status: RESOLVED FIXED    
Severity: Normal CC: dino, graouts, koivisto, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
See Also: https://bugs.webkit.org/show_bug.cgi?id=235008
Bug Depends on:    
Bug Blocks: 235138    
Attachments:
Description Flags
Patch koivisto: review+, ews-feeder: commit-queue-

Description Antoine Quint 2022-01-10 04:59:14 PST
getKeyframes() should not use the computed value for animated properties
Comment 1 Antoine Quint 2022-01-10 05:04:18 PST
Created attachment 448734 [details]
Patch
Comment 2 Antti Koivisto 2022-01-10 06:00:02 PST
Comment on attachment 448734 [details]
Patch

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

> Source/WebCore/animation/KeyframeEffect.cpp:674
> +                if (m_pseudoId == PseudoId::None)
> +                    return styleResolver.styleRulesForElement(target, Style::Resolver::AllCSSRules);
> +                return styleResolver.pseudoStyleRulesForElement(target, m_pseudoId, Style::Resolver::AllCSSRules);

You can just call pseudoStyleRulesForElement with PseudoId::None.

Note that this does style resolution. I suppose it doesn't matter here that this is slow?
Comment 3 Antoine Quint 2022-01-10 07:05:37 PST
(In reply to Antti Koivisto from comment #2)
> Comment on attachment 448734 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=448734&action=review
> 
> > Source/WebCore/animation/KeyframeEffect.cpp:674
> > +                if (m_pseudoId == PseudoId::None)
> > +                    return styleResolver.styleRulesForElement(target, Style::Resolver::AllCSSRules);
> > +                return styleResolver.pseudoStyleRulesForElement(target, m_pseudoId, Style::Resolver::AllCSSRules);
> 
> You can just call pseudoStyleRulesForElement with PseudoId::None.

Cool! I'll change that.

> Note that this does style resolution. I suppose it doesn't matter here that
> this is slow?

Not a concern at all.

Would you have some tips to obtain a CSSValue with substituted variables? That's the last piece of this puzzle.
Comment 4 Antoine Quint 2022-01-10 07:09:26 PST
Committed r287835 (245887@trunk): <https://commits.webkit.org/245887@trunk>
Comment 5 Radar WebKit Bug Importer 2022-01-10 07:10:23 PST
<rdar://problem/87338875>