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 20 matching lines...) Expand all Loading... |
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 #include "core/animation/Interpolation.h" |
34 | 34 |
35 #include "core/animation/css/CSSAnimations.h" | 35 #include "core/animation/css/CSSAnimations.h" |
36 | 36 |
37 namespace WebCore { | 37 namespace WebCore { |
38 | 38 |
39 namespace { | 39 namespace { |
40 | 40 |
41 void copyToActiveInterpolationMap(const Vector<RefPtr<WebCore::Interpolation> >&
source, HashMap<CSSPropertyID, RefPtr<WebCore::Interpolation> >& target) | 41 void copyToActiveInterpolationMap(const WillBeHeapVector<RefPtrWillBeMember<WebC
ore::Interpolation> >& source, WillBeHeapHashMap<CSSPropertyID, RefPtrWillBeMemb
er<WebCore::Interpolation> >& target) |
42 { | 42 { |
43 for (Vector<RefPtr<WebCore::Interpolation> >::const_iterator iter = source.b
egin(); iter != source.end(); ++iter) { | 43 for (WillBeHeapVector<RefPtrWillBeMember<WebCore::Interpolation> >::const_it
erator iter = source.begin(); iter != source.end(); ++iter) { |
44 RefPtr<WebCore::Interpolation> interpolation = *iter; | 44 RefPtrWillBeRawPtr<WebCore::Interpolation> interpolation = *iter; |
45 WebCore::StyleInterpolation *styleInterpolation = toStyleInterpolation(i
nterpolation.get()); | 45 WebCore::StyleInterpolation *styleInterpolation = toStyleInterpolation(i
nterpolation.get()); |
46 target.set(styleInterpolation->id(), styleInterpolation); | 46 target.set(styleInterpolation->id(), styleInterpolation); |
47 } | 47 } |
48 } | 48 } |
49 | 49 |
50 } // namespace | 50 } // namespace |
51 | 51 |
52 bool AnimationStack::affects(CSSPropertyID property) const | 52 bool AnimationStack::affects(CSSPropertyID property) const |
53 { | 53 { |
54 for (size_t i = 0; i < m_activeAnimations.size(); ++i) { | 54 for (size_t i = 0; i < m_activeAnimations.size(); ++i) { |
55 if (m_activeAnimations[i]->affects(property)) | 55 if (m_activeAnimations[i]->affects(property)) |
56 return true; | 56 return true; |
57 } | 57 } |
58 return false; | 58 return false; |
59 } | 59 } |
60 | 60 |
61 bool AnimationStack::hasActiveAnimationsOnCompositor(CSSPropertyID property) con
st | 61 bool AnimationStack::hasActiveAnimationsOnCompositor(CSSPropertyID property) con
st |
62 { | 62 { |
63 for (size_t i = 0; i < m_activeAnimations.size(); ++i) { | 63 for (size_t i = 0; i < m_activeAnimations.size(); ++i) { |
64 if (m_activeAnimations[i]->hasActiveAnimationsOnCompositor(property)) | 64 if (m_activeAnimations[i]->hasActiveAnimationsOnCompositor(property)) |
65 return true; | 65 return true; |
66 } | 66 } |
67 return false; | 67 return false; |
68 } | 68 } |
69 | 69 |
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) | 70 WillBeHeapHashMap<CSSPropertyID, RefPtrWillBeMember<Interpolation> > AnimationSt
ack::activeInterpolations(const AnimationStack* animationStack, const Vector<Ine
rtAnimation*>* newAnimations, const HashSet<const AnimationPlayer*>* cancelledAn
imationPlayers, Animation::Priority priority) |
71 { | 71 { |
72 HashMap<CSSPropertyID, RefPtr<Interpolation> > result; | 72 WillBeHeapHashMap<CSSPropertyID, RefPtrWillBeMember<Interpolation> > result; |
73 | 73 |
74 if (animationStack) { | 74 if (animationStack) { |
75 const Vector<Animation*>& animations = animationStack->m_activeAnimation
s; | 75 const Vector<Animation*>& animations = animationStack->m_activeAnimation
s; |
76 for (size_t i = 0; i < animations.size(); ++i) { | 76 for (size_t i = 0; i < animations.size(); ++i) { |
77 Animation* animation = animations[i]; | 77 Animation* animation = animations[i]; |
78 if (animation->priority() != priority) | 78 if (animation->priority() != priority) |
79 continue; | 79 continue; |
80 if (cancelledAnimationPlayers && cancelledAnimationPlayers->contains
(animation->player())) | 80 if (cancelledAnimationPlayers && cancelledAnimationPlayers->contains
(animation->player())) |
81 continue; | 81 continue; |
82 copyToActiveInterpolationMap(animation->activeInterpolations(), resu
lt); | 82 copyToActiveInterpolationMap(animation->activeInterpolations(), resu
lt); |
83 } | 83 } |
84 } | 84 } |
85 | 85 |
86 if (newAnimations) { | 86 if (newAnimations) { |
87 for (size_t i = 0; i < newAnimations->size(); ++i) { | 87 for (size_t i = 0; i < newAnimations->size(); ++i) { |
88 OwnPtr<Vector<RefPtr<Interpolation> > > sample = newAnimations->at(i
)->sample(); | 88 OwnPtrWillBeRawPtr<WillBeHeapVector<RefPtrWillBeMember<Interpolation
> > > sample = newAnimations->at(i)->sample(); |
89 if (sample) { | 89 if (sample) { |
90 copyToActiveInterpolationMap(*sample, result); | 90 copyToActiveInterpolationMap(*sample, result); |
91 } | 91 } |
92 } | 92 } |
93 } | 93 } |
94 | 94 |
95 return result; | 95 return result; |
96 } | 96 } |
97 | 97 |
98 } // namespace WebCore | 98 } // namespace WebCore |
OLD | NEW |