Bug 212103

Summary: [Web Animations] Animation engine should not wake up every tick for steps timing functions
Product: WebKit Reporter: Antoine Quint <graouts>
Component: AnimationsAssignee: Antoine Quint <graouts>
Status: RESOLVED FIXED    
Severity: Normal CC: benjamin, cdumez, cmarcelo, dino, esprehn+autocc, ews-watchlist, graouts, kondapallykalyan, simon.fraser, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch
none
Patch
none
Patch simon.fraser: review+

Antoine Quint
Reported 2020-05-19 13:03:19 PDT
[Web Animations] Animation engine should not wake up every tick for steps timing functions
Attachments
Patch (18.77 KB, patch)
2020-05-19 13:12 PDT, Antoine Quint
no flags
Patch (22.25 KB, patch)
2020-05-20 03:45 PDT, Antoine Quint
no flags
Patch (24.63 KB, patch)
2020-05-20 03:49 PDT, Antoine Quint
no flags
Patch (27.99 KB, patch)
2020-05-20 06:59 PDT, Antoine Quint
simon.fraser: review+
Antoine Quint
Comment 1 2020-05-19 13:12:08 PDT
Antoine Quint
Comment 2 2020-05-19 13:12:13 PDT
Simon Fraser (smfr)
Comment 3 2020-05-19 13:26:25 PDT
Comment on attachment 399764 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=399764&action=review > Source/WebCore/animation/AnimationEffect.cpp:547 > + if (!is<StepsTimingFunction>(m_timingFunction)) > + return WTF::nullopt; Does this get called for animations whose keyframes all have the same value? Or did we optimize those out earlier? > Source/WebCore/animation/KeyframeEffect.cpp:1825 > + if (intervalEndProgress <= iterationProgress) > + continue; > + > + if (!i) > + break; This is pretty confusing. The !i makes it always break after i=0, but you continue earlier. Easier to grok if it's flipped around somehow.
Antoine Quint
Comment 4 2020-05-19 13:48:00 PDT
(In reply to Simon Fraser (smfr) from comment #3) > Comment on attachment 399764 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=399764&action=review > > > Source/WebCore/animation/AnimationEffect.cpp:547 > > + if (!is<StepsTimingFunction>(m_timingFunction)) > > + return WTF::nullopt; > > Does this get called for animations whose keyframes all have the same value? > Or did we optimize those out earlier? We don’t optimize this case in any way for now. So this would get called for any animation. > > Source/WebCore/animation/KeyframeEffect.cpp:1825 > > + if (intervalEndProgress <= iterationProgress) > > + continue; > > + > > + if (!i) > > + break; > > This is pretty confusing. The !i makes it always break after i=0, but you > continue earlier. Easier to grok if it's flipped around somehow. The order matters here. We just want to be sure that we don’t deal with an implicit 0% keyframe since we wouldn’t have a blending keyframe for that and would otherwise crash trying to access its timing function.
Antoine Quint
Comment 5 2020-05-20 03:45:53 PDT
Antoine Quint
Comment 6 2020-05-20 03:49:03 PDT
Antoine Quint
Comment 7 2020-05-20 06:59:14 PDT
Simon Fraser (smfr)
Comment 8 2020-05-20 08:15:30 PDT
Comment on attachment 399835 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=399835&action=review > Source/WebCore/animation/KeyframeEffect.cpp:1476 > + if (index < 0) > + return nullptr; size_t is unsigned, this can never happen. > Source/WebCore/animation/KeyframeEffect.cpp:1837 > +Optional<double> KeyframeEffect::progressUntilNextStep(double iterationProgress) const "progress until" is a bit ambiguous here. Maybe "progress at next step"?
Antoine Quint
Comment 9 2020-05-20 09:24:31 PDT
(In reply to Simon Fraser (smfr) from comment #8) > Comment on attachment 399835 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=399835&action=review > > > Source/WebCore/animation/KeyframeEffect.cpp:1476 > > + if (index < 0) > > + return nullptr; > > size_t is unsigned, this can never happen. Will remove in commit. > > Source/WebCore/animation/KeyframeEffect.cpp:1837 > > +Optional<double> KeyframeEffect::progressUntilNextStep(double iterationProgress) const > > "progress until" is a bit ambiguous here. Maybe "progress at next step"? "progress at next step" would not be correct, what we want to know is "how much progress until the next step". I think within the context of determining the amount of time before the next step, which is the only scenario in which this method is used, this is clear enough.
Antoine Quint
Comment 10 2020-05-20 09:26:25 PDT
Antoine Quint
Comment 11 2020-05-20 09:29:57 PDT
Antoine Quint
Comment 12 2024-05-21 02:40:10 PDT
*** Bug 45447 has been marked as a duplicate of this bug. ***
Note You need to log in before you can comment on or make changes to this bug.