| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 333 m_timeline->document()->enqueueAnimationFrameEvent(event.release()); | 333 m_timeline->document()->enqueueAnimationFrameEvent(event.release()); |
| 334 } | 334 } |
| 335 m_finished = finished(); | 335 m_finished = finished(); |
| 336 } | 336 } |
| 337 return !m_finished || m_content->isCurrent() || m_content->isInEffect(); | 337 return !m_finished || m_content->isCurrent() || m_content->isInEffect(); |
| 338 } | 338 } |
| 339 | 339 |
| 340 double AnimationPlayer::timeToEffectChange() | 340 double AnimationPlayer::timeToEffectChange() |
| 341 { | 341 { |
| 342 ASSERT(!m_outdated); | 342 ASSERT(!m_outdated); |
| 343 if (!m_content || m_held) | 343 if (m_held || !hasStartTime()) |
| 344 return std::numeric_limits<double>::infinity(); | 344 return std::numeric_limits<double>::infinity(); |
| 345 if (!m_content) |
| 346 return -currentTime() / m_playbackRate; |
| 345 if (m_playbackRate > 0) | 347 if (m_playbackRate > 0) |
| 346 return m_content->timeToForwardsEffectChange() / m_playbackRate; | 348 return m_content->timeToForwardsEffectChange() / m_playbackRate; |
| 347 return m_content->timeToReverseEffectChange() / std::abs(m_playbackRate); | 349 return m_content->timeToReverseEffectChange() / -m_playbackRate; |
| 348 } | 350 } |
| 349 | 351 |
| 350 void AnimationPlayer::cancel() | 352 void AnimationPlayer::cancel() |
| 351 { | 353 { |
| 352 if (!m_content) | 354 if (!m_content) |
| 353 return; | 355 return; |
| 354 | 356 |
| 355 ASSERT(m_content->player() == this); | 357 ASSERT(m_content->player() == this); |
| 356 m_content->detach(); | 358 m_content->detach(); |
| 357 m_content = nullptr; | 359 m_content = nullptr; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 371 { | 373 { |
| 372 RELEASE_ASSERT(!paused()); | 374 RELEASE_ASSERT(!paused()); |
| 373 updateTimingState(pauseTime); | 375 updateTimingState(pauseTime); |
| 374 if (!m_isPausedForTesting && hasActiveAnimationsOnCompositor()) | 376 if (!m_isPausedForTesting && hasActiveAnimationsOnCompositor()) |
| 375 toAnimation(m_content.get())->pauseAnimationForTestingOnCompositor(curre
ntTime()); | 377 toAnimation(m_content.get())->pauseAnimationForTestingOnCompositor(curre
ntTime()); |
| 376 m_isPausedForTesting = true; | 378 m_isPausedForTesting = true; |
| 377 pause(); | 379 pause(); |
| 378 } | 380 } |
| 379 | 381 |
| 380 } // namespace | 382 } // namespace |
| OLD | NEW |