Changeset 269963 in webkit


Ignore:
Timestamp:
Nov 18, 2020 9:51:39 AM (20 months ago)
Author:
graouts@webkit.org
Message:

[Web Animations] Ensure we don't schedule animation udpates when there are no styles to update
https://bugs.webkit.org/show_bug.cgi?id=219071

Reviewed by Simon Fraser.

Source/WebCore:

Test: webanimations/scheduling-of-animation-without-keyframes.html

For keyframe effects that don't interpolate any CSS property, run the same logic that we already run
to determine when to schedule the next animation update in the case where we are running accelerated
animations.

  • animation/KeyframeEffect.cpp:

(WebCore::KeyframeEffect::timeToNextTick const):

LayoutTests:

Add a test that creates animations with various empty keyframes parameters to check that we don't
schedule animation update for them.

  • webanimations/scheduling-of-animation-without-keyframes-expected.txt: Added.
  • webanimations/scheduling-of-animation-without-keyframes.html: Added.
Location:
trunk
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r269962 r269963  
     12020-11-18  Antoine Quint  <graouts@webkit.org>
     2
     3        [Web Animations] Ensure we don't schedule animation udpates when there are no styles to update
     4        https://bugs.webkit.org/show_bug.cgi?id=219071
     5
     6        Reviewed by Simon Fraser.
     7
     8        Add a test that creates animations with various empty keyframes parameters to check that we don't
     9        schedule animation update for them.
     10
     11        * webanimations/scheduling-of-animation-without-keyframes-expected.txt: Added.
     12        * webanimations/scheduling-of-animation-without-keyframes.html: Added.
     13
    1142020-11-18  Antoine Quint  <graouts@webkit.org>
    215
  • trunk/Source/WebCore/ChangeLog

    r269962 r269963  
     12020-11-18  Antoine Quint  <graouts@webkit.org>
     2
     3        [Web Animations] Ensure we don't schedule animation udpates when there are no styles to update
     4        https://bugs.webkit.org/show_bug.cgi?id=219071
     5
     6        Reviewed by Simon Fraser.
     7
     8        Test: webanimations/scheduling-of-animation-without-keyframes.html
     9
     10        For keyframe effects that don't interpolate any CSS property, run the same logic that we already run
     11        to determine when to schedule the next animation update in the case where we are running accelerated
     12        animations.
     13
     14        * animation/KeyframeEffect.cpp:
     15        (WebCore::KeyframeEffect::timeToNextTick const):
     16
    1172020-11-18  Antoine Quint  <graouts@webkit.org>
    218
  • trunk/Source/WebCore/animation/KeyframeEffect.cpp

    r269914 r269963  
    19801980        // The effect is in its "before" phase, in this case we can wait until it enters its "active" phase.
    19811981        return delay() - *timing.localTime;
    1982     case AnimationEffectPhase::Active:
    1983         if (isCompletelyAccelerated() && isRunningAccelerated()) {
    1984             // Fully-accelerated running CSS Animations need to trigger "animationiteration" events, in this case we must wait until the next iteration.
     1982    case AnimationEffectPhase::Active: {
     1983        auto doesNotAffectStyles = m_blendingKeyframes.isEmpty() || m_blendingKeyframes.properties().isEmpty();
     1984        auto completelyAcceleratedAndRunning = isCompletelyAccelerated() && isRunningAccelerated();
     1985        if (doesNotAffectStyles || completelyAcceleratedAndRunning) {
     1986            // In the case of fully accelerated running effects and effects that don't actually target any CSS property,
     1987            // we do not have a need to invalidate styles.
    19851988            if (is<CSSAnimation>(animation())) {
     1989                // However, CSS Animations need to trigger "animationiteration" events, in this case we must wait until the next iteration.
    19861990                if (auto iterationProgress = getComputedTiming().simpleIterationProgress)
    19871991                    return iterationDuration() * (1 - *iterationProgress);
    19881992            }
    1989             // Fully-accelerated running effects in the "active" phase can wait until they ended.
     1993            // Other running effects in the "active" phase can wait until they end.
    19901994            return endTime() - *timing.localTime;
    19911995        }
     
    19972001        // Other effects in the "active" phase will need to update their animated value at the immediate next opportunity.
    19982002        return 0_s;
     2003    }
    19992004    case AnimationEffectPhase::After:
    20002005        // The effect is in its after phase, which means it will no longer update its value, so it doens't need a tick.
Note: See TracChangeset for help on using the changeset viewer.