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 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
319 | 319 |
320 if (m_activeInAnimationStack) { | 320 if (m_activeInAnimationStack) { |
321 const_cast<Animation*>(this)->clearEffects(); | 321 const_cast<Animation*>(this)->clearEffects(); |
322 return true; | 322 return true; |
323 } | 323 } |
324 return false; | 324 return false; |
325 } | 325 } |
326 | 326 |
327 double Animation::calculateTimeToEffectChange(double localTime, double timeToNex
tIteration) const | 327 double Animation::calculateTimeToEffectChange(double localTime, double timeToNex
tIteration) const |
328 { | 328 { |
329 const double activeStartTime = startTime() + specified().startDelay; | 329 const double activeStartTime = startTime() + specifiedTiming().startDelay; |
330 switch (phase()) { | 330 switch (phase()) { |
331 case PhaseBefore: | 331 case PhaseBefore: |
332 return activeStartTime - localTime; | 332 return activeStartTime - localTime; |
333 case PhaseActive: | 333 case PhaseActive: |
334 if (hasActiveAnimationsOnCompositor()) { | 334 if (hasActiveAnimationsOnCompositor()) { |
335 // Need service to apply fill / fire events. | 335 // Need service to apply fill / fire events. |
336 const double activeEndTime = activeStartTime + activeDuration(); | 336 const double activeEndTime = activeStartTime + activeDuration(); |
337 return std::min(activeEndTime - localTime, timeToNextIteration); | 337 return std::min(activeEndTime - localTime, timeToNextIteration); |
338 } | 338 } |
339 return 0; | 339 return 0; |
340 case PhaseAfter: | 340 case PhaseAfter: |
341 // If this Animation is still in effect then it will need to update | 341 // If this Animation is still in effect then it will need to update |
342 // when its parent goes out of effect. We have no way of knowing when | 342 // when its parent goes out of effect. We have no way of knowing when |
343 // that will be, however, so the parent will need to supply it. | 343 // that will be, however, so the parent will need to supply it. |
344 return std::numeric_limits<double>::infinity(); | 344 return std::numeric_limits<double>::infinity(); |
345 case PhaseNone: | 345 case PhaseNone: |
346 ASSERT(player() && !player()->timeline().hasStarted()); | 346 ASSERT(player() && !player()->timeline().hasStarted()); |
347 return std::numeric_limits<double>::infinity(); | 347 return std::numeric_limits<double>::infinity(); |
348 default: | 348 default: |
349 ASSERT_NOT_REACHED(); | 349 ASSERT_NOT_REACHED(); |
350 return 0; | 350 return 0; |
351 } | 351 } |
352 } | 352 } |
353 | 353 |
354 bool Animation::isCandidateForAnimationOnCompositor() const | 354 bool Animation::isCandidateForAnimationOnCompositor() const |
355 { | 355 { |
356 if (!effect() || !m_target) | 356 if (!effect() || !m_target) |
357 return false; | 357 return false; |
358 return CompositorAnimations::instance()->isCandidateForAnimationOnCompositor
(specified(), *effect()); | 358 return CompositorAnimations::instance()->isCandidateForAnimationOnCompositor
(specifiedTiming(), *effect()); |
359 } | 359 } |
360 | 360 |
361 bool Animation::maybeStartAnimationOnCompositor() | 361 bool Animation::maybeStartAnimationOnCompositor() |
362 { | 362 { |
363 ASSERT(!hasActiveAnimationsOnCompositor()); | 363 ASSERT(!hasActiveAnimationsOnCompositor()); |
364 if (!isCandidateForAnimationOnCompositor()) | 364 if (!isCandidateForAnimationOnCompositor()) |
365 return false; | 365 return false; |
366 if (!CompositorAnimations::instance()->canStartAnimationOnCompositor(*m_targ
et.get())) | 366 if (!CompositorAnimations::instance()->canStartAnimationOnCompositor(*m_targ
et.get())) |
367 return false; | 367 return false; |
368 if (!CompositorAnimations::instance()->startAnimationOnCompositor(*m_target.
get(), specified(), *effect(), m_compositorAnimationIds)) | 368 if (!CompositorAnimations::instance()->startAnimationOnCompositor(*m_target.
get(), specifiedTiming(), *effect(), m_compositorAnimationIds)) |
369 return false; | 369 return false; |
370 ASSERT(!m_compositorAnimationIds.isEmpty()); | 370 ASSERT(!m_compositorAnimationIds.isEmpty()); |
371 return true; | 371 return true; |
372 } | 372 } |
373 | 373 |
374 bool Animation::hasActiveAnimationsOnCompositor() const | 374 bool Animation::hasActiveAnimationsOnCompositor() const |
375 { | 375 { |
376 return !m_compositorAnimationIds.isEmpty(); | 376 return !m_compositorAnimationIds.isEmpty(); |
377 } | 377 } |
378 | 378 |
(...skipping 21 matching lines...) Expand all Loading... |
400 void Animation::pauseAnimationForTestingOnCompositor(double pauseTime) | 400 void Animation::pauseAnimationForTestingOnCompositor(double pauseTime) |
401 { | 401 { |
402 ASSERT(hasActiveAnimationsOnCompositor()); | 402 ASSERT(hasActiveAnimationsOnCompositor()); |
403 if (!m_target || !m_target->renderer()) | 403 if (!m_target || !m_target->renderer()) |
404 return; | 404 return; |
405 for (size_t i = 0; i < m_compositorAnimationIds.size(); ++i) | 405 for (size_t i = 0; i < m_compositorAnimationIds.size(); ++i) |
406 CompositorAnimations::instance()->pauseAnimationForTestingOnCompositor(*
m_target.get(), m_compositorAnimationIds[i], pauseTime); | 406 CompositorAnimations::instance()->pauseAnimationForTestingOnCompositor(*
m_target.get(), m_compositorAnimationIds[i], pauseTime); |
407 } | 407 } |
408 | 408 |
409 } // namespace WebCore | 409 } // namespace WebCore |
OLD | NEW |