Changeset 165977 in webkit


Ignore:
Timestamp:
Mar 20, 2014, 11:32:13 AM (12 years ago)
Author:
Simon Fraser
Message:

A completed fill-forwards animation should not disable overlap testing
https://bugs.webkit.org/show_bug.cgi?id=130522
<rdar://problem/15862395>

Source/WebCore:

Reviewed by Dean Jackson.

Previously, if -webkit-transform was being keyframe-animated, and the
animation had fill-forwards, then we would continue to think that the
animation is running and turn off compositing overlap testing. This
caused some sites to keep too much backing store around.

Fix by having isRunning{Accelerated}AnimationOnRenderer take some flags
so that more specific questions about the running state can be asked.
For layer creation, keep using the same criteria as before (for now)
which includes paused and fill-forwards animations. For overlap testing,
don't include the fill-forwards test.

Tests: compositing/animation/filling-animation-overlap-at-end.html

compositing/animation/filling-animation-overlap.html
compositing/animation/layer-for-filling-animation.html

  • page/animation/AnimationBase.h:

(WebCore::AnimationBase::fillingForwards):
(WebCore::AnimationBase::inPausedState):
(WebCore::AnimationBase::isAnimatingProperty):

  • page/animation/AnimationController.cpp:

(WebCore::AnimationControllerPrivate::isRunningAnimationOnRenderer):
(WebCore::AnimationControllerPrivate::isRunningAcceleratedAnimationOnRenderer):
(WebCore::AnimationController::isRunningAnimationOnRenderer):
(WebCore::AnimationController::isRunningAcceleratedAnimationOnRenderer):

  • page/animation/AnimationController.h:
  • page/animation/AnimationControllerPrivate.h:
  • page/animation/CompositeAnimation.cpp:

(WebCore::CompositeAnimation::isAnimatingProperty):

  • page/animation/CompositeAnimation.h:
  • rendering/RenderLayerBacking.cpp:

(WebCore::RenderLayerBacking::updateGraphicsLayerGeometry):

  • rendering/RenderLayerCompositor.cpp:

(WebCore::RenderLayerCompositor::requiresCompositingForAnimation):
(WebCore::RenderLayerCompositor::isRunningAcceleratedTransformAnimation):

LayoutTests:

Reviewed by Dean Jackson.

Tests that dump layer trees when a fill-forwards animation has finished,
both when the final keyframe causes overlap, and when it does not.

  • compositing/animation/filling-animation-overlap-at-end-expected.txt: Added.
  • compositing/animation/filling-animation-overlap-at-end.html: Added.
  • compositing/animation/filling-animation-overlap-expected.txt: Added.
  • compositing/animation/filling-animation-overlap.html: Added.
  • compositing/animation/layer-for-filling-animation-expected.txt: Added.
  • compositing/animation/layer-for-filling-animation.html: Added.
