| 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 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 } | 246 } |
| 247 #endif | 247 #endif |
| 248 | 248 |
| 249 bool Animation::isCandidateForAnimationOnCompositor(double playerPlaybackRate) c
onst | 249 bool Animation::isCandidateForAnimationOnCompositor(double playerPlaybackRate) c
onst |
| 250 { | 250 { |
| 251 if (!effect() | 251 if (!effect() |
| 252 || !m_target | 252 || !m_target |
| 253 || (m_target->renderStyle() && m_target->renderStyle()->hasMotionPath())
) | 253 || (m_target->renderStyle() && m_target->renderStyle()->hasMotionPath())
) |
| 254 return false; | 254 return false; |
| 255 | 255 |
| 256 return CompositorAnimations::instance()->isCandidateForAnimationOnCompositor
(specifiedTiming(), *effect(), playerPlaybackRate); | 256 return CompositorAnimations::instance()->isCandidateForAnimationOnCompositor
(specifiedTiming(), *m_target, player(), *effect(), playerPlaybackRate); |
| 257 } | 257 } |
| 258 | 258 |
| 259 bool Animation::maybeStartAnimationOnCompositor(int group, double startTime, dou
ble currentTime, double playerPlaybackRate) | 259 bool Animation::maybeStartAnimationOnCompositor(int group, double startTime, dou
ble currentTime, double playerPlaybackRate) |
| 260 { | 260 { |
| 261 ASSERT(!hasActiveAnimationsOnCompositor()); | 261 ASSERT(!hasActiveAnimationsOnCompositor()); |
| 262 if (!isCandidateForAnimationOnCompositor(playerPlaybackRate)) | 262 if (!isCandidateForAnimationOnCompositor(playerPlaybackRate)) |
| 263 return false; | 263 return false; |
| 264 if (!CompositorAnimations::instance()->canStartAnimationOnCompositor(*m_targ
et)) | 264 if (!CompositorAnimations::instance()->canStartAnimationOnCompositor(*m_targ
et)) |
| 265 return false; | 265 return false; |
| 266 if (!CompositorAnimations::instance()->startAnimationOnCompositor(*m_target,
group, startTime, currentTime, specifiedTiming(), *effect(), m_compositorAnimat
ionIds, playerPlaybackRate)) | 266 if (!CompositorAnimations::instance()->startAnimationOnCompositor(*m_target,
group, startTime, currentTime, specifiedTiming(), player(), *effect(), m_compos
itorAnimationIds, playerPlaybackRate)) |
| 267 return false; | 267 return false; |
| 268 ASSERT(!m_compositorAnimationIds.isEmpty()); | 268 ASSERT(!m_compositorAnimationIds.isEmpty()); |
| 269 return true; | 269 return true; |
| 270 } | 270 } |
| 271 | 271 |
| 272 bool Animation::hasActiveAnimationsOnCompositor() const | 272 bool Animation::hasActiveAnimationsOnCompositor() const |
| 273 { | 273 { |
| 274 return !m_compositorAnimationIds.isEmpty(); | 274 return !m_compositorAnimationIds.isEmpty(); |
| 275 } | 275 } |
| 276 | 276 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 293 if (!hasActiveAnimationsOnCompositor()) | 293 if (!hasActiveAnimationsOnCompositor()) |
| 294 return; | 294 return; |
| 295 if (!m_target || !m_target->renderer()) | 295 if (!m_target || !m_target->renderer()) |
| 296 return; | 296 return; |
| 297 for (const auto& compositorAnimationId : m_compositorAnimationIds) | 297 for (const auto& compositorAnimationId : m_compositorAnimationIds) |
| 298 CompositorAnimations::instance()->cancelAnimationOnCompositor(*m_target,
compositorAnimationId); | 298 CompositorAnimations::instance()->cancelAnimationOnCompositor(*m_target,
compositorAnimationId); |
| 299 m_compositorAnimationIds.clear(); | 299 m_compositorAnimationIds.clear(); |
| 300 player()->setCompositorPending(true); | 300 player()->setCompositorPending(true); |
| 301 } | 301 } |
| 302 | 302 |
| 303 void Animation::cancelIncompatibleAnimationsOnCompositor() |
| 304 { |
| 305 if (m_target && player() && effect()) |
| 306 CompositorAnimations::instance()->cancelIncompatibleAnimationsOnComposit
or(*m_target, *player(), *effect()); |
| 307 } |
| 308 |
| 303 void Animation::pauseAnimationForTestingOnCompositor(double pauseTime) | 309 void Animation::pauseAnimationForTestingOnCompositor(double pauseTime) |
| 304 { | 310 { |
| 305 ASSERT(hasActiveAnimationsOnCompositor()); | 311 ASSERT(hasActiveAnimationsOnCompositor()); |
| 306 if (!m_target || !m_target->renderer()) | 312 if (!m_target || !m_target->renderer()) |
| 307 return; | 313 return; |
| 308 for (const auto& compositorAnimationId : m_compositorAnimationIds) | 314 for (const auto& compositorAnimationId : m_compositorAnimationIds) |
| 309 CompositorAnimations::instance()->pauseAnimationForTestingOnCompositor(*
m_target, compositorAnimationId, pauseTime); | 315 CompositorAnimations::instance()->pauseAnimationForTestingOnCompositor(*
m_target, compositorAnimationId, pauseTime); |
| 310 } | 316 } |
| 311 | 317 |
| 312 void Animation::trace(Visitor* visitor) | 318 void Animation::trace(Visitor* visitor) |
| 313 { | 319 { |
| 314 visitor->trace(m_target); | 320 visitor->trace(m_target); |
| 315 visitor->trace(m_effect); | 321 visitor->trace(m_effect); |
| 316 visitor->trace(m_sampledEffect); | 322 visitor->trace(m_sampledEffect); |
| 317 AnimationNode::trace(visitor); | 323 AnimationNode::trace(visitor); |
| 318 } | 324 } |
| 319 | 325 |
| 320 } // namespace blink | 326 } // namespace blink |
| OLD | NEW |