| 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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 return create(element, EffectInput::convert(element, keyframeDictionaryVecto
r, exceptionState), Timing()); | 88 return create(element, EffectInput::convert(element, keyframeDictionaryVecto
r, exceptionState), Timing()); |
| 89 } | 89 } |
| 90 | 90 |
| 91 Animation::Animation(Element* target, PassRefPtr<AnimationEffect> effect, const
Timing& timing, Priority priority, PassOwnPtr<EventDelegate> eventDelegate) | 91 Animation::Animation(Element* target, PassRefPtr<AnimationEffect> effect, const
Timing& timing, Priority priority, PassOwnPtr<EventDelegate> eventDelegate) |
| 92 : AnimationNode(timing, eventDelegate) | 92 : AnimationNode(timing, eventDelegate) |
| 93 , m_target(target) | 93 , m_target(target) |
| 94 , m_effect(effect) | 94 , m_effect(effect) |
| 95 , m_sampledEffect(nullptr) | 95 , m_sampledEffect(nullptr) |
| 96 , m_priority(priority) | 96 , m_priority(priority) |
| 97 { | 97 { |
| 98 #if !ENABLE(OILPAN) | |
| 99 if (m_target) | 98 if (m_target) |
| 100 m_target->ensureActiveAnimations().addAnimation(this); | 99 m_target->ensureActiveAnimations().addAnimation(this); |
| 101 #endif | |
| 102 } | 100 } |
| 103 | 101 |
| 104 Animation::~Animation() | 102 Animation::~Animation() |
| 105 { | 103 { |
| 106 #if !ENABLE(OILPAN) | |
| 107 if (m_target) | 104 if (m_target) |
| 108 m_target->activeAnimations()->notifyAnimationDestroyed(this); | 105 m_target->activeAnimations()->notifyAnimationDestroyed(this); |
| 109 #endif | |
| 110 } | 106 } |
| 111 | 107 |
| 112 void Animation::attach(AnimationPlayer* player) | 108 void Animation::attach(AnimationPlayer* player) |
| 113 { | 109 { |
| 114 if (m_target) { | 110 if (m_target) { |
| 115 m_target->ensureActiveAnimations().players().add(player); | 111 m_target->ensureActiveAnimations().players().add(player); |
| 116 m_target->setNeedsAnimationStyleRecalc(); | 112 m_target->setNeedsAnimationStyleRecalc(); |
| 117 } | 113 } |
| 118 AnimationNode::attach(player); | 114 AnimationNode::attach(player); |
| 119 } | 115 } |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 223 return std::numeric_limits<double>::infinity(); | 219 return std::numeric_limits<double>::infinity(); |
| 224 } | 220 } |
| 225 } | 221 } |
| 226 | 222 |
| 227 void Animation::notifySampledEffectRemovedFromAnimationStack() | 223 void Animation::notifySampledEffectRemovedFromAnimationStack() |
| 228 { | 224 { |
| 229 ASSERT(m_sampledEffect); | 225 ASSERT(m_sampledEffect); |
| 230 m_sampledEffect = nullptr; | 226 m_sampledEffect = nullptr; |
| 231 } | 227 } |
| 232 | 228 |
| 233 #if !ENABLE(OILPAN) | |
| 234 void Animation::notifyElementDestroyed() | 229 void Animation::notifyElementDestroyed() |
| 235 { | 230 { |
| 236 // If our player is kept alive just by the sampledEffect, we might get our | 231 // If our player is kept alive just by the sampledEffect, we might get our |
| 237 // destructor called when we call SampledEffect::clear(), so we need to | 232 // destructor called when we call SampledEffect::clear(), so we need to |
| 238 // clear m_sampledEffect first. | 233 // clear m_sampledEffect first. |
| 239 m_target = nullptr; | 234 m_target = nullptr; |
| 240 clearEventDelegate(); | 235 clearEventDelegate(); |
| 241 SampledEffect* sampledEffect = m_sampledEffect; | 236 SampledEffect* sampledEffect = m_sampledEffect; |
| 242 m_sampledEffect = nullptr; | 237 m_sampledEffect = nullptr; |
| 243 if (sampledEffect) | 238 if (sampledEffect) |
| 244 sampledEffect->clear(); | 239 sampledEffect->clear(); |
| 245 } | 240 } |
| 246 #endif | |
| 247 | 241 |
| 248 bool Animation::isCandidateForAnimationOnCompositor() const | 242 bool Animation::isCandidateForAnimationOnCompositor() const |
| 249 { | 243 { |
| 250 if (!effect() || !m_target) | 244 if (!effect() || !m_target) |
| 251 return false; | 245 return false; |
| 252 return CompositorAnimations::instance()->isCandidateForAnimationOnCompositor
(specifiedTiming(), *effect()); | 246 return CompositorAnimations::instance()->isCandidateForAnimationOnCompositor
(specifiedTiming(), *effect()); |
| 253 } | 247 } |
| 254 | 248 |
| 255 bool Animation::maybeStartAnimationOnCompositor(double startTime, double current
Time) | 249 bool Animation::maybeStartAnimationOnCompositor(double startTime, double current
Time) |
| 256 { | 250 { |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 307 | 301 |
| 308 void Animation::trace(Visitor* visitor) | 302 void Animation::trace(Visitor* visitor) |
| 309 { | 303 { |
| 310 visitor->trace(m_target); | 304 visitor->trace(m_target); |
| 311 visitor->trace(m_effect); | 305 visitor->trace(m_effect); |
| 312 visitor->trace(m_sampledEffect); | 306 visitor->trace(m_sampledEffect); |
| 313 AnimationNode::trace(visitor); | 307 AnimationNode::trace(visitor); |
| 314 } | 308 } |
| 315 | 309 |
| 316 } // namespace blink | 310 } // namespace blink |
| OLD | NEW |