Chromium Code Reviews| 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 14 matching lines...) Expand all Loading... | |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #include "core/animation/Animation.h" | 31 #include "core/animation/Animation.h" |
| 32 | 32 |
| 33 #include "core/animation/AnimationTimeline.h" | 33 #include "core/animation/AnimationTimeline.h" |
| 34 #include "core/animation/CompositorPendingAnimations.h" | 34 #include "core/animation/CompositorPendingAnimations.h" |
| 35 #include "core/animation/DocumentTimeline.h" | |
| 35 #include "core/animation/KeyframeEffectReadOnly.h" | 36 #include "core/animation/KeyframeEffectReadOnly.h" |
| 36 #include "core/animation/css/CSSAnimations.h" | 37 #include "core/animation/css/CSSAnimations.h" |
| 37 #include "core/dom/DOMNodeIds.h" | 38 #include "core/dom/DOMNodeIds.h" |
| 38 #include "core/dom/Document.h" | 39 #include "core/dom/Document.h" |
| 39 #include "core/dom/ExceptionCode.h" | 40 #include "core/dom/ExceptionCode.h" |
| 40 #include "core/dom/ExecutionContext.h" | 41 #include "core/dom/ExecutionContext.h" |
| 41 #include "core/dom/StyleChangeReason.h" | 42 #include "core/dom/StyleChangeReason.h" |
| 42 #include "core/dom/TaskRunnerHelper.h" | 43 #include "core/dom/TaskRunnerHelper.h" |
| 43 #include "core/events/AnimationPlaybackEvent.h" | 44 #include "core/events/AnimationPlaybackEvent.h" |
| 44 #include "core/frame/UseCounter.h" | 45 #include "core/frame/UseCounter.h" |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 63 static unsigned NextSequenceNumber() { | 64 static unsigned NextSequenceNumber() { |
| 64 static unsigned next = 0; | 65 static unsigned next = 0; |
| 65 return ++next; | 66 return ++next; |
| 66 } | 67 } |
| 67 } | 68 } |
| 68 | 69 |
| 69 Animation* Animation::Create(AnimationEffectReadOnly* effect, | 70 Animation* Animation::Create(AnimationEffectReadOnly* effect, |
| 70 AnimationTimeline* timeline) { | 71 AnimationTimeline* timeline) { |
| 71 if (!timeline) { | 72 if (!timeline) { |
| 72 // FIXME: Support creating animations without a timeline. | 73 // FIXME: Support creating animations without a timeline. |
| 74 NOTREACHED(); | |
| 73 return nullptr; | 75 return nullptr; |
| 74 } | 76 } |
| 75 | 77 |
| 76 Animation* animation = new Animation( | 78 Animation* animation = new Animation( |
| 77 timeline->GetDocument()->ContextDocument(), *timeline, effect); | 79 timeline->GetDocument()->ContextDocument(), *timeline, effect); |
| 78 | 80 |
| 79 if (timeline) { | 81 if (timeline) { |
| 80 timeline->AnimationAttached(*animation); | 82 timeline->AnimationAttached(*animation); |
| 81 animation->AttachCompositorTimeline(); | 83 animation->AttachCompositorTimeline(); |
| 82 } | 84 } |
| 83 | 85 |
| 84 return animation; | 86 return animation; |
| 85 } | 87 } |
| 86 | 88 |
| 89 Animation* Animation::Create(ExecutionContext* execution_context, | |
| 90 AnimationEffectReadOnly* effect, | |
| 91 ExceptionState& exception_state) { | |
| 92 if (!RuntimeEnabledFeatures::webAnimationsAPIEnabled()) { | |
|
suzyh_UTC10 (ex-contributor)
2017/06/06 06:21:48
Given I'm now selectively exposing this, do you th
alancutter (OOO until 2018)
2017/06/07 05:36:15
Yes, this branch should be unreachable now.
| |
| 93 exception_state.ThrowTypeError("Illegal constructor"); | |
| 94 return nullptr; | |
| 95 } | |
| 96 | |
| 97 Document* document = ToDocument(execution_context); | |
| 98 return Create(effect, &document->Timeline()); | |
| 99 } | |
| 100 | |
| 101 Animation* Animation::Create(ExecutionContext* execution_context, | |
| 102 AnimationEffectReadOnly* effect, | |
| 103 AnimationTimeline* timeline, | |
| 104 ExceptionState& exception_state) { | |
| 105 if (!RuntimeEnabledFeatures::webAnimationsAPIEnabled()) { | |
| 106 exception_state.ThrowTypeError("Illegal constructor"); | |
| 107 return nullptr; | |
| 108 } | |
| 109 | |
| 110 if (!timeline) { | |
| 111 return Create(execution_context, effect, exception_state); | |
| 112 } | |
| 113 | |
| 114 return Create(effect, timeline); | |
| 115 } | |
| 116 | |
| 87 Animation::Animation(ExecutionContext* execution_context, | 117 Animation::Animation(ExecutionContext* execution_context, |
| 88 AnimationTimeline& timeline, | 118 AnimationTimeline& timeline, |
| 89 AnimationEffectReadOnly* content) | 119 AnimationEffectReadOnly* content) |
| 90 : ContextLifecycleObserver(execution_context), | 120 : ContextLifecycleObserver(execution_context), |
| 91 play_state_(kIdle), | 121 play_state_(kIdle), |
| 92 playback_rate_(1), | 122 playback_rate_(1), |
| 93 start_time_(NullValue()), | 123 start_time_(NullValue()), |
| 94 hold_time_(0), | 124 hold_time_(0), |
| 95 sequence_number_(NextSequenceNumber()), | 125 sequence_number_(NextSequenceNumber()), |
| 96 content_(content), | 126 content_(content), |
| (...skipping 1112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1209 DCHECK(!compositor_player_); | 1239 DCHECK(!compositor_player_); |
| 1210 } | 1240 } |
| 1211 | 1241 |
| 1212 void Animation::CompositorAnimationPlayerHolder::Detach() { | 1242 void Animation::CompositorAnimationPlayerHolder::Detach() { |
| 1213 DCHECK(compositor_player_); | 1243 DCHECK(compositor_player_); |
| 1214 compositor_player_->SetAnimationDelegate(nullptr); | 1244 compositor_player_->SetAnimationDelegate(nullptr); |
| 1215 animation_ = nullptr; | 1245 animation_ = nullptr; |
| 1216 compositor_player_.reset(); | 1246 compositor_player_.reset(); |
| 1217 } | 1247 } |
| 1218 } // namespace blink | 1248 } // namespace blink |
| OLD | NEW |