Changeset 231840 in webkit


Ignore:
Timestamp:
May 16, 2018 1:27:54 AM (6 years ago)
Author:
graouts@webkit.org
Message:

REGRESSION (r230574): Interrupted hardware transitions don't behave correctly
https://bugs.webkit.org/show_bug.cgi?id=185299
<rdar://problem/39630230>

Reviewed by Simon Fraser.

Source/WebCore:

In r230574, the fix for webkit.org/b/184518, we changed the processing order in GraphicsLayerCA::updateAnimations() to first
process m_uncomittedAnimations and then m_animationsToProcess, so we are guaranteed animations exist before we attempt to pause
or seek them. This broke interrupting and resuming hardware animations (such as an interrupted CSS Transition or an animation
running in a non-visible tab) since a pause operation recorded _before_ an animation was added would be paused anyway since
the animation was now first added, and then paused. The fix is simply to clear any pending AnimationProcessingAction for a
newly-uncommitted animation.

Test: transitions/interrupted-transition-hardware.html

  • platform/graphics/ca/GraphicsLayerCA.cpp:

(WebCore::GraphicsLayerCA::createAnimationFromKeyframes):
(WebCore::GraphicsLayerCA::appendToUncommittedAnimations):
(WebCore::GraphicsLayerCA::createTransformAnimationsFromKeyframes):

  • platform/graphics/ca/GraphicsLayerCA.h:

(WebCore::GraphicsLayerCA::LayerPropertyAnimation::LayerPropertyAnimation):

LayoutTests:

Add a new test where we interrupt a transition and check that upon returning to the original value,
an animated value is still used and not the initial value. This test fails prior to this patch.

  • transitions/interrupted-transition-hardware-expected.html: Added.
  • transitions/interrupted-transition-hardware.html: Added.
