| Differences between
and this patch
- a/Source/WebCore/ChangeLog +25 lines
Lines 1-3 a/Source/WebCore/ChangeLog_sec1
1
2018-05-04  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 NOBODY (OOPS!).
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
        No new tests since there is no existing mechanism that allows to test this behavior since this is about the internal state of
17
        an animation performed by Core Animation.
18
19
        * platform/graphics/ca/GraphicsLayerCA.cpp:
20
        (WebCore::GraphicsLayerCA::createAnimationFromKeyframes):
21
        (WebCore::GraphicsLayerCA::appendToUncommittedAnimations):
22
        (WebCore::GraphicsLayerCA::createTransformAnimationsFromKeyframes):
23
        * platform/graphics/ca/GraphicsLayerCA.h:
24
        (WebCore::GraphicsLayerCA::LayerPropertyAnimation::LayerPropertyAnimation):
25
1
2018-05-01  Yusuke Suzuki  <utatane.tea@gmail.com>
26
2018-05-01  Yusuke Suzuki  <utatane.tea@gmail.com>
2
27
3
        Use default std::optional if it is provided
28
        Use default std::optional if it is provided
- a/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp -3 / +12 lines
Lines 3015-3021 bool GraphicsLayerCA::createAnimationFromKeyframes(const KeyframeValueList& valu a/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp_sec1
3015
    if (!valuesOK)
3015
    if (!valuesOK)
3016
        return false;
3016
        return false;
3017
3017
3018
    m_uncomittedAnimations.append(LayerPropertyAnimation(caAnimation.releaseNonNull(), animationName, valueList.property(), animationIndex, 0, timeOffset));
3018
    appendToUncommittedAnimations(LayerPropertyAnimation(caAnimation.releaseNonNull(), animationName, valueList.property(), animationIndex, 0, timeOffset));
3019
3019
3020
    return true;
3020
    return true;
3021
}
3021
}
Lines 3042-3048 bool GraphicsLayerCA::appendToUncommittedAnimations(const KeyframeValueList& val a/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp_sec2
3042
    if (!validMatrices)
3042
    if (!validMatrices)
3043
        return false;
3043
        return false;
3044
3044
3045
    m_uncomittedAnimations.append(LayerPropertyAnimation(caAnimation.releaseNonNull(), animationName, valueList.property(), animationIndex, 0, timeOffset));
3045
    appendToUncommittedAnimations(LayerPropertyAnimation(caAnimation.releaseNonNull(), animationName, valueList.property(), animationIndex, 0, timeOffset));
3046
    return true;
3046
    return true;
3047
}
3047
}
3048
3048
Lines 3104-3115 bool GraphicsLayerCA::appendToUncommittedAnimations(const KeyframeValueList& val a/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp_sec3
3104
        
3104
        
3105
        ASSERT(valuesOK);
3105
        ASSERT(valuesOK);
3106
3106
3107
        m_uncomittedAnimations.append(LayerPropertyAnimation(caAnimation.releaseNonNull(), animationName, valueList.property(), animationIndex, internalFilterPropertyIndex, timeOffset));
3107
        appendToUncommittedAnimations(LayerPropertyAnimation(caAnimation.releaseNonNull(), animationName, valueList.property(), animationIndex, internalFilterPropertyIndex, timeOffset));
3108
    }
3108
    }
3109
3109
3110
    return true;
3110
    return true;
3111
}
3111
}
3112
3112
3113
void 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));
3120
}
3121
3113
bool GraphicsLayerCA::createFilterAnimationsFromKeyframes(const KeyframeValueList& valueList, const Animation* animation, const String& animationName, Seconds timeOffset)
3122
bool GraphicsLayerCA::createFilterAnimationsFromKeyframes(const KeyframeValueList& valueList, const Animation* animation, const String& animationName, Seconds timeOffset)
3114
{
3123
{
3115
#if ENABLE(FILTERS_LEVEL_2)
3124
#if ENABLE(FILTERS_LEVEL_2)
- a/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h -20 / +21 lines
Lines 459-466 private: a/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h_sec1
459
        moveOrCopyAnimations(Copy, fromLayer, toLayer);
459
        moveOrCopyAnimations(Copy, fromLayer, toLayer);
460
    }
460
    }
461
461
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
462
    bool appendToUncommittedAnimations(const KeyframeValueList&, const TransformOperations*, const Animation*, const String& animationName, const FloatSize& boxSize, int animationIndex, Seconds timeOffset, bool isMatrixAnimation);
482
    bool appendToUncommittedAnimations(const KeyframeValueList&, const TransformOperations*, const Animation*, const String& animationName, const FloatSize& boxSize, int animationIndex, Seconds timeOffset, bool isMatrixAnimation);
463
    bool appendToUncommittedAnimations(const KeyframeValueList&, const FilterOperation*, const Animation*, const String& animationName, int animationIndex, Seconds timeOffset);
483
    bool appendToUncommittedAnimations(const KeyframeValueList&, const FilterOperation*, const Animation*, const String& animationName, int animationIndex, Seconds timeOffset);
484
    void appendToUncommittedAnimations(LayerPropertyAnimation&&);
464
485
465
    enum LayerChange : uint64_t {
486
    enum LayerChange : uint64_t {
466
        NoChange                                = 0,
487
        NoChange                                = 0,
Lines 572-597 private: a/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h_sec2
572
    RetainPtr<CGImageRef> m_uncorrectedContentsImage;
593
    RetainPtr<CGImageRef> m_uncorrectedContentsImage;
573
    RetainPtr<CGImageRef> m_pendingContentsImage;
594
    RetainPtr<CGImageRef> m_pendingContentsImage;
574
    
595
    
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
    
595
    // Uncommitted transitions and animations.
596
    // Uncommitted transitions and animations.
596
    Vector<LayerPropertyAnimation> m_uncomittedAnimations;
597
    Vector<LayerPropertyAnimation> m_uncomittedAnimations;
597
    
598
    

Return to Bug 185299