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 628 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
639 for (const auto& entry : m_transitions) { | 639 for (const auto& entry : m_transitions) { |
640 entry.value.animation->cancel(); | 640 entry.value.animation->cancel(); |
641 entry.value.animation->update(TimingUpdateOnDemand); | 641 entry.value.animation->update(TimingUpdateOnDemand); |
642 } | 642 } |
643 | 643 |
644 m_runningAnimations.clear(); | 644 m_runningAnimations.clear(); |
645 m_transitions.clear(); | 645 m_transitions.clear(); |
646 clearPendingUpdate(); | 646 clearPendingUpdate(); |
647 } | 647 } |
648 | 648 |
| 649 static bool isCSSPropertyHandle(const PropertyHandle& propertyHandle) |
| 650 { |
| 651 return propertyHandle.isCSSProperty(); |
| 652 } |
| 653 |
649 void CSSAnimations::calculateAnimationActiveInterpolations(CSSAnimationUpdate& u
pdate, const Element* animatingElement) | 654 void CSSAnimations::calculateAnimationActiveInterpolations(CSSAnimationUpdate& u
pdate, const Element* animatingElement) |
650 { | 655 { |
651 ElementAnimations* elementAnimations = animatingElement ? animatingElement->
elementAnimations() : nullptr; | 656 ElementAnimations* elementAnimations = animatingElement ? animatingElement->
elementAnimations() : nullptr; |
652 AnimationStack* animationStack = elementAnimations ? &elementAnimations->ani
mationStack() : nullptr; | 657 AnimationStack* animationStack = elementAnimations ? &elementAnimations->ani
mationStack() : nullptr; |
653 | 658 |
654 if (update.newAnimations().isEmpty() && update.suppressedAnimations().isEmpt
y()) { | 659 if (update.newAnimations().isEmpty() && update.suppressedAnimations().isEmpt
y()) { |
655 ActiveInterpolationsMap activeInterpolationsForAnimations(AnimationStack
::activeInterpolations(animationStack, 0, 0, KeyframeEffect::DefaultPriority)); | 660 ActiveInterpolationsMap activeInterpolationsForAnimations(AnimationStack
::activeInterpolations(animationStack, nullptr, nullptr, KeyframeEffect::Default
Priority, isCSSPropertyHandle)); |
656 update.adoptActiveInterpolationsForAnimations(activeInterpolationsForAni
mations); | 661 update.adoptActiveInterpolationsForAnimations(activeInterpolationsForAni
mations); |
657 return; | 662 return; |
658 } | 663 } |
659 | 664 |
660 HeapVector<Member<InertEffect>> newEffects; | 665 HeapVector<Member<InertEffect>> newEffects; |
661 for (const auto& newAnimation : update.newAnimations()) | 666 for (const auto& newAnimation : update.newAnimations()) |
662 newEffects.append(newAnimation.effect.get()); | 667 newEffects.append(newAnimation.effect.get()); |
663 for (const auto& updatedAnimation : update.animationsWithUpdates()) | 668 for (const auto& updatedAnimation : update.animationsWithUpdates()) |
664 newEffects.append(updatedAnimation.effect.get()); // Animations with upd
ates use a temporary InertEffect for the current frame. | 669 newEffects.append(updatedAnimation.effect.get()); // Animations with upd
ates use a temporary InertEffect for the current frame. |
665 | 670 |
666 ActiveInterpolationsMap activeInterpolationsForAnimations(AnimationStack::ac
tiveInterpolations(animationStack, &newEffects, &update.suppressedAnimations(),
KeyframeEffect::DefaultPriority)); | 671 ActiveInterpolationsMap activeInterpolationsForAnimations(AnimationStack::ac
tiveInterpolations(animationStack, &newEffects, &update.suppressedAnimations(),
KeyframeEffect::DefaultPriority, isCSSPropertyHandle)); |
667 update.adoptActiveInterpolationsForAnimations(activeInterpolationsForAnimati
ons); | 672 update.adoptActiveInterpolationsForAnimations(activeInterpolationsForAnimati
ons); |
668 } | 673 } |
669 | 674 |
670 void CSSAnimations::calculateTransitionActiveInterpolations(CSSAnimationUpdate&
update, const Element* animatingElement) | 675 void CSSAnimations::calculateTransitionActiveInterpolations(CSSAnimationUpdate&
update, const Element* animatingElement) |
671 { | 676 { |
672 ElementAnimations* elementAnimations = animatingElement ? animatingElement->
elementAnimations() : nullptr; | 677 ElementAnimations* elementAnimations = animatingElement ? animatingElement->
elementAnimations() : nullptr; |
673 AnimationStack* animationStack = elementAnimations ? &elementAnimations->ani
mationStack() : nullptr; | 678 AnimationStack* animationStack = elementAnimations ? &elementAnimations->ani
mationStack() : nullptr; |
674 | 679 |
675 ActiveInterpolationsMap activeInterpolationsForTransitions; | 680 ActiveInterpolationsMap activeInterpolationsForTransitions; |
676 if (update.newTransitions().isEmpty() && update.cancelledTransitions().isEmp
ty()) { | 681 if (update.newTransitions().isEmpty() && update.cancelledTransitions().isEmp
ty()) { |
677 activeInterpolationsForTransitions = AnimationStack::activeInterpolation
s(animationStack, 0, 0, KeyframeEffect::TransitionPriority); | 682 activeInterpolationsForTransitions = AnimationStack::activeInterpolation
s(animationStack, nullptr, nullptr, KeyframeEffect::TransitionPriority, isCSSPro
pertyHandle); |
678 } else { | 683 } else { |
679 HeapVector<Member<InertEffect>> newTransitions; | 684 HeapVector<Member<InertEffect>> newTransitions; |
680 for (const auto& entry : update.newTransitions()) | 685 for (const auto& entry : update.newTransitions()) |
681 newTransitions.append(entry.value.effect.get()); | 686 newTransitions.append(entry.value.effect.get()); |
682 | 687 |
683 HeapHashSet<Member<const Animation>> cancelledAnimations; | 688 HeapHashSet<Member<const Animation>> cancelledAnimations; |
684 if (!update.cancelledTransitions().isEmpty()) { | 689 if (!update.cancelledTransitions().isEmpty()) { |
685 ASSERT(elementAnimations); | 690 ASSERT(elementAnimations); |
686 const TransitionMap& transitionMap = elementAnimations->cssAnimation
s().m_transitions; | 691 const TransitionMap& transitionMap = elementAnimations->cssAnimation
s().m_transitions; |
687 for (CSSPropertyID id : update.cancelledTransitions()) { | 692 for (CSSPropertyID id : update.cancelledTransitions()) { |
688 ASSERT(transitionMap.contains(id)); | 693 ASSERT(transitionMap.contains(id)); |
689 cancelledAnimations.add(transitionMap.get(id).animation.get()); | 694 cancelledAnimations.add(transitionMap.get(id).animation.get()); |
690 } | 695 } |
691 } | 696 } |
692 | 697 |
693 activeInterpolationsForTransitions = AnimationStack::activeInterpolation
s(animationStack, &newTransitions, &cancelledAnimations, KeyframeEffect::Transit
ionPriority); | 698 activeInterpolationsForTransitions = AnimationStack::activeInterpolation
s(animationStack, &newTransitions, &cancelledAnimations, KeyframeEffect::Transit
ionPriority, isCSSPropertyHandle); |
694 } | 699 } |
695 | 700 |
696 // Properties being animated by animations don't get values from transitions
applied. | 701 // Properties being animated by animations don't get values from transitions
applied. |
697 if (!update.activeInterpolationsForAnimations().isEmpty() && !activeInterpol
ationsForTransitions.isEmpty()) { | 702 if (!update.activeInterpolationsForAnimations().isEmpty() && !activeInterpol
ationsForTransitions.isEmpty()) { |
698 for (const auto& entry : update.activeInterpolationsForAnimations()) | 703 for (const auto& entry : update.activeInterpolationsForAnimations()) |
699 activeInterpolationsForTransitions.remove(entry.key); | 704 activeInterpolationsForTransitions.remove(entry.key); |
700 } | 705 } |
701 update.adoptActiveInterpolationsForTransitions(activeInterpolationsForTransi
tions); | 706 update.adoptActiveInterpolationsForTransitions(activeInterpolationsForTransi
tions); |
702 } | 707 } |
703 | 708 |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
833 } | 838 } |
834 | 839 |
835 DEFINE_TRACE(CSSAnimations) | 840 DEFINE_TRACE(CSSAnimations) |
836 { | 841 { |
837 visitor->trace(m_transitions); | 842 visitor->trace(m_transitions); |
838 visitor->trace(m_pendingUpdate); | 843 visitor->trace(m_pendingUpdate); |
839 visitor->trace(m_runningAnimations); | 844 visitor->trace(m_runningAnimations); |
840 } | 845 } |
841 | 846 |
842 } // namespace blink | 847 } // namespace blink |
OLD | NEW |