[webkit-changes] [WebKit/WebKit] 9bafc5: [web-animations] determining the interpolation int...

Antoine Quint noreply at github.com
Mon Nov 13 22:25:11 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 9bafc5fbd3e0fe24a0598b7c69102b14c3e1eafd
      https://github.com/WebKit/WebKit/commit/9bafc5fbd3e0fe24a0598b7c69102b14c3e1eafd
  Author: Antoine Quint <graouts at webkit.org>
  Date:   2023-11-13 (Mon, 13 Nov 2023)

  Changed paths:
    M Source/WebCore/Sources.txt
    M Source/WebCore/WebCore.xcodeproj/project.pbxproj
    M Source/WebCore/animation/KeyframeEffect.cpp
    M Source/WebCore/animation/KeyframeEffect.h
    A 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] determining the interpolation interval should be shared in `KeyframeInterpolation`
https://bugs.webkit.org/show_bug.cgi?id=264756

Reviewed by Dean Jackson.

Currently the code to determine the interpolation interval, the "from" and "to" keyframes, is 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), we add a new method on `KeyframeInterpolation`
to determine that interval as well as some new virtual methods to support this purpose:

    virtual const Keyframe& keyframeAtIndex(size_t) const = 0;
    virtual size_t numberOfKeyframes() const = 0;

    struct KeyframeInterval {
        const Vector<const Keyframe*> endpoints;
        bool hasImplicitZeroKeyframe { false };
        bool hasImplicitOneKeyframe { false };
    };

    const KeyframeInterval interpolationKeyframes(Property, double iterationProgress, const Keyframe& defaultStartKeyframe, const Keyframe& defaultEndKeyframe) const;

We also make `AcceleratedEffect` and `KeyframeEffect` inherit from `KeyframeInterpolation` such that we may
refactor out of `KeyframeEffect::setAnimatedPropertiesInStyle()` and into the implementation of
`KeyframeInterpolation::interpolationKeyframes()`.

* Source/WebCore/Sources.txt:
* Source/WebCore/WebCore.xcodeproj/project.pbxproj:
* Source/WebCore/animation/KeyframeEffect.cpp:
(WebCore::KeyframeEffect::setAnimatedPropertiesInStyle):
(WebCore::KeyframeEffect::keyframeAtIndex const):
* Source/WebCore/animation/KeyframeEffect.h:
* Source/WebCore/animation/KeyframeInterpolation.cpp: Added.
(WebCore::KeyframeInterpolation::interpolationKeyframes const):
* Source/WebCore/animation/KeyframeInterpolation.h:
* Source/WebCore/platform/animation/AcceleratedEffect.cpp:
(WebCore::AcceleratedEffect::keyframeAtIndex const):
* Source/WebCore/platform/animation/AcceleratedEffect.h:

Canonical link: https://commits.webkit.org/270692@main




More information about the webkit-changes mailing list