Changeset 63862 in webkit


Ignore:
Timestamp:
Jul 21, 2010 4:16:19 PM (14 years ago)
Author:
cmarrin@apple.com
Message:

2010-07-21 Chris Marrin <cmarrin@apple.com>

Reviewed by Simon Fraser.

Assertion failure in AnimationBase::updateStateMachine() coming out of paused state
https://bugs.webkit.org/show_bug.cgi?id=37993


Added logic to properly handle pausing and resuming when in the
AnimationStateStartWaitStyleAvailable state. This was causing an
assert when going out of the pause state because the paused flag
was not set.


The fix is a straightforward implementation, going into a new
AnimationStatePausedWaitStyleAvailable state and setting the paused
flag (actually setting the m_pauseTime variable to something other
than -1). Also added handling of the new state, both when the
"style available" callback comes in while in this state and when
unpausing while in this state.


For now a LayoutTest is not possible since there's no way to go in
and out of the pause state. I've opened https://bugs.webkit.org/show_bug.cgi?id=42790
to track this.

  • page/animation/AnimationBase.cpp: (WebCore::AnimationBase::updateStateMachine):
  • page/animation/AnimationBase.h: (WebCore::AnimationBase::):
Location:
trunk/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r63859 r63862  
     12010-07-21  Chris Marrin  <cmarrin@apple.com>
     2
     3        Reviewed by Simon Fraser.
     4
     5        Assertion failure in AnimationBase::updateStateMachine() coming out of paused state
     6        https://bugs.webkit.org/show_bug.cgi?id=37993
     7       
     8        Added logic to properly handle pausing and resuming when in the
     9        AnimationStateStartWaitStyleAvailable state. This was causing an
     10        assert when going out of the pause state because the paused flag
     11        was not set.
     12       
     13        The fix is a straightforward implementation, going into a new
     14        AnimationStatePausedWaitStyleAvailable state and setting the paused
     15        flag (actually setting the m_pauseTime variable to something other
     16        than -1). Also added handling of the new state, both when the
     17        "style available" callback comes in while in this state and when
     18        unpausing while in this state.
     19       
     20        For now a LayoutTest is not possible since there's no way to go in
     21        and out of the pause state. I've opened https://bugs.webkit.org/show_bug.cgi?id=42790
     22        to track this.
     23
     24        * page/animation/AnimationBase.cpp:
     25        (WebCore::AnimationBase::updateStateMachine):
     26        * page/animation/AnimationBase.h:
     27        (WebCore::AnimationBase::):
     28
    1292010-07-21  Bo Liu  <boliu@chromium.org>
    230
  • trunk/WebCore/page/animation/AnimationBase.cpp

    r63576 r63862  
    965965            ASSERT(input == AnimationStateInputStyleAvailable || input == AnimationStateInputPlayStatePaused);
    966966
    967             // Start timer has fired, tell the animation to start and wait for it to respond with start time
    968             m_animState = AnimationStateStartWaitResponse;
    969 
    970             overrideAnimations();
    971 
    972             // Start the animation
    973             if (overridden()) {
    974                 // We won't try to start accelerated animations if we are overridden and
    975                 // just move on to the next state.
     967            if (input == AnimationStateInputStyleAvailable) {
     968                // Start timer has fired, tell the animation to start and wait for it to respond with start time
    976969                m_animState = AnimationStateStartWaitResponse;
    977                 m_isAccelerated = false;
    978                 updateStateMachine(AnimationStateInputStartTimeSet, beginAnimationUpdateTime());
    979             }
    980             else {
    981                 double timeOffset = 0;
    982                 // If the value for 'animation-delay' is negative then the animation appears to have started in the past.
    983                 if (m_animation->delay() < 0)
    984                     timeOffset = -m_animation->delay();
    985                 bool started = startAnimation(timeOffset);
    986 
    987                 m_compAnim->animationController()->addToStartTimeResponseWaitList(this, started);
    988                 m_isAccelerated = started;
     970
     971                overrideAnimations();
     972
     973                // Start the animation
     974                if (overridden()) {
     975                    // We won't try to start accelerated animations if we are overridden and
     976                    // just move on to the next state.
     977                    m_animState = AnimationStateStartWaitResponse;
     978                    m_isAccelerated = false;
     979                    updateStateMachine(AnimationStateInputStartTimeSet, beginAnimationUpdateTime());
     980                } else {
     981                    double timeOffset = 0;
     982                    // If the value for 'animation-delay' is negative then the animation appears to have started in the past.
     983                    if (m_animation->delay() < 0)
     984                        timeOffset = -m_animation->delay();
     985                    bool started = startAnimation(timeOffset);
     986
     987                    m_compAnim->animationController()->addToStartTimeResponseWaitList(this, started);
     988                    m_isAccelerated = started;
     989                }
     990            } else {
     991                // We're waiting for the style to be available and we got a pause. Pause and wait
     992                m_pauseTime = beginAnimationUpdateTime();
     993                m_animState = AnimationStatePausedWaitStyleAvailable;
    989994            }
    990995            break;
     
    10761081            break;
    10771082        case AnimationStatePausedWaitResponse:
     1083        case AnimationStatePausedWaitStyleAvailable:
    10781084        case AnimationStatePausedRun:
    10791085            // We treat these two cases the same. The only difference is that, when we are in
     
    10811087            // When the AnimationStateInputStartTimeSet comes in and we were in AnimationStatePausedRun, we will notice
    10821088            // that we have already set the startTime and will ignore it.
    1083             ASSERT(input == AnimationStateInputPlayStateRunning || input == AnimationStateInputStartTimeSet);
     1089            ASSERT(input == AnimationStateInputPlayStateRunning || input == AnimationStateInputStartTimeSet || input == AnimationStateInputStyleAvailable);
    10841090            ASSERT(paused());
    10851091           
    1086             // If we are paused, but we get the callback that notifies us that an accelerated animation started,
    1087             // then we ignore the start time and just move into the paused-run state.
    1088             if (m_animState == AnimationStatePausedWaitResponse && input == AnimationStateInputStartTimeSet) {
     1092            if (input == AnimationStateInputPlayStateRunning) {
     1093                // Update the times
     1094                if (m_animState == AnimationStatePausedRun)
     1095                    m_startTime += beginAnimationUpdateTime() - m_pauseTime;
     1096                else
     1097                    m_startTime = 0;
     1098                m_pauseTime = -1;
     1099
     1100                if (m_animState == AnimationStatePausedWaitStyleAvailable)
     1101                    m_animState = AnimationStateStartWaitStyleAvailable;
     1102                else {
     1103                    // We were either running or waiting for a begin time response from the animation.
     1104                    // Either way we need to restart the animation (possibly with an offset if we
     1105                    // had already been running) and wait for it to start.
     1106                    m_animState = AnimationStateStartWaitResponse;
     1107
     1108                    // Start the animation
     1109                    if (overridden()) {
     1110                        // We won't try to start accelerated animations if we are overridden and
     1111                        // just move on to the next state.
     1112                        updateStateMachine(AnimationStateInputStartTimeSet, beginAnimationUpdateTime());
     1113                        m_isAccelerated = true;
     1114                    } else {
     1115                        bool started = startAnimation(beginAnimationUpdateTime() - m_startTime);
     1116                        m_compAnim->animationController()->addToStartTimeResponseWaitList(this, started);
     1117                        m_isAccelerated = !started;
     1118                    }
     1119                }
     1120                break;
     1121            }
     1122           
     1123            if (input == AnimationStateInputStartTimeSet) {
     1124                ASSERT(m_animState == AnimationStatePausedWaitResponse);
     1125               
     1126                // We are paused but we got the callback that notifies us that an accelerated animation started.
     1127                // We ignore the start time and just move into the paused-run state.
    10891128                m_animState = AnimationStatePausedRun;
    10901129                ASSERT(m_startTime == 0);
     
    10941133            }
    10951134           
    1096             // Update the times
    1097             if (m_animState == AnimationStatePausedRun)
    1098                 m_startTime += beginAnimationUpdateTime() - m_pauseTime;
    1099             else
    1100                 m_startTime = 0;
    1101             m_pauseTime = -1;
    1102 
    1103             // We were waiting for a begin time response from the animation, go back and wait again
    1104             m_animState = AnimationStateStartWaitResponse;
    1105 
    1106             // Start the animation
    1107             if (overridden()) {
    1108                 // We won't try to start accelerated animations if we are overridden and
    1109                 // just move on to the next state.
    1110                 updateStateMachine(AnimationStateInputStartTimeSet, beginAnimationUpdateTime());
    1111                 m_isAccelerated = false;
    1112             } else {
    1113                 bool started = startAnimation(beginAnimationUpdateTime() - m_startTime);
    1114                 m_compAnim->animationController()->addToStartTimeResponseWaitList(this, started);
    1115                 m_isAccelerated = started;
    1116             }
     1135            ASSERT(m_animState == AnimationStatePausedWaitStyleAvailable);
     1136            // We are paused but we got the callback that notifies us that style has been updated.
     1137            // We move to the AnimationStatePausedWaitResponse state
     1138            m_animState = AnimationStatePausedWaitResponse;
     1139            overrideAnimations();
    11171140            break;
    11181141        case AnimationStateFillingForwards:
  • trunk/WebCore/page/animation/AnimationBase.h

    r63576 r63862  
    7070        AnimationStateEnding,               // received, animation running, end timer running, waiting for fire
    7171        AnimationStatePausedWaitTimer,      // in pause mode when animation started
     72        AnimationStatePausedWaitStyleAvailable, // in pause mode when waiting for style setup
    7273        AnimationStatePausedWaitResponse,   // animation paused when in STARTING state
    7374        AnimationStatePausedRun,            // animation paused when in LOOPING or ENDING state
Note: See TracChangeset for help on using the changeset viewer.