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 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
353 | 353 |
354 // FIXME: This avoids marking this animation as outdated needlessly when
a start time | 354 // FIXME: This avoids marking this animation as outdated needlessly when
a start time |
355 // is notified, but we should refactor how outdating works to avoid this
. | 355 // is notified, but we should refactor how outdating works to avoid this
. |
356 clearOutdated(); | 356 clearOutdated(); |
357 m_currentTimePending = false; | 357 m_currentTimePending = false; |
358 } | 358 } |
359 } | 359 } |
360 | 360 |
361 bool Animation::affects(const Element& element, CSSPropertyID property) const | 361 bool Animation::affects(const Element& element, CSSPropertyID property) const |
362 { | 362 { |
363 if (!m_content || !m_content->isAnimation()) | 363 if (!m_content || !m_content->isKeyframeEffect()) |
364 return false; | 364 return false; |
365 | 365 |
366 const KeyframeEffect* effect = toKeyframeEffect(m_content.get()); | 366 const KeyframeEffect* effect = toKeyframeEffect(m_content.get()); |
367 return (effect->target() == &element) && effect->affects(PropertyHandle(prop
erty)); | 367 return (effect->target() == &element) && effect->affects(PropertyHandle(prop
erty)); |
368 } | 368 } |
369 | 369 |
370 double Animation::calculateStartTime(double currentTime) const | 370 double Animation::calculateStartTime(double currentTime) const |
371 { | 371 { |
372 return m_timeline->effectiveTime() - currentTime / m_playbackRate; | 372 return m_timeline->effectiveTime() - currentTime / m_playbackRate; |
373 } | 373 } |
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
688 | 688 |
689 bool Animation::canStartAnimationOnCompositor() const | 689 bool Animation::canStartAnimationOnCompositor() const |
690 { | 690 { |
691 if (m_isCompositedAnimationDisabledForTesting) | 691 if (m_isCompositedAnimationDisabledForTesting) |
692 return false; | 692 return false; |
693 | 693 |
694 // FIXME: Timeline playback rates should be compositable | 694 // FIXME: Timeline playback rates should be compositable |
695 if (m_playbackRate == 0 || (std::isinf(effectEnd()) && m_playbackRate < 0) |
| (timeline() && timeline()->playbackRate() != 1)) | 695 if (m_playbackRate == 0 || (std::isinf(effectEnd()) && m_playbackRate < 0) |
| (timeline() && timeline()->playbackRate() != 1)) |
696 return false; | 696 return false; |
697 | 697 |
698 return m_timeline && m_content && m_content->isAnimation() && playing(); | 698 return m_timeline && m_content && m_content->isKeyframeEffect() && playing()
; |
699 } | 699 } |
700 | 700 |
701 bool Animation::isCandidateForAnimationOnCompositor() const | 701 bool Animation::isCandidateForAnimationOnCompositor() const |
702 { | 702 { |
703 if (!canStartAnimationOnCompositor()) | 703 if (!canStartAnimationOnCompositor()) |
704 return false; | 704 return false; |
705 | 705 |
706 return toKeyframeEffect(m_content.get())->isCandidateForAnimationOnComposito
r(m_playbackRate); | 706 return toKeyframeEffect(m_content.get())->isCandidateForAnimationOnComposito
r(m_playbackRate); |
707 } | 707 } |
708 | 708 |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
760 } | 760 } |
761 | 761 |
762 void Animation::restartAnimationOnCompositor() | 762 void Animation::restartAnimationOnCompositor() |
763 { | 763 { |
764 if (hasActiveAnimationsOnCompositor()) | 764 if (hasActiveAnimationsOnCompositor()) |
765 toKeyframeEffect(m_content.get())->restartAnimationOnCompositor(); | 765 toKeyframeEffect(m_content.get())->restartAnimationOnCompositor(); |
766 } | 766 } |
767 | 767 |
768 void Animation::cancelIncompatibleAnimationsOnCompositor() | 768 void Animation::cancelIncompatibleAnimationsOnCompositor() |
769 { | 769 { |
770 if (m_content && m_content->isAnimation()) | 770 if (m_content && m_content->isKeyframeEffect()) |
771 toKeyframeEffect(m_content.get())->cancelIncompatibleAnimationsOnComposi
tor(); | 771 toKeyframeEffect(m_content.get())->cancelIncompatibleAnimationsOnComposi
tor(); |
772 } | 772 } |
773 | 773 |
774 bool Animation::hasActiveAnimationsOnCompositor() | 774 bool Animation::hasActiveAnimationsOnCompositor() |
775 { | 775 { |
776 if (!m_content || !m_content->isAnimation()) | 776 if (!m_content || !m_content->isKeyframeEffect()) |
777 return false; | 777 return false; |
778 | 778 |
779 return toKeyframeEffect(m_content.get())->hasActiveAnimationsOnCompositor(); | 779 return toKeyframeEffect(m_content.get())->hasActiveAnimationsOnCompositor(); |
780 } | 780 } |
781 | 781 |
782 bool Animation::update(TimingUpdateReason reason) | 782 bool Animation::update(TimingUpdateReason reason) |
783 { | 783 { |
784 if (!m_timeline) | 784 if (!m_timeline) |
785 return false; | 785 return false; |
786 | 786 |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
947 timeline->playerDestroyed(*this); | 947 timeline->playerDestroyed(*this); |
948 } | 948 } |
949 } | 949 } |
950 | 950 |
951 void Animation::attachCompositedLayers() | 951 void Animation::attachCompositedLayers() |
952 { | 952 { |
953 if (!RuntimeEnabledFeatures::compositorAnimationTimelinesEnabled() || !m_com
positorPlayer) | 953 if (!RuntimeEnabledFeatures::compositorAnimationTimelinesEnabled() || !m_com
positorPlayer) |
954 return; | 954 return; |
955 | 955 |
956 ASSERT(m_content); | 956 ASSERT(m_content); |
957 ASSERT(m_content->isAnimation()); | 957 ASSERT(m_content->isKeyframeEffect()); |
958 | 958 |
959 if (toKeyframeEffect(m_content.get())->canAttachCompositedLayers()) | 959 if (toKeyframeEffect(m_content.get())->canAttachCompositedLayers()) |
960 toKeyframeEffect(m_content.get())->attachCompositedLayers(); | 960 toKeyframeEffect(m_content.get())->attachCompositedLayers(); |
961 } | 961 } |
962 | 962 |
963 void Animation::detachCompositedLayers() | 963 void Animation::detachCompositedLayers() |
964 { | 964 { |
965 if (m_compositorPlayer && m_compositorPlayer->isLayerAttached()) | 965 if (m_compositorPlayer && m_compositorPlayer->isLayerAttached()) |
966 m_compositorPlayer->detachLayer(); | 966 m_compositorPlayer->detachLayer(); |
967 } | 967 } |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1084 visitor->trace(m_content); | 1084 visitor->trace(m_content); |
1085 visitor->trace(m_timeline); | 1085 visitor->trace(m_timeline); |
1086 visitor->trace(m_pendingFinishedEvent); | 1086 visitor->trace(m_pendingFinishedEvent); |
1087 visitor->trace(m_finishedPromise); | 1087 visitor->trace(m_finishedPromise); |
1088 visitor->trace(m_readyPromise); | 1088 visitor->trace(m_readyPromise); |
1089 RefCountedGarbageCollectedEventTargetWithInlineData<Animation>::trace(visito
r); | 1089 RefCountedGarbageCollectedEventTargetWithInlineData<Animation>::trace(visito
r); |
1090 ActiveDOMObject::trace(visitor); | 1090 ActiveDOMObject::trace(visitor); |
1091 } | 1091 } |
1092 | 1092 |
1093 } // namespace | 1093 } // namespace |
OLD | NEW |