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 23 matching lines...) Expand all Loading... |
34 #include "bindings/core/v8/Dictionary.h" | 34 #include "bindings/core/v8/Dictionary.h" |
35 #include "bindings/core/v8/ExceptionState.h" | 35 #include "bindings/core/v8/ExceptionState.h" |
36 #include "core/animation/AnimationPlayer.h" | 36 #include "core/animation/AnimationPlayer.h" |
37 #include "core/animation/AnimationTimeline.h" | 37 #include "core/animation/AnimationTimeline.h" |
38 #include "core/animation/AnimationTimingProperties.h" | 38 #include "core/animation/AnimationTimingProperties.h" |
39 #include "core/animation/CompositorAnimations.h" | 39 #include "core/animation/CompositorAnimations.h" |
40 #include "core/animation/ElementAnimations.h" | 40 #include "core/animation/ElementAnimations.h" |
41 #include "core/animation/Interpolation.h" | 41 #include "core/animation/Interpolation.h" |
42 #include "core/animation/KeyframeEffectModel.h" | 42 #include "core/animation/KeyframeEffectModel.h" |
43 #include "core/dom/Element.h" | 43 #include "core/dom/Element.h" |
44 #include "core/dom/NodeLayoutStyle.h" | 44 #include "core/dom/NodeComputedStyle.h" |
45 #include "core/frame/UseCounter.h" | 45 #include "core/frame/UseCounter.h" |
46 #include "core/paint/DeprecatedPaintLayer.h" | 46 #include "core/paint/DeprecatedPaintLayer.h" |
47 | 47 |
48 namespace blink { | 48 namespace blink { |
49 | 49 |
50 PassRefPtrWillBeRawPtr<Animation> Animation::create(Element* target, PassRefPtrW
illBeRawPtr<AnimationEffect> effect, const Timing& timing, Priority priority, Pa
ssOwnPtrWillBeRawPtr<EventDelegate> eventDelegate) | 50 PassRefPtrWillBeRawPtr<Animation> Animation::create(Element* target, PassRefPtrW
illBeRawPtr<AnimationEffect> effect, const Timing& timing, Priority priority, Pa
ssOwnPtrWillBeRawPtr<EventDelegate> eventDelegate) |
51 { | 51 { |
52 return adoptRefWillBeNoop(new Animation(target, effect, timing, priority, ev
entDelegate)); | 52 return adoptRefWillBeNoop(new Animation(target, effect, timing, priority, ev
entDelegate)); |
53 } | 53 } |
54 | 54 |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 } | 128 } |
129 | 129 |
130 void Animation::applyEffects() | 130 void Animation::applyEffects() |
131 { | 131 { |
132 ASSERT(isInEffect()); | 132 ASSERT(isInEffect()); |
133 ASSERT(player()); | 133 ASSERT(player()); |
134 if (!m_target || !m_effect) | 134 if (!m_target || !m_effect) |
135 return; | 135 return; |
136 | 136 |
137 // Cancel composited animation of transform if a motion path has been introd
uced on the element. | 137 // Cancel composited animation of transform if a motion path has been introd
uced on the element. |
138 if (m_target->layoutStyle() | 138 if (m_target->computedStyle() |
139 && m_target->layoutStyle()->hasMotionPath() | 139 && m_target->computedStyle()->hasMotionPath() |
140 && player()->hasActiveAnimationsOnCompositor() | 140 && player()->hasActiveAnimationsOnCompositor() |
141 && player()->affects(*m_target, CSSPropertyTransform)) { | 141 && player()->affects(*m_target, CSSPropertyTransform)) { |
142 player()->cancelAnimationOnCompositor(); | 142 player()->cancelAnimationOnCompositor(); |
143 } | 143 } |
144 | 144 |
145 double iteration = currentIteration(); | 145 double iteration = currentIteration(); |
146 ASSERT(iteration >= 0); | 146 ASSERT(iteration >= 0); |
147 OwnPtrWillBeRawPtr<WillBeHeapVector<RefPtrWillBeMember<Interpolation>>> inte
rpolations = m_sampledEffect ? m_sampledEffect->mutableInterpolations() : nullpt
r; | 147 OwnPtrWillBeRawPtr<WillBeHeapVector<RefPtrWillBeMember<Interpolation>>> inte
rpolations = m_sampledEffect ? m_sampledEffect->mutableInterpolations() : nullpt
r; |
148 // FIXME: Handle iteration values which overflow int. | 148 // FIXME: Handle iteration values which overflow int. |
149 m_effect->sample(static_cast<int>(iteration), timeFraction(), iterationDurat
ion(), interpolations); | 149 m_effect->sample(static_cast<int>(iteration), timeFraction(), iterationDurat
ion(), interpolations); |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 m_sampledEffect = nullptr; | 231 m_sampledEffect = nullptr; |
232 if (sampledEffect) | 232 if (sampledEffect) |
233 sampledEffect->clear(); | 233 sampledEffect->clear(); |
234 } | 234 } |
235 #endif | 235 #endif |
236 | 236 |
237 bool Animation::isCandidateForAnimationOnCompositor(double playerPlaybackRate) c
onst | 237 bool Animation::isCandidateForAnimationOnCompositor(double playerPlaybackRate) c
onst |
238 { | 238 { |
239 if (!effect() | 239 if (!effect() |
240 || !m_target | 240 || !m_target |
241 || (m_target->layoutStyle() && m_target->layoutStyle()->hasMotionPath())
) | 241 || (m_target->computedStyle() && m_target->computedStyle()->hasMotionPat
h())) |
242 return false; | 242 return false; |
243 | 243 |
244 return CompositorAnimations::instance()->isCandidateForAnimationOnCompositor
(specifiedTiming(), *m_target, player(), *effect(), playerPlaybackRate); | 244 return CompositorAnimations::instance()->isCandidateForAnimationOnCompositor
(specifiedTiming(), *m_target, player(), *effect(), playerPlaybackRate); |
245 } | 245 } |
246 | 246 |
247 bool Animation::maybeStartAnimationOnCompositor(int group, double startTime, dou
ble currentTime, double playerPlaybackRate) | 247 bool Animation::maybeStartAnimationOnCompositor(int group, double startTime, dou
ble currentTime, double playerPlaybackRate) |
248 { | 248 { |
249 ASSERT(!hasActiveAnimationsOnCompositor()); | 249 ASSERT(!hasActiveAnimationsOnCompositor()); |
250 if (!isCandidateForAnimationOnCompositor(playerPlaybackRate)) | 250 if (!isCandidateForAnimationOnCompositor(playerPlaybackRate)) |
251 return false; | 251 return false; |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
311 | 311 |
312 DEFINE_TRACE(Animation) | 312 DEFINE_TRACE(Animation) |
313 { | 313 { |
314 visitor->trace(m_target); | 314 visitor->trace(m_target); |
315 visitor->trace(m_effect); | 315 visitor->trace(m_effect); |
316 visitor->trace(m_sampledEffect); | 316 visitor->trace(m_sampledEffect); |
317 AnimationNode::trace(visitor); | 317 AnimationNode::trace(visitor); |
318 } | 318 } |
319 | 319 |
320 } // namespace blink | 320 } // namespace blink |
OLD | NEW |