Bug 218532

Summary: Animations of discrete properties should schedule animation frames sparingly
Product: WebKit Reporter: Antoine Quint <graouts>
Component: AnimationsAssignee: Nobody <webkit-unassigned>
Status: NEW ---    
Severity: Normal CC: dino, simon.fraser, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   

Description Antoine Quint 2020-11-03 13:07:58 PST
As part of bug 218530, we're adding support for a new animation wrapper for CSS properties that support discrete animations only: DiscretePropertyWrapper. We should make it so that we don't schedule invalidation for animations of discrete properties at the full refresh rate but only at times when the property value will change.
Comment 1 Radar WebKit Bug Importer 2020-11-03 13:08:26 PST
<rdar://problem/71007801>
Comment 2 Antoine Quint 2020-11-16 10:04:24 PST
This means we'll have to resolve the timing function to predict the amount of time until we reach the mid-way point for the current interval.
Comment 3 Antoine Quint 2020-11-16 11:36:42 PST
First step towards this will be refactoring WebAnimation::timeToNextTick() into a KeyframeEffect method.
Comment 4 Antoine Quint 2024-01-03 06:50:37 PST
Thinking about this some more, this will require quite a bit of work to handle all cases:

1. we need to identify the keyframe range in which we are in
2. then we need to check whether the interpolation between the values in that range will yield a discrete animation, which cannot always be computed ahead of time since this could be affected by the CSS cascade (as would be the case with `inherit` values).
3. then we need to determine the time until this range reaches its midway point if the current progress is less than 0.5, this will involve resolving the relevant easing

However, we could start with dealing with simple cases such as animations that only target discrete properties. But the complete solution definitely requires some non-trivial and potentially expensive work.