Branch: refs/heads/main Home: https://github.com/WebKit/WebKit Commit: 5dfffd1d9c0cdf683b9302cd72303bf9e6700921 https://github.com/WebKit/WebKit/commit/5dfffd1d9c0cdf683b9302cd72303bf9e6700921 Author: Antoine Quint <grao...@webkit.org> Date: 2023-11-14 (Tue, 14 Nov 2023)
Changed paths: M Source/WebCore/animation/KeyframeEffect.cpp M Source/WebCore/animation/KeyframeEffect.h M Source/WebCore/animation/KeyframeInterpolation.cpp M Source/WebCore/animation/KeyframeInterpolation.h M Source/WebCore/platform/animation/AcceleratedEffect.cpp M Source/WebCore/platform/animation/AcceleratedEffect.h Log Message: ----------- [web-animations] interpolating keyframes should be shared in `KeyframeInterpolation` https://bugs.webkit.org/show_bug.cgi?id=264796 Reviewed by Dean Jackson. Until now, the code to interpolate keyframes was contained within `KeyframeEffect::setAnimatedPropertiesInStyle()`. As part of the work on threaded animation resolution (see bug 250970), we will need to share this logic with `AcceleratedEffect` as well. Now that we have a shared concept of a keyframe (see bug 264747) and shared code to determine the interpolation interval (see bug 264756), we add a method to `KeyframeInterpolation` for the purpose of interpolation and whatever virtual methods are required to support it. During interpolation, we need additional information from the `KeyframeInterpolation` subclasses such that we can determine what composite operation to use and how to apply it, as well as the timing function to use to compute the final interpolation progress: CompositeOperation compositeOperation() const; bool isPropertyAdditiveOrCumulative(Property) const; IterationCompositeOperation iterationCompositeOperation() const; const TimingFunction* timingFunctionForKeyframe(const Keyframe&) const; With that information, we can add a new `interpolateKeyframes()` method which will take several callbacks as parameters to let the `KeyframeInterpolation` subclass perform the actual interpolation based on the value types it manipulates (`RenderStyle` objects for `KeyframeEffect` and `AcceleratedEffectValues` for `AcceleratedEffect`): using CompositionCallback = Function<void(const Keyframe&, CompositeOperation)>; using AccumulationCallback = Function<void(const Keyframe&)>; using InterpolationCallback = Function<void(double intervalProgress, double currentIteration, IterationCompositeOperation)>; using RequiresBlendingForAccumulativeIterationCallback = Function<bool()>; void interpolateKeyframes(Property, const KeyframeInterval&, double iterationProgress, double currentIteration, Seconds iterationDuration, const CompositionCallback&, const AccumulationCallback&, const InterpolationCallback&, const RequiresBlendingForAccumulativeIterationCallback&) const; Finally, we move much of the remaining code from `KeyframeEffect::setAnimatedPropertiesInStyle` into the new `KeyframeInterpolation::interpolateKeyframes()` method. * Source/WebCore/animation/KeyframeEffect.cpp: (WebCore::KeyframeEffect::setAnimatedPropertiesInStyle): (WebCore::KeyframeEffect::timingFunctionForBlendingKeyframe const): (WebCore::KeyframeEffect::timingFunctionForKeyframeAtIndex const): (WebCore::KeyframeEffect::progressUntilNextStep const): (WebCore::KeyframeEffect::timingFunctionForKeyframe const): (WebCore::KeyframeEffect::isPropertyAdditiveOrCumulative const): * Source/WebCore/animation/KeyframeEffect.h: * Source/WebCore/animation/KeyframeInterpolation.cpp: (WebCore::KeyframeInterpolation::interpolateKeyframes const): * Source/WebCore/animation/KeyframeInterpolation.h: (WebCore::KeyframeInterpolation::iterationCompositeOperation const): * Source/WebCore/platform/animation/AcceleratedEffect.cpp: (WebCore::cssPropertyFromAcceleratedProperty): (WebCore::AcceleratedEffect::timingFunctionForKeyframe const): (WebCore::AcceleratedEffect::isPropertyAdditiveOrCumulative const): * Source/WebCore/platform/animation/AcceleratedEffect.h: (WebCore::AcceleratedEffect::compositeOperation const): Deleted. Canonical link: https://commits.webkit.org/270700@main _______________________________________________ webkit-changes mailing list webkit-changes@lists.webkit.org https://lists.webkit.org/mailman/listinfo/webkit-changes