| 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 843 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 854 static bool isStylePropertyHandle(const PropertyHandle& propertyHandle) { | 854 static bool isStylePropertyHandle(const PropertyHandle& propertyHandle) { |
| 855 return propertyHandle.isCSSProperty() || | 855 return propertyHandle.isCSSProperty() || |
| 856 propertyHandle.isPresentationAttribute(); | 856 propertyHandle.isPresentationAttribute(); |
| 857 } | 857 } |
| 858 | 858 |
| 859 void CSSAnimations::calculateAnimationActiveInterpolations( | 859 void CSSAnimations::calculateAnimationActiveInterpolations( |
| 860 CSSAnimationUpdate& update, | 860 CSSAnimationUpdate& update, |
| 861 const Element* animatingElement) { | 861 const Element* animatingElement) { |
| 862 ElementAnimations* elementAnimations = | 862 ElementAnimations* elementAnimations = |
| 863 animatingElement ? animatingElement->elementAnimations() : nullptr; | 863 animatingElement ? animatingElement->elementAnimations() : nullptr; |
| 864 AnimationStack* animationStack = | 864 EffectStack* effectStack = |
| 865 elementAnimations ? &elementAnimations->animationStack() : nullptr; | 865 elementAnimations ? &elementAnimations->effectStack() : nullptr; |
| 866 | 866 |
| 867 if (update.newAnimations().isEmpty() && | 867 if (update.newAnimations().isEmpty() && |
| 868 update.suppressedAnimations().isEmpty()) { | 868 update.suppressedAnimations().isEmpty()) { |
| 869 ActiveInterpolationsMap activeInterpolationsForAnimations( | 869 ActiveInterpolationsMap activeInterpolationsForAnimations( |
| 870 AnimationStack::activeInterpolations( | 870 EffectStack::activeInterpolations( |
| 871 animationStack, nullptr, nullptr, | 871 effectStack, nullptr, nullptr, |
| 872 KeyframeEffectReadOnly::DefaultPriority, isStylePropertyHandle)); | 872 KeyframeEffectReadOnly::DefaultPriority, isStylePropertyHandle)); |
| 873 update.adoptActiveInterpolationsForAnimations( | 873 update.adoptActiveInterpolationsForAnimations( |
| 874 activeInterpolationsForAnimations); | 874 activeInterpolationsForAnimations); |
| 875 return; | 875 return; |
| 876 } | 876 } |
| 877 | 877 |
| 878 HeapVector<Member<const InertEffect>> newEffects; | 878 HeapVector<Member<const InertEffect>> newEffects; |
| 879 for (const auto& newAnimation : update.newAnimations()) | 879 for (const auto& newAnimation : update.newAnimations()) |
| 880 newEffects.append(newAnimation.effect); | 880 newEffects.append(newAnimation.effect); |
| 881 | 881 |
| 882 // Animations with updates use a temporary InertEffect for the current frame. | 882 // Animations with updates use a temporary InertEffect for the current frame. |
| 883 for (const auto& updatedAnimation : update.animationsWithUpdates()) | 883 for (const auto& updatedAnimation : update.animationsWithUpdates()) |
| 884 newEffects.append(updatedAnimation.effect); | 884 newEffects.append(updatedAnimation.effect); |
| 885 | 885 |
| 886 ActiveInterpolationsMap activeInterpolationsForAnimations( | 886 ActiveInterpolationsMap activeInterpolationsForAnimations( |
| 887 AnimationStack::activeInterpolations( | 887 EffectStack::activeInterpolations( |
| 888 animationStack, &newEffects, &update.suppressedAnimations(), | 888 effectStack, &newEffects, &update.suppressedAnimations(), |
| 889 KeyframeEffectReadOnly::DefaultPriority, isStylePropertyHandle)); | 889 KeyframeEffectReadOnly::DefaultPriority, isStylePropertyHandle)); |
| 890 update.adoptActiveInterpolationsForAnimations( | 890 update.adoptActiveInterpolationsForAnimations( |
| 891 activeInterpolationsForAnimations); | 891 activeInterpolationsForAnimations); |
| 892 } | 892 } |
| 893 | 893 |
| 894 void CSSAnimations::calculateTransitionActiveInterpolations( | 894 void CSSAnimations::calculateTransitionActiveInterpolations( |
| 895 CSSAnimationUpdate& update, | 895 CSSAnimationUpdate& update, |
| 896 const Element* animatingElement) { | 896 const Element* animatingElement) { |
| 897 ElementAnimations* elementAnimations = | 897 ElementAnimations* elementAnimations = |
| 898 animatingElement ? animatingElement->elementAnimations() : nullptr; | 898 animatingElement ? animatingElement->elementAnimations() : nullptr; |
| 899 AnimationStack* animationStack = | 899 EffectStack* effectStack = |
| 900 elementAnimations ? &elementAnimations->animationStack() : nullptr; | 900 elementAnimations ? &elementAnimations->effectStack() : nullptr; |
| 901 | 901 |
| 902 ActiveInterpolationsMap activeInterpolationsForTransitions; | 902 ActiveInterpolationsMap activeInterpolationsForTransitions; |
| 903 if (update.newTransitions().isEmpty() && | 903 if (update.newTransitions().isEmpty() && |
| 904 update.cancelledTransitions().isEmpty()) { | 904 update.cancelledTransitions().isEmpty()) { |
| 905 activeInterpolationsForTransitions = AnimationStack::activeInterpolations( | 905 activeInterpolationsForTransitions = EffectStack::activeInterpolations( |
| 906 animationStack, nullptr, nullptr, | 906 effectStack, nullptr, nullptr, |
| 907 KeyframeEffectReadOnly::TransitionPriority, isStylePropertyHandle); | 907 KeyframeEffectReadOnly::TransitionPriority, isStylePropertyHandle); |
| 908 } else { | 908 } else { |
| 909 HeapVector<Member<const InertEffect>> newTransitions; | 909 HeapVector<Member<const InertEffect>> newTransitions; |
| 910 for (const auto& entry : update.newTransitions()) | 910 for (const auto& entry : update.newTransitions()) |
| 911 newTransitions.append(entry.value.effect.get()); | 911 newTransitions.append(entry.value.effect.get()); |
| 912 | 912 |
| 913 HeapHashSet<Member<const Animation>> cancelledAnimations; | 913 HeapHashSet<Member<const Animation>> cancelledAnimations; |
| 914 if (!update.cancelledTransitions().isEmpty()) { | 914 if (!update.cancelledTransitions().isEmpty()) { |
| 915 DCHECK(elementAnimations); | 915 DCHECK(elementAnimations); |
| 916 const TransitionMap& transitionMap = | 916 const TransitionMap& transitionMap = |
| 917 elementAnimations->cssAnimations().m_transitions; | 917 elementAnimations->cssAnimations().m_transitions; |
| 918 for (CSSPropertyID id : update.cancelledTransitions()) { | 918 for (CSSPropertyID id : update.cancelledTransitions()) { |
| 919 DCHECK(transitionMap.contains(id)); | 919 DCHECK(transitionMap.contains(id)); |
| 920 cancelledAnimations.add(transitionMap.get(id).animation.get()); | 920 cancelledAnimations.add(transitionMap.get(id).animation.get()); |
| 921 } | 921 } |
| 922 } | 922 } |
| 923 | 923 |
| 924 activeInterpolationsForTransitions = AnimationStack::activeInterpolations( | 924 activeInterpolationsForTransitions = EffectStack::activeInterpolations( |
| 925 animationStack, &newTransitions, &cancelledAnimations, | 925 effectStack, &newTransitions, &cancelledAnimations, |
| 926 KeyframeEffectReadOnly::TransitionPriority, isStylePropertyHandle); | 926 KeyframeEffectReadOnly::TransitionPriority, isStylePropertyHandle); |
| 927 } | 927 } |
| 928 | 928 |
| 929 // Properties being animated by animations don't get values from transitions | 929 // Properties being animated by animations don't get values from transitions |
| 930 // applied. | 930 // applied. |
| 931 if (!update.activeInterpolationsForAnimations().isEmpty() && | 931 if (!update.activeInterpolationsForAnimations().isEmpty() && |
| 932 !activeInterpolationsForTransitions.isEmpty()) { | 932 !activeInterpolationsForTransitions.isEmpty()) { |
| 933 for (const auto& entry : update.activeInterpolationsForAnimations()) | 933 for (const auto& entry : update.activeInterpolationsForAnimations()) |
| 934 activeInterpolationsForTransitions.remove(entry.key); | 934 activeInterpolationsForTransitions.remove(entry.key); |
| 935 } | 935 } |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1094 return toShadowRoot(treeScope.rootNode()).host() == element; | 1094 return toShadowRoot(treeScope.rootNode()).host() == element; |
| 1095 } | 1095 } |
| 1096 | 1096 |
| 1097 DEFINE_TRACE(CSSAnimations) { | 1097 DEFINE_TRACE(CSSAnimations) { |
| 1098 visitor->trace(m_transitions); | 1098 visitor->trace(m_transitions); |
| 1099 visitor->trace(m_pendingUpdate); | 1099 visitor->trace(m_pendingUpdate); |
| 1100 visitor->trace(m_runningAnimations); | 1100 visitor->trace(m_runningAnimations); |
| 1101 } | 1101 } |
| 1102 | 1102 |
| 1103 } // namespace blink | 1103 } // namespace blink |
| OLD | NEW |