Changeset 148145 in webkit


Ignore:
Timestamp:
Apr 10, 2013 3:47:07 PM (11 years ago)
Author:
Simon Fraser
Message:

Flesh out the Animations logging
https://bugs.webkit.org/show_bug.cgi?id=114388

Reviewed by Dean Jackson.

Log state changes and transition/animation creation and destruction
to the Animations log channel.

  • page/animation/AnimationBase.cpp:

(WebCore::nameForState):
(WebCore::AnimationBase::updateStateMachine):
(WebCore::AnimationBase::fireAnimationEventsIfNeeded):
(WebCore::AnimationBase::goIntoEndingOrLoopingState):
(WebCore::AnimationBase::freezeAtTime):

  • page/animation/CompositeAnimation.cpp:

(WebCore::CompositeAnimation::updateTransitions):
(WebCore::CompositeAnimation::updateKeyframeAnimations):

  • page/animation/KeyframeAnimation.h:

(WebCore::KeyframeAnimation::keyframes):
(KeyframeAnimation):

Location:
trunk/Source/WebCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r148144 r148145  
     12013-04-10  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Flesh out the Animations logging
     4        https://bugs.webkit.org/show_bug.cgi?id=114388
     5
     6        Reviewed by Dean Jackson.
     7
     8        Log state changes and transition/animation creation and destruction
     9        to the Animations log channel.
     10
     11        * page/animation/AnimationBase.cpp:
     12        (WebCore::nameForState):
     13        (WebCore::AnimationBase::updateStateMachine):
     14        (WebCore::AnimationBase::fireAnimationEventsIfNeeded):
     15        (WebCore::AnimationBase::goIntoEndingOrLoopingState):
     16        (WebCore::AnimationBase::freezeAtTime):
     17        * page/animation/CompositeAnimation.cpp:
     18        (WebCore::CompositeAnimation::updateTransitions):
     19        (WebCore::CompositeAnimation::updateKeyframeAnimations):
     20        * page/animation/KeyframeAnimation.h:
     21        (WebCore::KeyframeAnimation::keyframes):
     22        (KeyframeAnimation):
     23
    1242013-04-10  Alexey Proskuryakov  <ap@apple.com>
    225
  • trunk/Source/WebCore/page/animation/AnimationBase.cpp

    r148122 r148145  
    3737#include "EventNames.h"
    3838#include "FloatConversion.h"
     39#include "Logging.h"
    3940#include "RenderBox.h"
    4041#include "RenderStyle.h"
     
    112113}
    113114
     115#if !LOG_DISABLED
     116static const char* nameForState(AnimationBase::AnimState state)
     117{
     118    switch (state) {
     119    case AnimationBase::AnimationStateNew: return "New";
     120    case AnimationBase::AnimationStateStartWaitTimer: return "StartWaitTimer";
     121    case AnimationBase::AnimationStateStartWaitStyleAvailable: return "StartWaitStyleAvailable";
     122    case AnimationBase::AnimationStateStartWaitResponse: return "StartWaitResponse";
     123    case AnimationBase::AnimationStateLooping: return "Looping";
     124    case AnimationBase::AnimationStateEnding: return "Ending";
     125    case AnimationBase::AnimationStatePausedWaitTimer: return "PausedWaitTimer";
     126    case AnimationBase::AnimationStatePausedWaitStyleAvailable: return "PausedWaitStyleAvailable";
     127    case AnimationBase::AnimationStatePausedWaitResponse: return "PausedWaitResponse";
     128    case AnimationBase::AnimationStatePausedRun: return "PausedRun";
     129    case AnimationBase::AnimationStateDone: return "Done";
     130    case AnimationBase::AnimationStateFillingForwards: return "FillingForwards";
     131    }
     132    return "";
     133}
     134#endif
     135
    114136void AnimationBase::updateStateMachine(AnimStateInput input, double param)
    115137{
     
    121143        if (m_animState == AnimationStateStartWaitStyleAvailable)
    122144            m_compAnim->animationController()->removeFromAnimationsWaitingForStyle(this);
     145        LOG(Animations, "%p AnimationState %s -> New", this, nameForState(m_animState));
    123146        m_animState = AnimationStateNew;
    124147        m_startTime = 0;
     
    133156        if (m_animState == AnimationStateStartWaitStyleAvailable)
    134157            m_compAnim->animationController()->removeFromAnimationsWaitingForStyle(this);
     158        LOG(Animations, "%p AnimationState %s -> New", this, nameForState(m_animState));
    135159        m_animState = AnimationStateNew;
    136160        m_startTime = 0;
     
    148172        if (m_animState == AnimationStateStartWaitStyleAvailable)
    149173            m_compAnim->animationController()->removeFromAnimationsWaitingForStyle(this);
     174        LOG(Animations, "%p AnimationState %s -> Done", this, nameForState(m_animState));
    150175        m_animState = AnimationStateDone;
    151176        endAnimation();
     
    177202            if (input == AnimationStateInputStartAnimation || input == AnimationStateInputPlayStateRunning) {
    178203                m_requestedStartTime = beginAnimationUpdateTime();
     204                LOG(Animations, "%p AnimationState %s -> StartWaitTimer", this, nameForState(m_animState));
    179205                m_animState = AnimationStateStartWaitTimer;
    180206            }
     
    186212                ASSERT(param >= 0);
    187213                // Start timer has fired, tell the animation to start and wait for it to respond with start time
     214                LOG(Animations, "%p AnimationState %s -> StartWaitStyleAvailable", this, nameForState(m_animState));
    188215                m_animState = AnimationStateStartWaitStyleAvailable;
    189216                m_compAnim->animationController()->addToAnimationsWaitingForStyle(this);
     
    196223                // We're waiting for the start timer to fire and we got a pause. Cancel the timer, pause and wait
    197224                m_pauseTime = beginAnimationUpdateTime();
     225                LOG(Animations, "%p AnimationState %s -> PausedWaitTimer", this, nameForState(m_animState));
    198226                m_animState = AnimationStatePausedWaitTimer;
    199227            }
     
    204232            if (input == AnimationStateInputStyleAvailable) {
    205233                // Start timer has fired, tell the animation to start and wait for it to respond with start time
     234                LOG(Animations, "%p AnimationState %s -> StartWaitResponse", this, nameForState(m_animState));
    206235                m_animState = AnimationStateStartWaitResponse;
    207236
     
    212241                    // We won't try to start accelerated animations if we are overridden and
    213242                    // just move on to the next state.
     243                    LOG(Animations, "%p AnimationState %s -> StartWaitResponse", this, nameForState(m_animState));
    214244                    m_animState = AnimationStateStartWaitResponse;
    215245                    m_isAccelerated = false;
     
    228258                // We're waiting for the style to be available and we got a pause. Pause and wait
    229259                m_pauseTime = beginAnimationUpdateTime();
     260                LOG(Animations, "%p AnimationState %s -> PausedWaitStyleAvailable", this, nameForState(m_animState));
    230261                m_animState = AnimationStatePausedWaitStyleAvailable;
    231262            }
     
    258289                m_pauseTime = beginAnimationUpdateTime();
    259290                pauseAnimation(beginAnimationUpdateTime() - m_startTime);
     291                LOG(Animations, "%p AnimationState %s -> PausedWaitResponse", this, nameForState(m_animState));
    260292                m_animState = AnimationStatePausedWaitResponse;
    261293            }
     
    275307                m_pauseTime = beginAnimationUpdateTime();
    276308                pauseAnimation(beginAnimationUpdateTime() - m_startTime);
     309                LOG(Animations, "%p AnimationState %s -> PausedRun", this, nameForState(m_animState));
    277310                m_animState = AnimationStatePausedRun;
    278311            }
     
    289322                onAnimationEnd(param);
    290323
     324                LOG(Animations, "%p AnimationState %s -> Done", this, nameForState(m_animState));
    291325                m_animState = AnimationStateDone;
    292326               
    293327                if (m_object) {
    294                     if (m_animation->fillsForwards())
     328                    if (m_animation->fillsForwards()) {
     329                        LOG(Animations, "%p AnimationState %s -> FillingForwards", this, nameForState(m_animState));
    295330                        m_animState = AnimationStateFillingForwards;
    296                     else
     331                    } else
    297332                        resumeOverriddenAnimations();
    298333
     
    304339                m_pauseTime = beginAnimationUpdateTime();
    305340                pauseAnimation(beginAnimationUpdateTime() - m_startTime);
     341                LOG(Animations, "%p AnimationState %s -> PausedRun", this, nameForState(m_animState));
    306342                m_animState = AnimationStatePausedRun;
    307343            }
     
    316352
    317353            // we were waiting for the start timer to fire, go back and wait again
     354            LOG(Animations, "%p AnimationState %s -> New", this, nameForState(m_animState));
    318355            m_animState = AnimationStateNew;
    319356            updateStateMachine(AnimationStateInputStartAnimation, 0);
     
    337374                m_pauseTime = -1;
    338375
    339                 if (m_animState == AnimationStatePausedWaitStyleAvailable)
     376                if (m_animState == AnimationStatePausedWaitStyleAvailable) {
     377                    LOG(Animations, "%p AnimationState %s -> StartWaitStyleAvailable", this, nameForState(m_animState));
    340378                    m_animState = AnimationStateStartWaitStyleAvailable;
    341                 else {
     379                } else {
    342380                    // We were either running or waiting for a begin time response from the animation.
    343381                    // Either way we need to restart the animation (possibly with an offset if we
    344382                    // had already been running) and wait for it to start.
     383                    LOG(Animations, "%p AnimationState %s -> StartWaitResponse", this, nameForState(m_animState));
    345384                    m_animState = AnimationStateStartWaitResponse;
    346385
     
    365404                // We are paused but we got the callback that notifies us that an accelerated animation started.
    366405                // We ignore the start time and just move into the paused-run state.
     406                LOG(Animations, "%p AnimationState %s -> PausedRun", this, nameForState(m_animState));
    367407                m_animState = AnimationStatePausedRun;
    368408                ASSERT(m_startTime == 0);
     
    375415            // We are paused but we got the callback that notifies us that style has been updated.
    376416            // We move to the AnimationStatePausedWaitResponse state
     417            LOG(Animations, "%p AnimationState %s -> PausedWaitResponse", this, nameForState(m_animState));
    377418            m_animState = AnimationStatePausedWaitResponse;
    378419            overrideAnimations();
     
    418459        // We may still be in AnimationStateLooping if we've managed to skip a
    419460        // whole iteration, in which case we should jump to the end state.
     461        LOG(Animations, "%p AnimationState %s -> Ending", this, nameForState(m_animState));
    420462        m_animState = AnimationStateEnding;
    421463
     
    581623    bool isLooping;
    582624    getTimeToNextEvent(t, isLooping);
     625    LOG(Animations, "%p AnimationState %s -> %s", this, nameForState(m_animState), isLooping ? "Looping" : "Ending");
    583626    m_animState = isLooping ? AnimationStateLooping : AnimationStateEnding;
    584627}
     
    591634    if (!m_startTime) {
    592635        // If we haven't started yet, make it as if we started.
     636        LOG(Animations, "%p AnimationState %s -> StartWaitResponse", this, nameForState(m_animState));
    593637        m_animState = AnimationStateStartWaitResponse;
    594638        onAnimationStartResponse(currentTime());
  • trunk/Source/WebCore/page/animation/CompositeAnimation.cpp

    r141656 r148145  
    3535#include "ImplicitAnimation.h"
    3636#include "KeyframeAnimation.h"
     37#include "Logging.h"
    3738#include "RenderObject.h"
    3839#include "RenderStyle.h"
     
    141142                    // behave as though this is a running animation being replaced.
    142143                    if (!implAnim->isTargetPropertyEqual(prop, targetStyle)) {
    143     #if USE(ACCELERATED_COMPOSITING)
     144#if USE(ACCELERATED_COMPOSITING)
    144145                        // For accelerated animations we need to return a new RenderStyle with the _current_ value
    145146                        // of the property, so that restarted transitions use the correct starting point.
     
    150151                            implAnim->blendPropertyValueInStyle(prop, modifiedCurrentStyle.get());
    151152                        }
    152     #endif
     153#endif
     154                        LOG(Animations, "Removing existing ImplicitAnimation %p for property %s", implAnim, getPropertyName(prop));
    153155                        animationController()->animationWillBeRemoved(implAnim);
    154156                        m_transitions.remove(prop);
     
    166168                if (!equal && isActiveTransition) {
    167169                    // Add the new transition
    168                     m_transitions.set(prop, ImplicitAnimation::create(const_cast<Animation*>(anim), prop, renderer, this, modifiedCurrentStyle ? modifiedCurrentStyle.get() : fromStyle));
     170                    RefPtr<ImplicitAnimation> animation = ImplicitAnimation::create(const_cast<Animation*>(anim), prop, renderer, this, modifiedCurrentStyle ? modifiedCurrentStyle.get() : fromStyle);
     171                    LOG(Animations, "Created ImplicitAnimation %p for property %s duration %.2f delay %.2f", animation.get(), getPropertyName(prop), anim->duration(), anim->delay());
     172                    m_transitions.set(prop, animation.release());
    169173                }
    170174               
     
    184188            animationController()->animationWillBeRemoved(anim);
    185189            toBeRemoved.append(anim->animatingProperty());
     190            LOG(Animations, "Removing ImplicitAnimation %p for property %s", anim, getPropertyName(anim->animatingProperty()));
    186191        }
    187192    }
     
    247252                } else if ((anim->duration() || anim->delay()) && anim->iterationCount() && animationName != none) {
    248253                    keyframeAnim = KeyframeAnimation::create(const_cast<Animation*>(anim), renderer, i, this, targetStyle);
     254                    LOG(Animations, "Creating KeyframeAnimation %p with keyframes %s duration %.2f delay %.2f, iterations %.2f", keyframeAnim.get(), anim->name().utf8().data(), anim->duration(), anim->delay(), anim->iterationCount());
     255#if !LOG_DISABLED
     256                    HashSet<CSSPropertyID>::const_iterator endProperties = keyframeAnim->keyframes().endProperties();
     257                    for (HashSet<CSSPropertyID>::const_iterator it = keyframeAnim->keyframes().beginProperties(); it != endProperties; ++it)
     258                        LOG(Animations, "  property %s", getPropertyName(*it));
     259#endif
    249260                    m_keyframeAnimations.set(keyframeAnim->name().impl(), keyframeAnim);
    250261                }
     
    266277            animationController()->animationWillBeRemoved(keyframeAnim);
    267278            keyframeAnim->clear();
     279            LOG(Animations, "Removing KeyframeAnimation %p", keyframeAnim);
    268280        }
    269281    }
  • trunk/Source/WebCore/page/animation/KeyframeAnimation.h

    r113281 r148145  
    4949    virtual void animate(CompositeAnimation*, RenderObject*, const RenderStyle* currentStyle, RenderStyle* targetStyle, RefPtr<RenderStyle>& animatedStyle);
    5050    virtual void getAnimatedStyle(RefPtr<RenderStyle>& animatedStyle);
     51
     52    const KeyframeList& keyframes() const { return m_keyframes; }
    5153
    5254    const AtomicString& name() const { return m_keyframes.animationName(); }
Note: See TracChangeset for help on using the changeset viewer.