|
Lines 717-723
ExceptionOr<void> WebAnimation::finish()
a/Source/WebCore/animation/WebAnimation.cpp_sec1
|
| 717 |
return { }; |
717 |
return { }; |
| 718 |
} |
718 |
} |
| 719 |
|
719 |
|
| 720 |
void WebAnimation::timingDidChange(DidSeek didSeek, SynchronouslyNotify synchronouslyNotify) |
720 |
void WebAnimation::timingDidChange(DidSeek didSeek, SynchronouslyNotify synchronouslyNotify, Silently silently) |
| 721 |
{ |
721 |
{ |
| 722 |
m_shouldSkipUpdatingFinishedStateWhenResolving = false; |
722 |
m_shouldSkipUpdatingFinishedStateWhenResolving = false; |
| 723 |
updateFinishedState(didSeek, synchronouslyNotify); |
723 |
updateFinishedState(didSeek, synchronouslyNotify); |
|
Lines 727-733
void WebAnimation::timingDidChange(DidSeek didSeek, SynchronouslyNotify synchron
a/Source/WebCore/animation/WebAnimation.cpp_sec2
|
| 727 |
downcast<KeyframeEffect>(*m_effect).animationTimingDidChange(); |
727 |
downcast<KeyframeEffect>(*m_effect).animationTimingDidChange(); |
| 728 |
} |
728 |
} |
| 729 |
|
729 |
|
| 730 |
if (m_timeline) |
730 |
if (silently == Silently::No && m_timeline) |
| 731 |
m_timeline->animationTimingDidChange(*this); |
731 |
m_timeline->animationTimingDidChange(*this); |
| 732 |
}; |
732 |
}; |
| 733 |
|
733 |
|
|
Lines 979-985
void WebAnimation::runPendingPlayTask()
a/Source/WebCore/animation/WebAnimation.cpp_sec3
|
| 979 |
m_readyPromise->resolve(*this); |
979 |
m_readyPromise->resolve(*this); |
| 980 |
|
980 |
|
| 981 |
// 5. Run the procedure to update an animation's finished state for animation with the did seek flag set to false, and the synchronously notify flag set to false. |
981 |
// 5. Run the procedure to update an animation's finished state for animation with the did seek flag set to false, and the synchronously notify flag set to false. |
| 982 |
timingDidChange(DidSeek::No, SynchronouslyNotify::No); |
982 |
timingDidChange(DidSeek::No, SynchronouslyNotify::No, Silently::Yes); |
| 983 |
|
983 |
|
| 984 |
invalidateEffect(); |
984 |
invalidateEffect(); |
| 985 |
} |
985 |
} |
|
Lines 1105-1111
void WebAnimation::runPendingPauseTask()
a/Source/WebCore/animation/WebAnimation.cpp_sec4
|
| 1105 |
|
1105 |
|
| 1106 |
// 6. Run the procedure to update an animation's finished state for animation with the did seek flag set to false, and the |
1106 |
// 6. Run the procedure to update an animation's finished state for animation with the did seek flag set to false, and the |
| 1107 |
// synchronously notify flag set to false. |
1107 |
// synchronously notify flag set to false. |
| 1108 |
timingDidChange(DidSeek::No, SynchronouslyNotify::No); |
1108 |
timingDidChange(DidSeek::No, SynchronouslyNotify::No, Silently::Yes); |
| 1109 |
|
1109 |
|
| 1110 |
invalidateEffect(); |
1110 |
invalidateEffect(); |
| 1111 |
} |
1111 |
} |
|
Lines 1289-1325
ExceptionOr<void> WebAnimation::commitStyles()
a/Source/WebCore/animation/WebAnimation.cpp_sec5
|
| 1289 |
|
1289 |
|
| 1290 |
Seconds WebAnimation::timeToNextTick() const |
1290 |
Seconds WebAnimation::timeToNextTick() const |
| 1291 |
{ |
1291 |
{ |
| 1292 |
ASSERT(isRunningAccelerated()); |
1292 |
// Any animation that is pending needs immediate resolution. |
| 1293 |
|
|
|
| 1294 |
if (pending()) |
1293 |
if (pending()) |
| 1295 |
return 0_s; |
1294 |
return 0_s; |
| 1296 |
|
1295 |
|
| 1297 |
// If we're not running, there's no telling when we'll end. |
1296 |
// If we're not running, or time is not advancing for this animation, there's no telling when we'll end. |
| 1298 |
if (playState() != PlayState::Running) |
1297 |
auto playbackRate = effectivePlaybackRate(); |
|
|
1298 |
if (playState() != PlayState::Running || !playbackRate) |
| 1299 |
return Seconds::infinity(); |
1299 |
return Seconds::infinity(); |
| 1300 |
|
1300 |
|
| 1301 |
// CSS Animations dispatch events for each iteration, so compute the time until |
1301 |
auto& effect = *this->effect(); |
| 1302 |
// the end of this iteration. Any other animation only cares about remaning total time. |
1302 |
auto timing = effect.getBasicTiming(); |
| 1303 |
if (isCSSAnimation()) { |
1303 |
switch (timing.phase) { |
| 1304 |
auto* animationEffect = effect(); |
1304 |
case AnimationEffectPhase::Before: |
| 1305 |
auto timing = animationEffect->getComputedTiming(); |
1305 |
// The animation is in its "before" phase, in this case we can wait until it enters its "active" phase. |
| 1306 |
// If we're actively running, we need the time until the next iteration. |
1306 |
return (effect.delay() - timing.localTime.value()) / playbackRate; |
| 1307 |
if (auto iterationProgress = timing.simpleIterationProgress) |
1307 |
case AnimationEffectPhase::Active: |
| 1308 |
return animationEffect->iterationDuration() * (1 - *iterationProgress); |
1308 |
// Non-accelerated animations in the "active" phase will need to update their animated value at the immediate next opportunity. |
| 1309 |
|
1309 |
if (!isRunningAccelerated()) |
| 1310 |
// Otherwise we're probably in the before phase waiting to reach our start time. |
1310 |
return 0_s; |
| 1311 |
if (auto animationCurrentTime = currentTime()) { |
1311 |
// Accelerated CSS Animations need to trigger "animationiteration" events, in this case we can wait until the next iteration. |
| 1312 |
// If our current time is negative, we need to be scheduled to be resolved at the inverse |
1312 |
if (isCSSAnimation()) { |
| 1313 |
// of our current time, unless we fill backwards, in which case we want to invalidate as |
1313 |
if (auto iterationProgress = effect.getComputedTiming().simpleIterationProgress) |
| 1314 |
// soon as possible. |
1314 |
return effect.iterationDuration() * (1 - *iterationProgress); |
| 1315 |
auto localTime = animationCurrentTime.value(); |
|
|
| 1316 |
if (localTime < 0_s) |
| 1317 |
return -localTime; |
| 1318 |
if (localTime < animationEffect->delay()) |
| 1319 |
return animationEffect->delay() - localTime; |
| 1320 |
} |
1315 |
} |
| 1321 |
} else if (auto animationCurrentTime = currentTime()) |
1316 |
// Accelerated animations in the "active" phase can wait until they ended. |
| 1322 |
return effect()->endTime() - *animationCurrentTime; |
1317 |
return (effect.endTime() - timing.localTime.value()) / playbackRate; |
|
|
1318 |
case AnimationEffectPhase::After: |
| 1319 |
// The animation is in its after phase, which means it will no longer update its value, so it doens't need a tick. |
| 1320 |
return Seconds::infinity(); |
| 1321 |
case AnimationEffectPhase::Idle: |
| 1322 |
ASSERT_NOT_REACHED(); |
| 1323 |
return Seconds::infinity(); |
| 1324 |
} |
| 1323 |
|
1325 |
|
| 1324 |
ASSERT_NOT_REACHED(); |
1326 |
ASSERT_NOT_REACHED(); |
| 1325 |
return Seconds::infinity(); |
1327 |
return Seconds::infinity(); |