Location:
trunk
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r231823 r231840  
     12018-05-16  Antoine Quint  <graouts@apple.com>
     2
     3        REGRESSION (r230574): Interrupted hardware transitions don't behave correctly
     4        https://bugs.webkit.org/show_bug.cgi?id=185299
     5        <rdar://problem/39630230>
     6
     7        Reviewed by Simon Fraser.
     8
     9        Add a new test where we interrupt a transition and check that upon returning to the original value,
     10        an animated value is still used and not the initial value. This test fails prior to this patch.
     11
     12        * transitions/interrupted-transition-hardware-expected.html: Added.
     13        * transitions/interrupted-transition-hardware.html: Added.
     14
    1152018-05-15  Commit Queue  <commit-queue@webkit.org>
    216
  • trunk/Source/WebCore/ChangeLog

    r231839 r231840  
     12018-05-16  Antoine Quint  <graouts@apple.com>
     2
     3        REGRESSION (r230574): Interrupted hardware transitions don't behave correctly
     4        https://bugs.webkit.org/show_bug.cgi?id=185299
     5        <rdar://problem/39630230>
     6
     7        Reviewed by Simon Fraser.
     8
     9        In r230574, the fix for webkit.org/b/184518, we changed the processing order in GraphicsLayerCA::updateAnimations() to first
     10        process m_uncomittedAnimations and then m_animationsToProcess, so we are guaranteed animations exist before we attempt to pause
     11        or seek them. This broke interrupting and resuming hardware animations (such as an interrupted CSS Transition or an animation
     12        running in a non-visible tab) since a pause operation recorded _before_ an animation was added would be paused anyway since
     13        the animation was now first added, and then paused. The fix is simply to clear any pending AnimationProcessingAction for a
     14        newly-uncommitted animation.
     15
     16        Test: transitions/interrupted-transition-hardware.html
     17
     18        * platform/graphics/ca/GraphicsLayerCA.cpp:
     19        (WebCore::GraphicsLayerCA::createAnimationFromKeyframes):
     20        (WebCore::GraphicsLayerCA::appendToUncommittedAnimations):
     21        (WebCore::GraphicsLayerCA::createTransformAnimationsFromKeyframes):
     22        * platform/graphics/ca/GraphicsLayerCA.h:
     23        (WebCore::GraphicsLayerCA::LayerPropertyAnimation::LayerPropertyAnimation):
     24
    1252018-05-15  Yusuke Suzuki  <utatane.tea@gmail.com>
    226
  • trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp

    r231823 r231840  
    30163016        return false;
    30173017
    3018     m_uncomittedAnimations.append(LayerPropertyAnimation(caAnimation.releaseNonNull(), animationName, valueList.property(), animationIndex, 0, timeOffset));
     3018    appendToUncommittedAnimations(LayerPropertyAnimation(caAnimation.releaseNonNull(), animationName, valueList.property(), animationIndex, 0, timeOffset));
    30193019
    30203020    return true;
     
    30433043        return false;
    30443044
    3045     m_uncomittedAnimations.append(LayerPropertyAnimation(caAnimation.releaseNonNull(), animationName, valueList.property(), animationIndex, 0, timeOffset));
     3045    appendToUncommittedAnimations(LayerPropertyAnimation(caAnimation.releaseNonNull(), animationName, valueList.property(), animationIndex, 0, timeOffset));
    30463046    return true;
    30473047}
     
    31053105        ASSERT(valuesOK);
    31063106
    3107         m_uncomittedAnimations.append(LayerPropertyAnimation(caAnimation.releaseNonNull(), animationName, valueList.property(), animationIndex, internalFilterPropertyIndex, timeOffset));
     3107        appendToUncommittedAnimations(LayerPropertyAnimation(caAnimation.releaseNonNull(), animationName, valueList.property(), animationIndex, internalFilterPropertyIndex, timeOffset));
    31083108    }
    31093109
    31103110    return true;
     3111}
     3112
     3113void GraphicsLayerCA::appendToUncommittedAnimations(LayerPropertyAnimation&& animation)
     3114{
     3115    // Since we're adding a new animation, make sure we clear any pending AnimationProcessingAction for this animation
     3116    // as these are applied after we've committed new animations.
     3117    m_animationsToProcess.remove(animation.m_name);
     3118
     3119    m_uncomittedAnimations.append(WTFMove(animation));
    31113120}
    31123121
  • trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h

    r231823 r231840  
    460460    }
    461461
     462    // This represents the animation of a single property. There may be multiple transform animations for
     463    // a single transition or keyframe animation, so index is used to distinguish these.
     464    struct LayerPropertyAnimation {
     465        LayerPropertyAnimation(Ref<PlatformCAAnimation>&& caAnimation, const String& animationName, AnimatedPropertyID property, int index, int subIndex, Seconds timeOffset)
     466            : m_animation(WTFMove(caAnimation))
     467            , m_name(animationName)
     468            , m_property(property)
     469            , m_index(index)
     470            , m_subIndex(subIndex)
     471            , m_timeOffset(timeOffset)
     472        { }
     473
     474        RefPtr<PlatformCAAnimation> m_animation;
     475        String m_name;
     476        AnimatedPropertyID m_property;
     477        int m_index;
     478        int m_subIndex;
     479        Seconds m_timeOffset;
     480    };
     481
    462482    bool appendToUncommittedAnimations(const KeyframeValueList&, const TransformOperations*, const Animation*, const String& animationName, const FloatSize& boxSize, int animationIndex, Seconds timeOffset, bool isMatrixAnimation);
    463483    bool appendToUncommittedAnimations(const KeyframeValueList&, const FilterOperation*, const Animation*, const String& animationName, int animationIndex, Seconds timeOffset);
     484    void appendToUncommittedAnimations(LayerPropertyAnimation&&);
    464485
    465486    enum LayerChange : uint64_t {
     
    573594    RetainPtr<CGImageRef> m_pendingContentsImage;
    574595   
    575     // This represents the animation of a single property. There may be multiple transform animations for
    576     // a single transition or keyframe animation, so index is used to distinguish these.
    577     struct LayerPropertyAnimation {
    578         LayerPropertyAnimation(Ref<PlatformCAAnimation>&& caAnimation, const String& animationName, AnimatedPropertyID property, int index, int subIndex, Seconds timeOffset)
    579             : m_animation(WTFMove(caAnimation))
    580             , m_name(animationName)
    581             , m_property(property)
    582             , m_index(index)
    583             , m_subIndex(subIndex)
    584             , m_timeOffset(timeOffset)
    585         { }
    586 
    587         RefPtr<PlatformCAAnimation> m_animation;
    588         String m_name;
    589         AnimatedPropertyID m_property;
    590         int m_index;
    591         int m_subIndex;
    592         Seconds m_timeOffset;
    593     };
    594    
    595596    // Uncommitted transitions and animations.
    596597    Vector<LayerPropertyAnimation> m_uncomittedAnimations;
Note: See TracChangeset for help on using the changeset viewer.