| 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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 DCHECK(document); | 82 DCHECK(document); |
| 83 } | 83 } |
| 84 | 84 |
| 85 bool AnimationTimeline::isActive() { | 85 bool AnimationTimeline::isActive() { |
| 86 return m_document && m_document->page(); | 86 return m_document && m_document->page(); |
| 87 } | 87 } |
| 88 | 88 |
| 89 void AnimationTimeline::animationAttached(Animation& animation) { | 89 void AnimationTimeline::animationAttached(Animation& animation) { |
| 90 DCHECK_EQ(animation.timeline(), this); | 90 DCHECK_EQ(animation.timeline(), this); |
| 91 DCHECK(!m_animations.contains(&animation)); | 91 DCHECK(!m_animations.contains(&animation)); |
| 92 m_animations.add(&animation); | 92 m_animations.insert(&animation); |
| 93 } | 93 } |
| 94 | 94 |
| 95 Animation* AnimationTimeline::play(AnimationEffectReadOnly* child) { | 95 Animation* AnimationTimeline::play(AnimationEffectReadOnly* child) { |
| 96 if (!m_document) | 96 if (!m_document) |
| 97 return nullptr; | 97 return nullptr; |
| 98 | 98 |
| 99 Animation* animation = Animation::create(child, this); | 99 Animation* animation = Animation::create(child, this); |
| 100 DCHECK(m_animations.contains(animation)); | 100 DCHECK(m_animations.contains(animation)); |
| 101 | 101 |
| 102 animation->play(); | 102 animation->play(); |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 274 } | 274 } |
| 275 | 275 |
| 276 void AnimationTimeline::clearOutdatedAnimation(Animation* animation) { | 276 void AnimationTimeline::clearOutdatedAnimation(Animation* animation) { |
| 277 DCHECK(!animation->outdated()); | 277 DCHECK(!animation->outdated()); |
| 278 m_outdatedAnimationCount--; | 278 m_outdatedAnimationCount--; |
| 279 } | 279 } |
| 280 | 280 |
| 281 void AnimationTimeline::setOutdatedAnimation(Animation* animation) { | 281 void AnimationTimeline::setOutdatedAnimation(Animation* animation) { |
| 282 DCHECK(animation->outdated()); | 282 DCHECK(animation->outdated()); |
| 283 m_outdatedAnimationCount++; | 283 m_outdatedAnimationCount++; |
| 284 m_animationsNeedingUpdate.add(animation); | 284 m_animationsNeedingUpdate.insert(animation); |
| 285 if (isActive() && !m_document->page()->animator().isServicingAnimations()) | 285 if (isActive() && !m_document->page()->animator().isServicingAnimations()) |
| 286 m_timing->serviceOnNextFrame(); | 286 m_timing->serviceOnNextFrame(); |
| 287 } | 287 } |
| 288 | 288 |
| 289 void AnimationTimeline::setPlaybackRate(double playbackRate) { | 289 void AnimationTimeline::setPlaybackRate(double playbackRate) { |
| 290 if (!isActive()) | 290 if (!isActive()) |
| 291 return; | 291 return; |
| 292 double currentTime = currentTimeInternal(); | 292 double currentTime = currentTimeInternal(); |
| 293 m_playbackRate = playbackRate; | 293 m_playbackRate = playbackRate; |
| 294 m_zeroTime = playbackRate == 0 ? currentTime | 294 m_zeroTime = playbackRate == 0 ? currentTime |
| (...skipping 22 matching lines...) Expand all Loading... |
| 317 } | 317 } |
| 318 | 318 |
| 319 DEFINE_TRACE(AnimationTimeline) { | 319 DEFINE_TRACE(AnimationTimeline) { |
| 320 visitor->trace(m_document); | 320 visitor->trace(m_document); |
| 321 visitor->trace(m_timing); | 321 visitor->trace(m_timing); |
| 322 visitor->trace(m_animationsNeedingUpdate); | 322 visitor->trace(m_animationsNeedingUpdate); |
| 323 visitor->trace(m_animations); | 323 visitor->trace(m_animations); |
| 324 } | 324 } |
| 325 | 325 |
| 326 } // namespace blink | 326 } // namespace blink |
| OLD | NEW |