OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2007 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007 Apple 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 | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
467 CSSPropertyTransitionsMap::const_iterator transitionsEnd = m_transitions
.end(); | 467 CSSPropertyTransitionsMap::const_iterator transitionsEnd = m_transitions
.end(); |
468 for (CSSPropertyTransitionsMap::const_iterator it = m_transitions.begin(
); it != transitionsEnd; ++it) { | 468 for (CSSPropertyTransitionsMap::const_iterator it = m_transitions.begin(
); it != transitionsEnd; ++it) { |
469 ImplicitAnimation* anim = it->value.get(); | 469 ImplicitAnimation* anim = it->value.get(); |
470 if (anim && anim->isAnimatingProperty(property, acceleratedOnly, isR
unningNow)) | 470 if (anim && anim->isAnimatingProperty(property, acceleratedOnly, isR
unningNow)) |
471 return true; | 471 return true; |
472 } | 472 } |
473 } | 473 } |
474 return false; | 474 return false; |
475 } | 475 } |
476 | 476 |
477 bool CompositeAnimation::pauseAnimationAtTime(const AtomicString& name, double t
) | 477 void CompositeAnimation::pauseAnimationsForTesting(double t) |
478 { | 478 { |
479 m_keyframeAnimations.checkConsistency(); | 479 m_keyframeAnimations.checkConsistency(); |
480 | 480 |
481 RefPtr<KeyframeAnimation> keyframeAnim = m_keyframeAnimations.get(name.impl(
)); | 481 AnimationNameMap::const_iterator animationsEnd = m_keyframeAnimations.end(); |
482 if (!keyframeAnim || !keyframeAnim->running()) | 482 for (AnimationNameMap::const_iterator it = m_keyframeAnimations.begin(); it
!= animationsEnd; ++it) { |
483 return false; | 483 RefPtr<KeyframeAnimation> keyframeAnim = it->value; |
| 484 if (!keyframeAnim || !keyframeAnim->running()) |
| 485 continue; |
484 | 486 |
485 double count = keyframeAnim->m_animation->iterationCount(); | 487 double count = keyframeAnim->m_animation->iterationCount(); |
486 if ((t >= 0.0) && ((count == CSSAnimationData::IterationCountInfinite) || (t
<= count * keyframeAnim->duration()))) { | 488 if ((t >= 0.0) && ((count == CSSAnimationData::IterationCountInfinite) |
| (t <= count * keyframeAnim->duration()))) |
487 keyframeAnim->freezeAtTime(t); | 489 keyframeAnim->freezeAtTime(t); |
488 return true; | |
489 } | 490 } |
490 | 491 |
491 return false; | 492 CSSPropertyTransitionsMap::const_iterator transitionsEnd = m_transitions.end
(); |
492 } | 493 for (CSSPropertyTransitionsMap::const_iterator it = m_transitions.begin(); i
t != transitionsEnd; ++it) { |
| 494 RefPtr<ImplicitAnimation> implAnim = it->value; |
493 | 495 |
494 bool CompositeAnimation::pauseTransitionAtTime(CSSPropertyID property, double t) | 496 if (!implAnim->running()) |
495 { | 497 continue; |
496 if ((property < firstCSSProperty) || (property >= firstCSSProperty + numCSSP
roperties)) | |
497 return false; | |
498 | 498 |
499 ImplicitAnimation* implAnim = m_transitions.get(property); | 499 if ((t >= 0.0) && (t <= implAnim->duration())) |
500 if (!implAnim) { | 500 implAnim->freezeAtTime(t); |
501 // Check to see if this property is being animated via a shorthand. | |
502 // This code is only used for testing, so performance is not critical he
re. | |
503 HashSet<CSSPropertyID> shorthandProperties = CSSPropertyAnimation::anima
tableShorthandsAffectingProperty(property); | |
504 bool anyPaused = false; | |
505 HashSet<CSSPropertyID>::const_iterator end = shorthandProperties.end(); | |
506 for (HashSet<CSSPropertyID>::const_iterator it = shorthandProperties.beg
in(); it != end; ++it) { | |
507 if (pauseTransitionAtTime(*it, t)) | |
508 anyPaused = true; | |
509 } | |
510 return anyPaused; | |
511 } | 501 } |
512 | |
513 if (!implAnim->running()) | |
514 return false; | |
515 | |
516 if ((t >= 0.0) && (t <= implAnim->duration())) { | |
517 implAnim->freezeAtTime(t); | |
518 return true; | |
519 } | |
520 | |
521 return false; | |
522 } | 502 } |
523 | 503 |
524 unsigned CompositeAnimation::numberOfActiveAnimations() const | 504 unsigned CompositeAnimation::numberOfActiveAnimations() const |
525 { | 505 { |
526 unsigned count = 0; | 506 unsigned count = 0; |
527 | 507 |
528 if (!m_keyframeAnimations.isEmpty()) { | 508 if (!m_keyframeAnimations.isEmpty()) { |
529 m_keyframeAnimations.checkConsistency(); | 509 m_keyframeAnimations.checkConsistency(); |
530 AnimationNameMap::const_iterator animationsEnd = m_keyframeAnimations.en
d(); | 510 AnimationNameMap::const_iterator animationsEnd = m_keyframeAnimations.en
d(); |
531 for (AnimationNameMap::const_iterator it = m_keyframeAnimations.begin();
it != animationsEnd; ++it) { | 511 for (AnimationNameMap::const_iterator it = m_keyframeAnimations.begin();
it != animationsEnd; ++it) { |
532 KeyframeAnimation* anim = it->value.get(); | 512 KeyframeAnimation* anim = it->value.get(); |
533 if (anim->running()) | 513 if (anim->running()) |
534 ++count; | 514 ++count; |
535 } | 515 } |
536 } | 516 } |
537 | 517 |
538 if (!m_transitions.isEmpty()) { | 518 if (!m_transitions.isEmpty()) { |
539 CSSPropertyTransitionsMap::const_iterator transitionsEnd = m_transitions
.end(); | 519 CSSPropertyTransitionsMap::const_iterator transitionsEnd = m_transitions
.end(); |
540 for (CSSPropertyTransitionsMap::const_iterator it = m_transitions.begin(
); it != transitionsEnd; ++it) { | 520 for (CSSPropertyTransitionsMap::const_iterator it = m_transitions.begin(
); it != transitionsEnd; ++it) { |
541 ImplicitAnimation* anim = it->value.get(); | 521 ImplicitAnimation* anim = it->value.get(); |
542 if (anim->running()) | 522 if (anim->running()) |
543 ++count; | 523 ++count; |
544 } | 524 } |
545 } | 525 } |
546 | 526 |
547 return count; | 527 return count; |
548 } | 528 } |
549 | 529 |
550 } // namespace WebCore | 530 } // namespace WebCore |
OLD | NEW |