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