| 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 namespace { | 42 namespace { |
| 43 | 43 |
| 44 void copyToActiveInterpolationMap(const WillBeHeapVector<RefPtrWillBeMember<WebC
ore::Interpolation> >& source, WillBeHeapHashMap<CSSPropertyID, RefPtrWillBeMemb
er<WebCore::Interpolation> >& target) | 44 void copyToActiveInterpolationMap(const WillBeHeapVector<RefPtrWillBeMember<WebC
ore::Interpolation> >& source, WillBeHeapHashMap<CSSPropertyID, RefPtrWillBeMemb
er<WebCore::Interpolation> >& target) |
| 45 { | 45 { |
| 46 for (size_t i = 0; i < source.size(); ++i) { | 46 for (size_t i = 0; i < source.size(); ++i) { |
| 47 Interpolation* interpolation = source[i].get(); | 47 Interpolation* interpolation = source[i].get(); |
| 48 target.set(toStyleInterpolation(interpolation)->id(), interpolation); | 48 target.set(toStyleInterpolation(interpolation)->id(), interpolation); |
| 49 } | 49 } |
| 50 } | 50 } |
| 51 | 51 |
| 52 bool compareEffects(const OwnPtr<SampledEffect>& effect1, const OwnPtr<SampledEf
fect>& effect2) | 52 bool compareEffects(const OwnPtrWillBeMember<SampledEffect>& effect1, const OwnP
trWillBeMember<SampledEffect>& effect2) |
| 53 { | 53 { |
| 54 ASSERT(effect1 && effect2); | 54 ASSERT(effect1 && effect2); |
| 55 return effect1->sortInfo() < effect2->sortInfo(); | 55 return effect1->sortInfo() < effect2->sortInfo(); |
| 56 } | 56 } |
| 57 | 57 |
| 58 void copyNewAnimationsToActiveInterpolationMap(const Vector<InertAnimation*>& ne
wAnimations, WillBeHeapHashMap<CSSPropertyID, RefPtrWillBeMember<Interpolation>
>& result) | 58 void copyNewAnimationsToActiveInterpolationMap(const WillBeHeapVector<RawPtrWill
BeMember<InertAnimation> >& newAnimations, WillBeHeapHashMap<CSSPropertyID, RefP
trWillBeMember<Interpolation> >& result) |
| 59 { | 59 { |
| 60 for (size_t i = 0; i < newAnimations.size(); ++i) { | 60 for (size_t i = 0; i < newAnimations.size(); ++i) { |
| 61 OwnPtrWillBeRawPtr<WillBeHeapVector<RefPtrWillBeMember<Interpolation> >
> sample = newAnimations[i]->sample(0); | 61 OwnPtrWillBeRawPtr<WillBeHeapVector<RefPtrWillBeMember<Interpolation> >
> sample = newAnimations[i]->sample(0); |
| 62 if (sample) { | 62 if (sample) { |
| 63 copyToActiveInterpolationMap(*sample, result); | 63 copyToActiveInterpolationMap(*sample, result); |
| 64 } | 64 } |
| 65 } | 65 } |
| 66 } | 66 } |
| 67 | 67 |
| 68 } // namespace | 68 } // namespace |
| (...skipping 13 matching lines...) Expand all Loading... |
| 82 | 82 |
| 83 bool AnimationStack::hasActiveAnimationsOnCompositor(CSSPropertyID property) con
st | 83 bool AnimationStack::hasActiveAnimationsOnCompositor(CSSPropertyID property) con
st |
| 84 { | 84 { |
| 85 for (size_t i = 0; i < m_effects.size(); ++i) { | 85 for (size_t i = 0; i < m_effects.size(); ++i) { |
| 86 if (m_effects[i]->animation() && m_effects[i]->animation()->hasActiveAni
mationsOnCompositor(property)) | 86 if (m_effects[i]->animation() && m_effects[i]->animation()->hasActiveAni
mationsOnCompositor(property)) |
| 87 return true; | 87 return true; |
| 88 } | 88 } |
| 89 return false; | 89 return false; |
| 90 } | 90 } |
| 91 | 91 |
| 92 WillBeHeapHashMap<CSSPropertyID, RefPtrWillBeMember<Interpolation> > AnimationSt
ack::activeInterpolations(AnimationStack* animationStack, const Vector<InertAnim
ation*>* newAnimations, const HashSet<const AnimationPlayer*>* cancelledAnimatio
nPlayers, Animation::Priority priority, double timelineCurrentTime) | 92 WillBeHeapHashMap<CSSPropertyID, RefPtrWillBeMember<Interpolation> > AnimationSt
ack::activeInterpolations(AnimationStack* animationStack, const WillBeHeapVector
<RawPtrWillBeMember<InertAnimation> >* newAnimations, const HashSet<const Animat
ionPlayer*>* cancelledAnimationPlayers, Animation::Priority priority, double tim
elineCurrentTime) |
| 93 { | 93 { |
| 94 // We don't exactly know when new animations will start, but timelineCurrent
Time is a good estimate. | 94 // We don't exactly know when new animations will start, but timelineCurrent
Time is a good estimate. |
| 95 | 95 |
| 96 WillBeHeapHashMap<CSSPropertyID, RefPtrWillBeMember<Interpolation> > result; | 96 WillBeHeapHashMap<CSSPropertyID, RefPtrWillBeMember<Interpolation> > result; |
| 97 | 97 |
| 98 if (animationStack) { | 98 if (animationStack) { |
| 99 Vector<OwnPtr<SampledEffect> >& effects = animationStack->m_effects; | 99 WillBeHeapVector<OwnPtrWillBeMember<SampledEffect> >& effects = animatio
nStack->m_effects; |
| 100 // std::sort doesn't work with OwnPtrs | 100 // std::sort doesn't work with OwnPtrs |
| 101 nonCopyingSort(effects.begin(), effects.end(), compareEffects); | 101 nonCopyingSort(effects.begin(), effects.end(), compareEffects); |
| 102 animationStack->simplifyEffects(); | 102 animationStack->simplifyEffects(); |
| 103 for (size_t i = 0; i < effects.size(); ++i) { | 103 for (size_t i = 0; i < effects.size(); ++i) { |
| 104 const SampledEffect& effect = *effects[i]; | 104 const SampledEffect& effect = *effects[i]; |
| 105 if (effect.priority() != priority || (cancelledAnimationPlayers && e
ffect.animation() && cancelledAnimationPlayers->contains(effect.animation()->pla
yer()))) | 105 if (effect.priority() != priority || (cancelledAnimationPlayers && e
ffect.animation() && cancelledAnimationPlayers->contains(effect.animation()->pla
yer()))) |
| 106 continue; | 106 continue; |
| 107 if (newAnimations && effect.sortInfo().startTime() > timelineCurrent
Time) { | 107 if (newAnimations && effect.sortInfo().startTime() > timelineCurrent
Time) { |
| 108 copyNewAnimationsToActiveInterpolationMap(*newAnimations, result
); | 108 copyNewAnimationsToActiveInterpolationMap(*newAnimations, result
); |
| 109 newAnimations = 0; | 109 newAnimations = 0; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 128 effect.removeReplacedInterpolationsIfNeeded(replacedProperties); | 128 effect.removeReplacedInterpolationsIfNeeded(replacedProperties); |
| 129 if (!effect.canChange()) { | 129 if (!effect.canChange()) { |
| 130 for (size_t i = 0; i < effect.interpolations().size(); ++i) | 130 for (size_t i = 0; i < effect.interpolations().size(); ++i) |
| 131 replacedProperties.set(toStyleInterpolation(effect.interpolation
s()[i].get())->id()); | 131 replacedProperties.set(toStyleInterpolation(effect.interpolation
s()[i].get())->id()); |
| 132 } | 132 } |
| 133 } | 133 } |
| 134 | 134 |
| 135 size_t dest = 0; | 135 size_t dest = 0; |
| 136 for (size_t i = 0; i < m_effects.size(); ++i) { | 136 for (size_t i = 0; i < m_effects.size(); ++i) { |
| 137 if (!m_effects[i]->interpolations().isEmpty()) { | 137 if (!m_effects[i]->interpolations().isEmpty()) { |
| 138 swap(m_effects[dest++], m_effects[i]); | 138 m_effects[dest++].swap(m_effects[i]); |
| 139 continue; | 139 continue; |
| 140 } | 140 } |
| 141 if (m_effects[i]->animation()) | 141 if (m_effects[i]->animation()) |
| 142 m_effects[i]->animation()->notifySampledEffectRemovedFromAnimationSt
ack(); | 142 m_effects[i]->animation()->notifySampledEffectRemovedFromAnimationSt
ack(); |
| 143 } | 143 } |
| 144 m_effects.shrink(dest); | 144 m_effects.shrink(dest); |
| 145 } | 145 } |
| 146 | 146 |
| 147 void AnimationStack::trace(Visitor* visitor) |
| 148 { |
| 149 visitor->trace(m_effects); |
| 150 } |
| 151 |
| 147 } // namespace WebCore | 152 } // namespace WebCore |
| OLD | NEW |