| 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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 } | 59 } |
| 60 | 60 |
| 61 Animation* Animation::create(AnimationEffect* effect, AnimationTimeline* timelin
e) | 61 Animation* Animation::create(AnimationEffect* effect, AnimationTimeline* timelin
e) |
| 62 { | 62 { |
| 63 if (!timeline) { | 63 if (!timeline) { |
| 64 // FIXME: Support creating animations without a timeline. | 64 // FIXME: Support creating animations without a timeline. |
| 65 return nullptr; | 65 return nullptr; |
| 66 } | 66 } |
| 67 | 67 |
| 68 Animation* animation = new Animation(timeline->document()->contextDocument()
.get(), *timeline, effect); | 68 Animation* animation = new Animation(timeline->document()->contextDocument()
.get(), *timeline, effect); |
| 69 animation->suspendIfNeeded(); | |
| 70 | |
| 71 if (timeline) { | 69 if (timeline) { |
| 72 timeline->animationAttached(*animation); | 70 timeline->animationAttached(*animation); |
| 73 animation->attachCompositorTimeline(); | 71 animation->attachCompositorTimeline(); |
| 74 } | 72 } |
| 75 | |
| 76 return animation; | 73 return animation; |
| 77 } | 74 } |
| 78 | 75 |
| 79 Animation::Animation(ExecutionContext* executionContext, AnimationTimeline& time
line, AnimationEffect* content) | 76 Animation::Animation(ExecutionContext* executionContext, AnimationTimeline& time
line, AnimationEffect* content) |
| 80 : ActiveDOMObject(executionContext) | 77 : ContextLifecycleObserver(executionContext) |
| 81 , m_playState(Idle) | 78 , m_playState(Idle) |
| 82 , m_playbackRate(1) | 79 , m_playbackRate(1) |
| 83 , m_startTime(nullValue()) | 80 , m_startTime(nullValue()) |
| 84 , m_holdTime(0) | 81 , m_holdTime(0) |
| 85 , m_sequenceNumber(nextSequenceNumber()) | 82 , m_sequenceNumber(nextSequenceNumber()) |
| 86 , m_content(content) | 83 , m_content(content) |
| 87 , m_timeline(&timeline) | 84 , m_timeline(&timeline) |
| 88 , m_paused(false) | 85 , m_paused(false) |
| 89 , m_held(false) | 86 , m_held(false) |
| 90 , m_isPausedForTesting(false) | 87 , m_isPausedForTesting(false) |
| (...skipping 542 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 633 return m_readyPromise->promise(scriptState->world()); | 630 return m_readyPromise->promise(scriptState->world()); |
| 634 } | 631 } |
| 635 | 632 |
| 636 const AtomicString& Animation::interfaceName() const | 633 const AtomicString& Animation::interfaceName() const |
| 637 { | 634 { |
| 638 return EventTargetNames::AnimationPlayer; | 635 return EventTargetNames::AnimationPlayer; |
| 639 } | 636 } |
| 640 | 637 |
| 641 ExecutionContext* Animation::executionContext() const | 638 ExecutionContext* Animation::executionContext() const |
| 642 { | 639 { |
| 643 return ActiveDOMObject::executionContext(); | 640 return ContextLifecycleObserver::executionContext(); |
| 644 } | 641 } |
| 645 | 642 |
| 646 bool Animation::hasPendingActivity() const | 643 bool Animation::hasPendingActivity() const |
| 647 { | 644 { |
| 648 return m_pendingFinishedEvent || (!m_finished && hasEventListeners(EventType
Names::finish)); | 645 return m_pendingFinishedEvent || (!m_finished && hasEventListeners(EventType
Names::finish)); |
| 649 } | 646 } |
| 650 | 647 |
| 651 void Animation::stop() | 648 void Animation::contextDestroyed() |
| 652 { | 649 { |
| 653 PlayStateUpdateScope updateScope(*this, TimingUpdateOnDemand); | 650 PlayStateUpdateScope updateScope(*this, TimingUpdateOnDemand); |
| 654 | 651 |
| 655 m_finished = true; | 652 m_finished = true; |
| 656 m_pendingFinishedEvent = nullptr; | 653 m_pendingFinishedEvent = nullptr; |
| 657 } | 654 } |
| 658 | 655 |
| 659 DispatchEventResult Animation::dispatchEventInternal(PassRefPtrWillBeRawPtr<Even
t> event) | 656 DispatchEventResult Animation::dispatchEventInternal(PassRefPtrWillBeRawPtr<Even
t> event) |
| 660 { | 657 { |
| 661 if (m_pendingFinishedEvent == event) | 658 if (m_pendingFinishedEvent == event) |
| (...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1078 | 1075 |
| 1079 DEFINE_TRACE(Animation) | 1076 DEFINE_TRACE(Animation) |
| 1080 { | 1077 { |
| 1081 visitor->trace(m_content); | 1078 visitor->trace(m_content); |
| 1082 visitor->trace(m_timeline); | 1079 visitor->trace(m_timeline); |
| 1083 visitor->trace(m_pendingFinishedEvent); | 1080 visitor->trace(m_pendingFinishedEvent); |
| 1084 visitor->trace(m_pendingCancelledEvent); | 1081 visitor->trace(m_pendingCancelledEvent); |
| 1085 visitor->trace(m_finishedPromise); | 1082 visitor->trace(m_finishedPromise); |
| 1086 visitor->trace(m_readyPromise); | 1083 visitor->trace(m_readyPromise); |
| 1087 RefCountedGarbageCollectedEventTargetWithInlineData<Animation>::trace(visito
r); | 1084 RefCountedGarbageCollectedEventTargetWithInlineData<Animation>::trace(visito
r); |
| 1088 ActiveDOMObject::trace(visitor); | 1085 ContextLifecycleObserver::trace(visitor); |
| 1089 } | 1086 } |
| 1090 | 1087 |
| 1091 } // namespace blink | 1088 } // namespace blink |
| OLD | NEW |