Location:
trunk
Files:
6 added
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r165976 r165977  
     12014-03-20  Simon Fraser  <simon.fraser@apple.com>
     2
     3        A completed fill-forwards animation should not disable overlap testing
     4        https://bugs.webkit.org/show_bug.cgi?id=130522
     5        <rdar://problem/15862395>
     6
     7        Reviewed by Dean Jackson.
     8       
     9        Tests that dump layer trees when a fill-forwards animation has finished,
     10        both when the final keyframe causes overlap, and when it does not.
     11
     12        * compositing/animation/filling-animation-overlap-at-end-expected.txt: Added.
     13        * compositing/animation/filling-animation-overlap-at-end.html: Added.
     14        * compositing/animation/filling-animation-overlap-expected.txt: Added.
     15        * compositing/animation/filling-animation-overlap.html: Added.
     16        * compositing/animation/layer-for-filling-animation-expected.txt: Added.
     17        * compositing/animation/layer-for-filling-animation.html: Added.
     18
    1192014-03-20  Dirk Schulze  <krit@webkit.org>
    220
  • trunk/Source/WebCore/ChangeLog

    r165976 r165977  
     12014-03-20  Simon Fraser  <simon.fraser@apple.com>
     2
     3        A completed fill-forwards animation should not disable overlap testing
     4        https://bugs.webkit.org/show_bug.cgi?id=130522
     5        <rdar://problem/15862395>
     6
     7        Reviewed by Dean Jackson.
     8       
     9        Previously, if -webkit-transform was being keyframe-animated, and the
     10        animation had fill-forwards, then we would continue to think that the
     11        animation is running and turn off compositing overlap testing. This
     12        caused some sites to keep too much backing store around.
     13       
     14        Fix by having isRunning{Accelerated}AnimationOnRenderer take some flags
     15        so that more specific questions about the running state can be asked.
     16        For layer creation, keep using the same criteria as before (for now)
     17        which includes paused and fill-forwards animations. For overlap testing,
     18        don't include the fill-forwards test.
     19
     20        Tests: compositing/animation/filling-animation-overlap-at-end.html
     21               compositing/animation/filling-animation-overlap.html
     22               compositing/animation/layer-for-filling-animation.html
     23
     24        * page/animation/AnimationBase.h:
     25        (WebCore::AnimationBase::fillingForwards):
     26        (WebCore::AnimationBase::inPausedState):
     27        (WebCore::AnimationBase::isAnimatingProperty):
     28        * page/animation/AnimationController.cpp:
     29        (WebCore::AnimationControllerPrivate::isRunningAnimationOnRenderer):
     30        (WebCore::AnimationControllerPrivate::isRunningAcceleratedAnimationOnRenderer):
     31        (WebCore::AnimationController::isRunningAnimationOnRenderer):
     32        (WebCore::AnimationController::isRunningAcceleratedAnimationOnRenderer):
     33        * page/animation/AnimationController.h:
     34        * page/animation/AnimationControllerPrivate.h:
     35        * page/animation/CompositeAnimation.cpp:
     36        (WebCore::CompositeAnimation::isAnimatingProperty):
     37        * page/animation/CompositeAnimation.h:
     38        * rendering/RenderLayerBacking.cpp:
     39        (WebCore::RenderLayerBacking::updateGraphicsLayerGeometry):
     40        * rendering/RenderLayerCompositor.cpp:
     41        (WebCore::RenderLayerCompositor::requiresCompositingForAnimation):
     42        (WebCore::RenderLayerCompositor::isRunningAcceleratedTransformAnimation):
     43
    1442014-03-20  Dirk Schulze  <krit@webkit.org>
    245
  • trunk/Source/WebCore/page/animation/AnimationBase.h

    r165676 r165977  
    123123
    124124    bool postActive() const { return m_animState == AnimationStateDone; }
     125    bool fillingForwards() const { return m_animState == AnimationStateFillingForwards; }
    125126    bool active() const { return !postActive() && !preActive(); }
    126127    bool running() const { return !isNew() && !postActive(); }
    127128    bool paused() const { return m_pauseTime >= 0 || m_animState == AnimationStatePausedNew; }
     129    bool inPausedState() const { return m_animState >= AnimationStatePausedNew && m_animState <= AnimationStatePausedRun; }
    128130    bool isNew() const { return m_animState == AnimationStateNew || m_animState == AnimationStatePausedNew; }
    129131    bool waitingForStartTime() const { return m_animState == AnimationStateStartWaitResponse; }
     
    154156    virtual bool affectsProperty(CSSPropertyID /*property*/) const { return false; }
    155157
    156     bool isAnimatingProperty(CSSPropertyID property, bool acceleratedOnly, bool isRunningNow) const
     158    enum RunningStates {
     159        Delaying = 1 << 0,
     160        Paused = 1 << 1,
     161        Running = 1 << 2,
     162        FillingFowards = 1 << 3
     163    };
     164    typedef unsigned RunningState;
     165    bool isAnimatingProperty(CSSPropertyID property, bool acceleratedOnly, RunningState runningState) const
    157166    {
    158167        if (acceleratedOnly && !m_isAccelerated)
    159168            return false;
    160            
    161         if (isRunningNow)
    162             return (!waitingToStart() && !postActive()) && affectsProperty(property);
    163 
    164         return !postActive() && affectsProperty(property);
     169
     170        if (!affectsProperty(property))
     171            return false;
     172
     173        if ((runningState & Delaying) && preActive())
     174            return true;
     175
     176        if ((runningState & Paused) && inPausedState())
     177            return true;
     178
     179        if ((runningState & Running) && !inPausedState() && (m_animState >= AnimationStateStartWaitStyleAvailable && m_animState <= AnimationStateDone))
     180            return true;
     181
     182        if ((runningState & FillingFowards) && m_animState == AnimationStateFillingForwards)
     183            return true;
     184
     185        return false;
    165186    }
    166187
  • trunk/Source/WebCore/page/animation/AnimationController.cpp

    r165676 r165977  
    237237}
    238238
    239 bool AnimationControllerPrivate::isRunningAnimationOnRenderer(RenderElement* renderer, CSSPropertyID property, bool isRunningNow) const
     239bool AnimationControllerPrivate::isRunningAnimationOnRenderer(RenderElement* renderer, CSSPropertyID property, AnimationBase::RunningState runningState) const
    240240{
    241241    const CompositeAnimation* animation = m_compositeAnimations.get(renderer);
    242     return animation && animation->isAnimatingProperty(property, false, isRunningNow);
    243 }
    244 
    245 bool AnimationControllerPrivate::isRunningAcceleratedAnimationOnRenderer(RenderElement* renderer, CSSPropertyID property, bool isRunningNow) const
     242    return animation && animation->isAnimatingProperty(property, false, runningState);
     243}
     244
     245bool AnimationControllerPrivate::isRunningAcceleratedAnimationOnRenderer(RenderElement* renderer, CSSPropertyID property, AnimationBase::RunningState runningState) const
    246246{
    247247    const CompositeAnimation* animation = m_compositeAnimations.get(renderer);
    248     return animation && animation->isAnimatingProperty(property, true, isRunningNow);
     248    return animation && animation->isAnimatingProperty(property, true, runningState);
    249249}
    250250
     
    556556}
    557557
    558 bool AnimationController::isRunningAnimationOnRenderer(RenderElement* renderer, CSSPropertyID property, bool isRunningNow) const
    559 {
    560     return m_data->isRunningAnimationOnRenderer(renderer, property, isRunningNow);
    561 }
    562 
    563 bool AnimationController::isRunningAcceleratedAnimationOnRenderer(RenderElement* renderer, CSSPropertyID property, bool isRunningNow) const
    564 {
    565     return m_data->isRunningAcceleratedAnimationOnRenderer(renderer, property, isRunningNow);
     558bool AnimationController::isRunningAnimationOnRenderer(RenderElement* renderer, CSSPropertyID property, AnimationBase::RunningState runningState) const
     559{
     560    return m_data->isRunningAnimationOnRenderer(renderer, property, runningState);
     561}
     562
     563bool AnimationController::isRunningAcceleratedAnimationOnRenderer(RenderElement* renderer, CSSPropertyID property, AnimationBase::RunningState runningState) const
     564{
     565    return m_data->isRunningAcceleratedAnimationOnRenderer(renderer, property, runningState);
    566566}
    567567
  • trunk/Source/WebCore/page/animation/AnimationController.h

    r165676 r165977  
    3030#define AnimationController_h
    3131
     32#include "AnimationBase.h"
    3233#include "CSSPropertyNames.h"
    3334#include <wtf/Forward.h>
     
    3637namespace WebCore {
    3738
    38 class AnimationBase;
    3939class AnimationControllerPrivate;
    4040class Document;
     
    6060    unsigned numberOfActiveAnimations(Document*) const; // To be used only for testing
    6161   
    62     bool isRunningAnimationOnRenderer(RenderElement*, CSSPropertyID, bool isRunningNow = true) const;
    63     bool isRunningAcceleratedAnimationOnRenderer(RenderElement*, CSSPropertyID, bool isRunningNow = true) const;
     62    bool isRunningAnimationOnRenderer(RenderElement*, CSSPropertyID, AnimationBase::RunningState) const;
     63    bool isRunningAcceleratedAnimationOnRenderer(RenderElement*, CSSPropertyID, AnimationBase::RunningState) const;
    6464
    6565    bool isSuspended() const;
  • trunk/Source/WebCore/page/animation/AnimationControllerPrivate.h

    r165676 r165977  
    3030#define AnimationControllerPrivate_h
    3131
     32#include "AnimationBase.h"
    3233#include "CSSPropertyNames.h"
    3334#include "Timer.h"
     
    8687    void startAnimationsIfNotSuspended(Document*);
    8788
    88     bool isRunningAnimationOnRenderer(RenderElement*, CSSPropertyID, bool isRunningNow) const;
    89     bool isRunningAcceleratedAnimationOnRenderer(RenderElement*, CSSPropertyID, bool isRunningNow) const;
     89    bool isRunningAnimationOnRenderer(RenderElement*, CSSPropertyID, AnimationBase::RunningState) const;
     90    bool isRunningAcceleratedAnimationOnRenderer(RenderElement*, CSSPropertyID, AnimationBase::RunningState) const;
    9091
    9192    bool pauseAnimationAtTime(RenderElement*, const AtomicString& name, double t);
  • trunk/Source/WebCore/page/animation/CompositeAnimation.cpp

    r165676 r165977  
    474474}
    475475
    476 bool CompositeAnimation::isAnimatingProperty(CSSPropertyID property, bool acceleratedOnly, bool isRunningNow) const
     476bool CompositeAnimation::isAnimatingProperty(CSSPropertyID property, bool acceleratedOnly, AnimationBase::RunningState runningState) const
    477477{
    478478    if (!m_keyframeAnimations.isEmpty()) {
     
    481481        for (AnimationNameMap::const_iterator it = m_keyframeAnimations.begin(); it != animationsEnd; ++it) {
    482482            KeyframeAnimation* anim = it->value.get();
    483             if (anim && anim->isAnimatingProperty(property, acceleratedOnly, isRunningNow))
     483            if (anim && anim->isAnimatingProperty(property, acceleratedOnly, runningState))
    484484                return true;
    485485        }
     
    490490        for (CSSPropertyTransitionsMap::const_iterator it = m_transitions.begin(); it != transitionsEnd; ++it) {
    491491            ImplicitAnimation* anim = it->value.get();
    492             if (anim && anim->isAnimatingProperty(property, acceleratedOnly, isRunningNow))
     492            if (anim && anim->isAnimatingProperty(property, acceleratedOnly, runningState))
    493493                return true;
    494494        }
  • trunk/Source/WebCore/page/animation/CompositeAnimation.h

    r165676 r165977  
    6969    bool hasAnimations() const  { return !m_transitions.isEmpty() || !m_keyframeAnimations.isEmpty(); }
    7070
    71     bool isAnimatingProperty(CSSPropertyID, bool acceleratedOnly, bool isRunningNow) const;
     71    bool isAnimatingProperty(CSSPropertyID, bool acceleratedOnly, AnimationBase::RunningState) const;
    7272
    7373    PassRefPtr<KeyframeAnimation> getAnimationForProperty(CSSPropertyID) const;
  • trunk/Source/WebCore/rendering/RenderLayerBacking.cpp

    r165963 r165977  
    671671    // Set transform property, if it is not animating. We have to do this here because the transform
    672672    // is affected by the layer dimensions.
    673     if (!renderer().animation().isRunningAcceleratedAnimationOnRenderer(&renderer(), CSSPropertyWebkitTransform))
     673    if (!renderer().animation().isRunningAcceleratedAnimationOnRenderer(&renderer(), CSSPropertyWebkitTransform, AnimationBase::Running | AnimationBase::Paused | AnimationBase::FillingFowards))
    674674        updateTransform(&renderer().style());
    675675
    676676    // Set opacity, if it is not animating.
    677     if (!renderer().animation().isRunningAcceleratedAnimationOnRenderer(&renderer(), CSSPropertyOpacity))
     677    if (!renderer().animation().isRunningAcceleratedAnimationOnRenderer(&renderer(), CSSPropertyOpacity, AnimationBase::Running | AnimationBase::Paused | AnimationBase::FillingFowards))
    678678        updateOpacity(&renderer().style());
    679679       
  • trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp

    r165970 r165977  
    23692369        return false;
    23702370
     2371    const AnimationBase::RunningState activeAnimationState = AnimationBase::Running | AnimationBase::Paused | AnimationBase::FillingFowards;
    23712372    AnimationController& animController = renderer.animation();
    2372     return (animController.isRunningAnimationOnRenderer(&renderer, CSSPropertyOpacity)
     2373    return (animController.isRunningAnimationOnRenderer(&renderer, CSSPropertyOpacity, activeAnimationState)
    23732374            && (inCompositingMode() || (m_compositingTriggers & ChromeClient::AnimatedOpacityTrigger)))
    23742375#if ENABLE(CSS_FILTERS)
    2375             || animController.isRunningAnimationOnRenderer(&renderer, CSSPropertyWebkitFilter)
     2376            || animController.isRunningAnimationOnRenderer(&renderer, CSSPropertyWebkitFilter, activeAnimationState)
    23762377#endif // CSS_FILTERS
    2377             || animController.isRunningAnimationOnRenderer(&renderer, CSSPropertyWebkitTransform);
     2378            || animController.isRunningAnimationOnRenderer(&renderer, CSSPropertyWebkitTransform, activeAnimationState);
    23782379}
    23792380
     
    25552556        return false;
    25562557
    2557     return renderer.animation().isRunningAnimationOnRenderer(&renderer, CSSPropertyWebkitTransform);
     2558    return renderer.animation().isRunningAcceleratedAnimationOnRenderer(&renderer, CSSPropertyWebkitTransform, AnimationBase::Running | AnimationBase::Paused);
    25582559}
    25592560
Note: See TracChangeset for help on using the changeset viewer.