| 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 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 333 | 333 |
| 334 if (m_activeInAnimationStack) { | 334 if (m_activeInAnimationStack) { |
| 335 const_cast<Animation*>(this)->clearEffects(); | 335 const_cast<Animation*>(this)->clearEffects(); |
| 336 return true; | 336 return true; |
| 337 } | 337 } |
| 338 return false; | 338 return false; |
| 339 } | 339 } |
| 340 | 340 |
| 341 double Animation::calculateTimeToEffectChange(double localTime, double timeToNex
tIteration) const | 341 double Animation::calculateTimeToEffectChange(double localTime, double timeToNex
tIteration) const |
| 342 { | 342 { |
| 343 const double activeStartTime = startTime() + specified().startDelay; | 343 const double activeStartTime = startTime() + specifiedTiming().startDelay; |
| 344 switch (phase()) { | 344 switch (phase()) { |
| 345 case PhaseBefore: | 345 case PhaseBefore: |
| 346 return activeStartTime - localTime; | 346 return activeStartTime - localTime; |
| 347 case PhaseActive: | 347 case PhaseActive: |
| 348 if (hasActiveAnimationsOnCompositor()) { | 348 if (hasActiveAnimationsOnCompositor()) { |
| 349 // Need service to apply fill / fire events. | 349 // Need service to apply fill / fire events. |
| 350 const double activeEndTime = activeStartTime + activeDuration(); | 350 const double activeEndTime = activeStartTime + activeDuration(); |
| 351 return std::min(activeEndTime - localTime, timeToNextIteration); | 351 return std::min(activeEndTime - localTime, timeToNextIteration); |
| 352 } | 352 } |
| 353 return 0; | 353 return 0; |
| 354 case PhaseAfter: | 354 case PhaseAfter: |
| 355 // If this Animation is still in effect then it will need to update | 355 // If this Animation is still in effect then it will need to update |
| 356 // when its parent goes out of effect. We have no way of knowing when | 356 // when its parent goes out of effect. We have no way of knowing when |
| 357 // that will be, however, so the parent will need to supply it. | 357 // that will be, however, so the parent will need to supply it. |
| 358 return std::numeric_limits<double>::infinity(); | 358 return std::numeric_limits<double>::infinity(); |
| 359 case PhaseNone: | 359 case PhaseNone: |
| 360 ASSERT(player() && !player()->timeline().hasStarted()); | 360 ASSERT(player() && !player()->timeline().hasStarted()); |
| 361 return std::numeric_limits<double>::infinity(); | 361 return std::numeric_limits<double>::infinity(); |
| 362 default: | 362 default: |
| 363 ASSERT_NOT_REACHED(); | 363 ASSERT_NOT_REACHED(); |
| 364 return 0; | 364 return 0; |
| 365 } | 365 } |
| 366 } | 366 } |
| 367 | 367 |
| 368 bool Animation::isCandidateForAnimationOnCompositor() const | 368 bool Animation::isCandidateForAnimationOnCompositor() const |
| 369 { | 369 { |
| 370 if (!effect() || !m_target) | 370 if (!effect() || !m_target) |
| 371 return false; | 371 return false; |
| 372 return CompositorAnimations::instance()->isCandidateForAnimationOnCompositor
(specified(), *effect()); | 372 return CompositorAnimations::instance()->isCandidateForAnimationOnCompositor
(specifiedTiming(), *effect()); |
| 373 } | 373 } |
| 374 | 374 |
| 375 bool Animation::maybeStartAnimationOnCompositor() | 375 bool Animation::maybeStartAnimationOnCompositor() |
| 376 { | 376 { |
| 377 ASSERT(!hasActiveAnimationsOnCompositor()); | 377 ASSERT(!hasActiveAnimationsOnCompositor()); |
| 378 if (!isCandidateForAnimationOnCompositor()) | 378 if (!isCandidateForAnimationOnCompositor()) |
| 379 return false; | 379 return false; |
| 380 if (!CompositorAnimations::instance()->canStartAnimationOnCompositor(*m_targ
et.get())) | 380 if (!CompositorAnimations::instance()->canStartAnimationOnCompositor(*m_targ
et.get())) |
| 381 return false; | 381 return false; |
| 382 if (!CompositorAnimations::instance()->startAnimationOnCompositor(*m_target.
get(), specified(), *effect(), m_compositorAnimationIds)) | 382 if (!CompositorAnimations::instance()->startAnimationOnCompositor(*m_target.
get(), specifiedTiming(), *effect(), m_compositorAnimationIds)) |
| 383 return false; | 383 return false; |
| 384 ASSERT(!m_compositorAnimationIds.isEmpty()); | 384 ASSERT(!m_compositorAnimationIds.isEmpty()); |
| 385 return true; | 385 return true; |
| 386 } | 386 } |
| 387 | 387 |
| 388 bool Animation::hasActiveAnimationsOnCompositor() const | 388 bool Animation::hasActiveAnimationsOnCompositor() const |
| 389 { | 389 { |
| 390 return !m_compositorAnimationIds.isEmpty(); | 390 return !m_compositorAnimationIds.isEmpty(); |
| 391 } | 391 } |
| 392 | 392 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 414 void Animation::pauseAnimationForTestingOnCompositor(double pauseTime) | 414 void Animation::pauseAnimationForTestingOnCompositor(double pauseTime) |
| 415 { | 415 { |
| 416 ASSERT(hasActiveAnimationsOnCompositor()); | 416 ASSERT(hasActiveAnimationsOnCompositor()); |
| 417 if (!m_target || !m_target->renderer()) | 417 if (!m_target || !m_target->renderer()) |
| 418 return; | 418 return; |
| 419 for (size_t i = 0; i < m_compositorAnimationIds.size(); ++i) | 419 for (size_t i = 0; i < m_compositorAnimationIds.size(); ++i) |
| 420 CompositorAnimations::instance()->pauseAnimationForTestingOnCompositor(*
m_target.get(), m_compositorAnimationIds[i], pauseTime); | 420 CompositorAnimations::instance()->pauseAnimationForTestingOnCompositor(*
m_target.get(), m_compositorAnimationIds[i], pauseTime); |
| 421 } | 421 } |
| 422 | 422 |
| 423 } // namespace WebCore | 423 } // namespace WebCore |
| OLD | NEW |