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