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

Side by Side Diff: Source/core/animation/AnimationStack.cpp

Issue 194673002: Web Animations: Refactor KeyframeEffectModel to work via an InterpolationEffect. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@interpolationWrap
Patch Set: Created 6 years, 9 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
« no previous file with comments | « Source/core/animation/AnimationStack.h ('k') | Source/core/animation/DocumentTimelineTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 12 matching lines...) Expand all
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 #include "config.h" 31 #include "config.h"
32 #include "core/animation/AnimationStack.h" 32 #include "core/animation/AnimationStack.h"
33 #include "core/animation/Interpolation.h"
33 34
34 #include "core/animation/css/CSSAnimations.h" 35 #include "core/animation/css/CSSAnimations.h"
35 36
36 namespace WebCore { 37 namespace WebCore {
37 38
38 namespace { 39 namespace {
39 40
40 void copyToCompositableValueMap(const AnimationEffect::CompositableValueList* so urce, AnimationEffect::CompositableValueMap& target) 41 void copyToActiveInterpolationMap(const Vector<RefPtr<WebCore::Interpolation> >& source, HashMap<CSSPropertyID, RefPtr<WebCore::Interpolation> >& target)
41 { 42 {
42 if (!source) 43 for (Vector<RefPtr<WebCore::Interpolation> >::const_iterator iter = source.b egin(); iter != source.end(); ++iter) {
43 return; 44 RefPtr<WebCore::Interpolation> interpolation = *iter;
44 for (AnimationEffect::CompositableValueList::const_iterator iter = source->b egin(); iter != source->end(); ++iter) 45 WebCore::StyleInterpolation *styleInterpolation = toStyleInterpolation(i nterpolation.get());
45 target.set(iter->first, iter->second); 46 target.set(styleInterpolation->id(), styleInterpolation);
47 }
46 } 48 }
47 49
48 } // namespace 50 } // namespace
49 51
50 bool AnimationStack::affects(CSSPropertyID property) const 52 bool AnimationStack::affects(CSSPropertyID property) const
51 { 53 {
52 for (size_t i = 0; i < m_activeAnimations.size(); ++i) { 54 for (size_t i = 0; i < m_activeAnimations.size(); ++i) {
53 if (m_activeAnimations[i]->affects(property)) 55 if (m_activeAnimations[i]->affects(property))
54 return true; 56 return true;
55 } 57 }
56 return false; 58 return false;
57 } 59 }
58 60
59 bool AnimationStack::hasActiveAnimationsOnCompositor(CSSPropertyID property) con st 61 bool AnimationStack::hasActiveAnimationsOnCompositor(CSSPropertyID property) con st
60 { 62 {
61 for (size_t i = 0; i < m_activeAnimations.size(); ++i) { 63 for (size_t i = 0; i < m_activeAnimations.size(); ++i) {
62 if (m_activeAnimations[i]->hasActiveAnimationsOnCompositor(property)) 64 if (m_activeAnimations[i]->hasActiveAnimationsOnCompositor(property))
63 return true; 65 return true;
64 } 66 }
65 return false; 67 return false;
66 } 68 }
67 69
68 AnimationEffect::CompositableValueMap AnimationStack::compositableValues(const A nimationStack* animationStack, const Vector<InertAnimation*>* newAnimations, con st HashSet<const AnimationPlayer*>* cancelledAnimationPlayers, Animation::Priori ty priority) 70 HashMap<CSSPropertyID, RefPtr<Interpolation> > AnimationStack::activeInterpolati ons(const AnimationStack* animationStack, const Vector<InertAnimation*>* newAnim ations, const HashSet<const AnimationPlayer*>* cancelledAnimationPlayers, Animat ion::Priority priority)
69 { 71 {
70 AnimationEffect::CompositableValueMap result; 72 HashMap<CSSPropertyID, RefPtr<Interpolation> > result;
71 73
72 if (animationStack) { 74 if (animationStack) {
73 const Vector<Animation*>& animations = animationStack->m_activeAnimation s; 75 const Vector<Animation*>& animations = animationStack->m_activeAnimation s;
74 for (size_t i = 0; i < animations.size(); ++i) { 76 for (size_t i = 0; i < animations.size(); ++i) {
75 Animation* animation = animations[i]; 77 Animation* animation = animations[i];
76 if (animation->priority() != priority) 78 if (animation->priority() != priority)
77 continue; 79 continue;
78 if (cancelledAnimationPlayers && cancelledAnimationPlayers->contains (animation->player())) 80 if (cancelledAnimationPlayers && cancelledAnimationPlayers->contains (animation->player()))
79 continue; 81 continue;
80 copyToCompositableValueMap(animation->compositableValues(), result); 82 copyToActiveInterpolationMap(animation->activeInterpolations(), resu lt);
81 } 83 }
82 } 84 }
83 85
84 if (newAnimations) { 86 if (newAnimations) {
85 for (size_t i = 0; i < newAnimations->size(); ++i) 87 for (size_t i = 0; i < newAnimations->size(); ++i) {
86 copyToCompositableValueMap(newAnimations->at(i)->sample().get(), res ult); 88 OwnPtr<Vector<RefPtr<Interpolation> > > sample = newAnimations->at(i )->sample();
89 if (sample) {
90 copyToActiveInterpolationMap(*sample, result);
91 }
92 }
87 } 93 }
88 94
89 return result; 95 return result;
90 } 96 }
91 97
92 } // namespace WebCore 98 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/animation/AnimationStack.h ('k') | Source/core/animation/DocumentTimelineTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698