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 12 matching lines...) Expand all Loading... |
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 if (!source) |
43 return; | 44 return; |
44 for (AnimationEffect::CompositableValueList::const_iterator iter = source->b
egin(); iter != source->end(); ++iter) | 45 for (Vector<RefPtr<WebCore::Interpolation> >::const_iterator iter = source->
begin(); iter != source->end(); ++iter) { |
45 target.set(iter->first, iter->second); | 46 RefPtr<WebCore::Interpolation> interpolation = *iter; |
| 47 WebCore::StyleInterpolation *styleInterpolation = toStyleInterpolation(i
nterpolation.get()); |
| 48 target.set(styleInterpolation->id(), styleInterpolation); |
| 49 } |
46 } | 50 } |
47 | 51 |
48 } // namespace | 52 } // namespace |
49 | 53 |
50 bool AnimationStack::affects(CSSPropertyID property) const | 54 bool AnimationStack::affects(CSSPropertyID property) const |
51 { | 55 { |
52 for (size_t i = 0; i < m_activeAnimations.size(); ++i) { | 56 for (size_t i = 0; i < m_activeAnimations.size(); ++i) { |
53 if (m_activeAnimations[i]->affects(property)) | 57 if (m_activeAnimations[i]->affects(property)) |
54 return true; | 58 return true; |
55 } | 59 } |
56 return false; | 60 return false; |
57 } | 61 } |
58 | 62 |
59 bool AnimationStack::hasActiveAnimationsOnCompositor(CSSPropertyID property) con
st | 63 bool AnimationStack::hasActiveAnimationsOnCompositor(CSSPropertyID property) con
st |
60 { | 64 { |
61 for (size_t i = 0; i < m_activeAnimations.size(); ++i) { | 65 for (size_t i = 0; i < m_activeAnimations.size(); ++i) { |
62 if (m_activeAnimations[i]->hasActiveAnimationsOnCompositor(property)) | 66 if (m_activeAnimations[i]->hasActiveAnimationsOnCompositor(property)) |
63 return true; | 67 return true; |
64 } | 68 } |
65 return false; | 69 return false; |
66 } | 70 } |
67 | 71 |
68 AnimationEffect::CompositableValueMap AnimationStack::compositableValues(const A
nimationStack* animationStack, const Vector<InertAnimation*>* newAnimations, con
st HashSet<const Player*>* cancelledPlayers, Animation::Priority priority) | 72 HashMap<CSSPropertyID, RefPtr<Interpolation> > AnimationStack::activeInterpolati
ons(const AnimationStack* animationStack, const Vector<InertAnimation*>* newAnim
ations, const HashSet<const Player*>* cancelledPlayers, Animation::Priority prio
rity) |
69 { | 73 { |
70 AnimationEffect::CompositableValueMap result; | 74 HashMap<CSSPropertyID, RefPtr<Interpolation> > result; |
71 | 75 |
72 if (animationStack) { | 76 if (animationStack) { |
73 const Vector<Animation*>& animations = animationStack->m_activeAnimation
s; | 77 const Vector<Animation*>& animations = animationStack->m_activeAnimation
s; |
74 for (size_t i = 0; i < animations.size(); ++i) { | 78 for (size_t i = 0; i < animations.size(); ++i) { |
75 Animation* animation = animations[i]; | 79 Animation* animation = animations[i]; |
76 if (animation->priority() != priority) | 80 if (animation->priority() != priority) |
77 continue; | 81 continue; |
78 if (cancelledPlayers && cancelledPlayers->contains(animation->player
())) | 82 if (cancelledPlayers && cancelledPlayers->contains(animation->player
())) |
79 continue; | 83 continue; |
80 copyToCompositableValueMap(animation->compositableValues(), result); | 84 copyToActiveInterpolationMap(animation->activeInterpolations(), resu
lt); |
81 } | 85 } |
82 } | 86 } |
83 | 87 |
84 if (newAnimations) { | 88 if (newAnimations) { |
85 for (size_t i = 0; i < newAnimations->size(); ++i) | 89 for (size_t i = 0; i < newAnimations->size(); ++i) |
86 copyToCompositableValueMap(newAnimations->at(i)->sample().get(), res
ult); | 90 copyToActiveInterpolationMap(newAnimations->at(i)->sample().get(), r
esult); |
87 } | 91 } |
88 | 92 |
89 return result; | 93 return result; |
90 } | 94 } |
91 | 95 |
92 } // namespace WebCore | 96 } // namespace WebCore |
OLD | NEW |