Changeset 63862 in webkit
- Timestamp:
- Jul 21, 2010 4:16:19 PM (14 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r63859 r63862 1 2010-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 1 29 2010-07-21 Bo Liu <boliu@chromium.org> 2 30 -
trunk/WebCore/page/animation/AnimationBase.cpp
r63576 r63862 965 965 ASSERT(input == AnimationStateInputStyleAvailable || input == AnimationStateInputPlayStatePaused); 966 966 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 976 969 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; 989 994 } 990 995 break; … … 1076 1081 break; 1077 1082 case AnimationStatePausedWaitResponse: 1083 case AnimationStatePausedWaitStyleAvailable: 1078 1084 case AnimationStatePausedRun: 1079 1085 // We treat these two cases the same. The only difference is that, when we are in … … 1081 1087 // When the AnimationStateInputStartTimeSet comes in and we were in AnimationStatePausedRun, we will notice 1082 1088 // 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); 1084 1090 ASSERT(paused()); 1085 1091 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. 1089 1128 m_animState = AnimationStatePausedRun; 1090 1129 ASSERT(m_startTime == 0); … … 1094 1133 } 1095 1134 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(); 1117 1140 break; 1118 1141 case AnimationStateFillingForwards: -
trunk/WebCore/page/animation/AnimationBase.h
r63576 r63862 70 70 AnimationStateEnding, // received, animation running, end timer running, waiting for fire 71 71 AnimationStatePausedWaitTimer, // in pause mode when animation started 72 AnimationStatePausedWaitStyleAvailable, // in pause mode when waiting for style setup 72 73 AnimationStatePausedWaitResponse, // animation paused when in STARTING state 73 74 AnimationStatePausedRun, // animation paused when in LOOPING or ENDING state
Note: See TracChangeset
for help on using the changeset viewer.