Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(835)

Side by Side Diff: third_party/WebKit/Source/core/animation/css/CSSAnimations.cpp

Issue 2394993002: Move Priority enum/field to KeyframeEffectReadOnly (Closed)
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 494 matching lines...) Expand 10 before | Expand all | Expand 10 after
505 animation.update(TimingUpdateOnDemand); 505 animation.update(TimingUpdateOnDemand);
506 m_runningAnimations.remove(cancelledIndices[i]); 506 m_runningAnimations.remove(cancelledIndices[i]);
507 } 507 }
508 508
509 for (const auto& entry : m_pendingUpdate.newAnimations()) { 509 for (const auto& entry : m_pendingUpdate.newAnimations()) {
510 const InertEffect* inertAnimation = entry.effect.get(); 510 const InertEffect* inertAnimation = entry.effect.get();
511 AnimationEventDelegate* eventDelegate = 511 AnimationEventDelegate* eventDelegate =
512 new AnimationEventDelegate(element, entry.name); 512 new AnimationEventDelegate(element, entry.name);
513 KeyframeEffect* effect = KeyframeEffect::create( 513 KeyframeEffect* effect = KeyframeEffect::create(
514 element, inertAnimation->model(), inertAnimation->specifiedTiming(), 514 element, inertAnimation->model(), inertAnimation->specifiedTiming(),
515 KeyframeEffect::DefaultPriority, eventDelegate); 515 KeyframeEffectReadOnly::DefaultPriority, eventDelegate);
516 Animation* animation = element->document().timeline().play(effect); 516 Animation* animation = element->document().timeline().play(effect);
517 animation->setId(entry.name); 517 animation->setId(entry.name);
518 if (inertAnimation->paused()) 518 if (inertAnimation->paused())
519 animation->pause(); 519 animation->pause();
520 animation->update(TimingUpdateOnDemand); 520 animation->update(TimingUpdateOnDemand);
521 521
522 m_runningAnimations.append(new RunningAnimation(animation, entry)); 522 m_runningAnimations.append(new RunningAnimation(animation, entry));
523 } 523 }
524 524
525 // Transitions that are run on the compositor only update main-thread state 525 // Transitions that are run on the compositor only update main-thread state
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
609 newFrames[0]->setPropertyValue( 609 newFrames[0]->setPropertyValue(
610 id, toLegacyStyleInterpolation(sample.at(0).get())->currentValue()); 610 id, toLegacyStyleInterpolation(sample.at(0).get())->currentValue());
611 newFrames[1]->setPropertyValue( 611 newFrames[1]->setPropertyValue(
612 id, toLegacyStyleInterpolation(sample.at(0).get())->currentValue()); 612 id, toLegacyStyleInterpolation(sample.at(0).get())->currentValue());
613 model = AnimatableValueKeyframeEffectModel::create(newFrames); 613 model = AnimatableValueKeyframeEffectModel::create(newFrames);
614 } 614 }
615 } 615 }
616 616
617 KeyframeEffect* transition = KeyframeEffect::create( 617 KeyframeEffect* transition = KeyframeEffect::create(
618 element, model, inertAnimation->specifiedTiming(), 618 element, model, inertAnimation->specifiedTiming(),
619 KeyframeEffect::TransitionPriority, eventDelegate); 619 KeyframeEffectReadOnly::TransitionPriority, eventDelegate);
620 Animation* animation = element->document().timeline().play(transition); 620 Animation* animation = element->document().timeline().play(transition);
621 animation->setId(getPropertyName(newTransition.id)); 621 animation->setId(getPropertyName(newTransition.id));
622 // Set the current time as the start time for retargeted transitions 622 // Set the current time as the start time for retargeted transitions
623 if (retargetedCompositorTransitions.contains(id)) 623 if (retargetedCompositorTransitions.contains(id))
624 animation->setStartTime(element->document().timeline().currentTime()); 624 animation->setStartTime(element->document().timeline().currentTime());
625 animation->update(TimingUpdateOnDemand); 625 animation->update(TimingUpdateOnDemand);
626 runningTransition.animation = animation; 626 runningTransition.animation = animation;
627 m_transitions.set(id, runningTransition); 627 m_transitions.set(id, runningTransition);
628 DCHECK_NE(id, CSSPropertyInvalid); 628 DCHECK_NE(id, CSSPropertyInvalid);
629 629
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
850 CSSAnimationUpdate& update, 850 CSSAnimationUpdate& update,
851 const Element* animatingElement) { 851 const Element* animatingElement) {
852 ElementAnimations* elementAnimations = 852 ElementAnimations* elementAnimations =
853 animatingElement ? animatingElement->elementAnimations() : nullptr; 853 animatingElement ? animatingElement->elementAnimations() : nullptr;
854 AnimationStack* animationStack = 854 AnimationStack* animationStack =
855 elementAnimations ? &elementAnimations->animationStack() : nullptr; 855 elementAnimations ? &elementAnimations->animationStack() : nullptr;
856 856
857 if (update.newAnimations().isEmpty() && 857 if (update.newAnimations().isEmpty() &&
858 update.suppressedAnimations().isEmpty()) { 858 update.suppressedAnimations().isEmpty()) {
859 ActiveInterpolationsMap activeInterpolationsForAnimations( 859 ActiveInterpolationsMap activeInterpolationsForAnimations(
860 AnimationStack::activeInterpolations(animationStack, nullptr, nullptr, 860 AnimationStack::activeInterpolations(
861 KeyframeEffect::DefaultPriority, 861 animationStack, nullptr, nullptr,
862 isStylePropertyHandle)); 862 KeyframeEffectReadOnly::DefaultPriority, isStylePropertyHandle));
863 update.adoptActiveInterpolationsForAnimations( 863 update.adoptActiveInterpolationsForAnimations(
864 activeInterpolationsForAnimations); 864 activeInterpolationsForAnimations);
865 return; 865 return;
866 } 866 }
867 867
868 HeapVector<Member<const InertEffect>> newEffects; 868 HeapVector<Member<const InertEffect>> newEffects;
869 for (const auto& newAnimation : update.newAnimations()) 869 for (const auto& newAnimation : update.newAnimations())
870 newEffects.append(newAnimation.effect); 870 newEffects.append(newAnimation.effect);
871 871
872 // Animations with updates use a temporary InertEffect for the current frame. 872 // Animations with updates use a temporary InertEffect for the current frame.
873 for (const auto& updatedAnimation : update.animationsWithUpdates()) 873 for (const auto& updatedAnimation : update.animationsWithUpdates())
874 newEffects.append(updatedAnimation.effect); 874 newEffects.append(updatedAnimation.effect);
875 875
876 ActiveInterpolationsMap activeInterpolationsForAnimations( 876 ActiveInterpolationsMap activeInterpolationsForAnimations(
877 AnimationStack::activeInterpolations( 877 AnimationStack::activeInterpolations(
878 animationStack, &newEffects, &update.suppressedAnimations(), 878 animationStack, &newEffects, &update.suppressedAnimations(),
879 KeyframeEffect::DefaultPriority, isStylePropertyHandle)); 879 KeyframeEffectReadOnly::DefaultPriority, isStylePropertyHandle));
880 update.adoptActiveInterpolationsForAnimations( 880 update.adoptActiveInterpolationsForAnimations(
881 activeInterpolationsForAnimations); 881 activeInterpolationsForAnimations);
882 } 882 }
883 883
884 void CSSAnimations::calculateTransitionActiveInterpolations( 884 void CSSAnimations::calculateTransitionActiveInterpolations(
885 CSSAnimationUpdate& update, 885 CSSAnimationUpdate& update,
886 const Element* animatingElement) { 886 const Element* animatingElement) {
887 ElementAnimations* elementAnimations = 887 ElementAnimations* elementAnimations =
888 animatingElement ? animatingElement->elementAnimations() : nullptr; 888 animatingElement ? animatingElement->elementAnimations() : nullptr;
889 AnimationStack* animationStack = 889 AnimationStack* animationStack =
890 elementAnimations ? &elementAnimations->animationStack() : nullptr; 890 elementAnimations ? &elementAnimations->animationStack() : nullptr;
891 891
892 ActiveInterpolationsMap activeInterpolationsForTransitions; 892 ActiveInterpolationsMap activeInterpolationsForTransitions;
893 if (update.newTransitions().isEmpty() && 893 if (update.newTransitions().isEmpty() &&
894 update.cancelledTransitions().isEmpty()) { 894 update.cancelledTransitions().isEmpty()) {
895 activeInterpolationsForTransitions = AnimationStack::activeInterpolations( 895 activeInterpolationsForTransitions = AnimationStack::activeInterpolations(
896 animationStack, nullptr, nullptr, KeyframeEffect::TransitionPriority, 896 animationStack, nullptr, nullptr,
897 isStylePropertyHandle); 897 KeyframeEffectReadOnly::TransitionPriority, isStylePropertyHandle);
898 } else { 898 } else {
899 HeapVector<Member<const InertEffect>> newTransitions; 899 HeapVector<Member<const InertEffect>> newTransitions;
900 for (const auto& entry : update.newTransitions()) 900 for (const auto& entry : update.newTransitions())
901 newTransitions.append(entry.value.effect.get()); 901 newTransitions.append(entry.value.effect.get());
902 902
903 HeapHashSet<Member<const Animation>> cancelledAnimations; 903 HeapHashSet<Member<const Animation>> cancelledAnimations;
904 if (!update.cancelledTransitions().isEmpty()) { 904 if (!update.cancelledTransitions().isEmpty()) {
905 DCHECK(elementAnimations); 905 DCHECK(elementAnimations);
906 const TransitionMap& transitionMap = 906 const TransitionMap& transitionMap =
907 elementAnimations->cssAnimations().m_transitions; 907 elementAnimations->cssAnimations().m_transitions;
908 for (CSSPropertyID id : update.cancelledTransitions()) { 908 for (CSSPropertyID id : update.cancelledTransitions()) {
909 DCHECK(transitionMap.contains(id)); 909 DCHECK(transitionMap.contains(id));
910 cancelledAnimations.add(transitionMap.get(id).animation.get()); 910 cancelledAnimations.add(transitionMap.get(id).animation.get());
911 } 911 }
912 } 912 }
913 913
914 activeInterpolationsForTransitions = AnimationStack::activeInterpolations( 914 activeInterpolationsForTransitions = AnimationStack::activeInterpolations(
915 animationStack, &newTransitions, &cancelledAnimations, 915 animationStack, &newTransitions, &cancelledAnimations,
916 KeyframeEffect::TransitionPriority, isStylePropertyHandle); 916 KeyframeEffectReadOnly::TransitionPriority, isStylePropertyHandle);
917 } 917 }
918 918
919 // Properties being animated by animations don't get values from transitions 919 // Properties being animated by animations don't get values from transitions
920 // applied. 920 // applied.
921 if (!update.activeInterpolationsForAnimations().isEmpty() && 921 if (!update.activeInterpolationsForAnimations().isEmpty() &&
922 !activeInterpolationsForTransitions.isEmpty()) { 922 !activeInterpolationsForTransitions.isEmpty()) {
923 for (const auto& entry : update.activeInterpolationsForAnimations()) 923 for (const auto& entry : update.activeInterpolationsForAnimations())
924 activeInterpolationsForTransitions.remove(entry.key); 924 activeInterpolationsForTransitions.remove(entry.key);
925 } 925 }
926 update.adoptActiveInterpolationsForTransitions( 926 update.adoptActiveInterpolationsForTransitions(
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
1084 return toShadowRoot(treeScope.rootNode()).host() == element; 1084 return toShadowRoot(treeScope.rootNode()).host() == element;
1085 } 1085 }
1086 1086
1087 DEFINE_TRACE(CSSAnimations) { 1087 DEFINE_TRACE(CSSAnimations) {
1088 visitor->trace(m_transitions); 1088 visitor->trace(m_transitions);
1089 visitor->trace(m_pendingUpdate); 1089 visitor->trace(m_pendingUpdate);
1090 visitor->trace(m_runningAnimations); 1090 visitor->trace(m_runningAnimations);
1091 } 1091 }
1092 1092
1093 } // namespace blink 1093 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/animation/SampledEffect.h ('k') | third_party/WebKit/Source/core/svg/SVGElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698