Chromium Code Reviews| 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 24 matching lines...) Expand all Loading... | |
| 35 #include "core/animation/StyleInterpolation.h" | 35 #include "core/animation/StyleInterpolation.h" |
| 36 #include "core/animation/css/CSSAnimations.h" | 36 #include "core/animation/css/CSSAnimations.h" |
| 37 #include "wtf/BitArray.h" | 37 #include "wtf/BitArray.h" |
| 38 #include "wtf/NonCopyingSort.h" | 38 #include "wtf/NonCopyingSort.h" |
| 39 #include <algorithm> | 39 #include <algorithm> |
| 40 | 40 |
| 41 namespace blink { | 41 namespace blink { |
| 42 | 42 |
| 43 namespace { | 43 namespace { |
| 44 | 44 |
| 45 void copyToActiveInterpolationMap(const WillBeHeapVector<RefPtrWillBeMember<blin k::Interpolation> >& source, WillBeHeapHashMap<CSSPropertyID, RefPtrWillBeMember <blink::Interpolation> >& target) | 45 void copyToActiveInterpolationMap(const WillBeHeapVector<RefPtrWillBeMember<blin k::Interpolation>>& source, InterpolationPipelineMap& target) |
| 46 { | 46 { |
| 47 for (const auto& interpolation : source) { | 47 for (const auto& interpolation : source) { |
| 48 target.set(toStyleInterpolation(interpolation.get())->id(), interpolatio n.get()); | 48 CSSPropertyID property = toStyleInterpolation(interpolation.get())->id() ; |
| 49 | |
| 50 if (!target.contains(property)) | |
| 51 target.set(property, InterpolationPipeline()); | |
| 52 | |
| 53 InterpolationPipelineMap::iterator it = target.find(property); | |
| 54 InterpolationPipeline& pipeline = it->value; | |
| 55 | |
| 56 // Flush pipeline for a replace -> replace interpolation | |
| 57 if (!pipeline.isEmpty() && interpolation->isReplaceOnly()) | |
|
alancutter (OOO until 2018)
2015/02/17 03:50:56
This should be checking for cachedUnderlyingFracti
| |
| 58 pipeline.clear(); | |
| 59 | |
| 60 pipeline.append(interpolation); | |
| 49 } | 61 } |
| 50 } | 62 } |
| 51 | 63 |
| 52 bool compareEffects(const OwnPtrWillBeMember<SampledEffect>& effect1, const OwnP trWillBeMember<SampledEffect>& effect2) | 64 bool compareEffects(const OwnPtrWillBeMember<SampledEffect>& effect1, const OwnP trWillBeMember<SampledEffect>& effect2) |
| 53 { | 65 { |
| 54 ASSERT(effect1 && effect2); | 66 ASSERT(effect1 && effect2); |
| 55 return effect1->sequenceNumber() < effect2->sequenceNumber(); | 67 return effect1->sequenceNumber() < effect2->sequenceNumber(); |
| 56 } | 68 } |
| 57 | 69 |
| 58 void copyNewAnimationsToActiveInterpolationMap(const WillBeHeapVector<RawPtrWill BeMember<InertAnimation> >& newAnimations, WillBeHeapHashMap<CSSPropertyID, RefP trWillBeMember<Interpolation> >& result) | 70 void copyNewAnimationsToActiveInterpolationMap(const WillBeHeapVector<RawPtrWill BeMember<InertAnimation>>& newAnimations, InterpolationPipelineMap& result) |
| 59 { | 71 { |
| 60 for (const auto& newAnimation : newAnimations) { | 72 for (const auto& newAnimation : newAnimations) { |
| 61 OwnPtrWillBeRawPtr<WillBeHeapVector<RefPtrWillBeMember<Interpolation>>> sample = nullptr; | 73 OwnPtrWillBeRawPtr<WillBeHeapVector<RefPtrWillBeMember<Interpolation>>> sample = nullptr; |
| 62 newAnimation->sample(sample); | 74 newAnimation->sample(sample); |
| 63 if (sample) | 75 if (sample) |
| 64 copyToActiveInterpolationMap(*sample, result); | 76 copyToActiveInterpolationMap(*sample, result); |
| 65 } | 77 } |
| 66 } | 78 } |
| 67 | 79 |
| 68 } // namespace | 80 } // namespace |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 82 | 94 |
| 83 bool AnimationStack::hasActiveAnimationsOnCompositor(CSSPropertyID property) con st | 95 bool AnimationStack::hasActiveAnimationsOnCompositor(CSSPropertyID property) con st |
| 84 { | 96 { |
| 85 for (const auto& effect : m_effects) { | 97 for (const auto& effect : m_effects) { |
| 86 if (effect->animation() && effect->animation()->hasActiveAnimationsOnCom positor(property)) | 98 if (effect->animation() && effect->animation()->hasActiveAnimationsOnCom positor(property)) |
| 87 return true; | 99 return true; |
| 88 } | 100 } |
| 89 return false; | 101 return false; |
| 90 } | 102 } |
| 91 | 103 |
| 92 WillBeHeapHashMap<CSSPropertyID, RefPtrWillBeMember<Interpolation> > AnimationSt ack::activeInterpolations(AnimationStack* animationStack, const WillBeHeapVector <RawPtrWillBeMember<InertAnimation> >* newAnimations, const WillBeHeapHashSet<Ra wPtrWillBeMember<const AnimationPlayer> >* suppressedAnimationPlayers, Animation ::Priority priority, double timelineCurrentTime) | 104 InterpolationPipelineMap AnimationStack::activeInterpolations(AnimationStack* an imationStack, const WillBeHeapVector<RawPtrWillBeMember<InertAnimation>>* newAni mations, const WillBeHeapHashSet<RawPtrWillBeMember<const AnimationPlayer>>* sup pressedAnimationPlayers, Animation::Priority priority, double timelineCurrentTim e) |
| 93 { | 105 { |
| 94 // We don't exactly know when new animations will start, but timelineCurrent Time is a good estimate. | 106 // We don't exactly know when new animations will start, but timelineCurrent Time is a good estimate. |
| 95 | 107 |
| 96 WillBeHeapHashMap<CSSPropertyID, RefPtrWillBeMember<Interpolation> > result; | 108 InterpolationPipelineMap result; |
| 97 | 109 |
| 98 if (animationStack) { | 110 if (animationStack) { |
| 99 WillBeHeapVector<OwnPtrWillBeMember<SampledEffect> >& effects = animatio nStack->m_effects; | 111 WillBeHeapVector<OwnPtrWillBeMember<SampledEffect>>& effects = animation Stack->m_effects; |
| 100 // std::sort doesn't work with OwnPtrs | 112 // std::sort doesn't work with OwnPtrs |
| 101 nonCopyingSort(effects.begin(), effects.end(), compareEffects); | 113 nonCopyingSort(effects.begin(), effects.end(), compareEffects); |
| 102 animationStack->simplifyEffects(); | 114 animationStack->simplifyEffects(); |
| 103 for (const auto& effect : effects) { | 115 for (const auto& effect : effects) { |
| 104 if (effect->priority() != priority || (suppressedAnimationPlayers && effect->animation() && suppressedAnimationPlayers->contains(effect->animation() ->player()))) | 116 if (effect->priority() != priority || (suppressedAnimationPlayers && effect->animation() && suppressedAnimationPlayers->contains(effect->animation() ->player()))) |
| 105 continue; | 117 continue; |
| 106 copyToActiveInterpolationMap(effect->interpolations(), result); | 118 copyToActiveInterpolationMap(effect->interpolations(), result); |
| 107 } | 119 } |
| 108 } | 120 } |
| 109 | 121 |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 159 FloatBox expandingBox(originalBox); | 171 FloatBox expandingBox(originalBox); |
| 160 if (!CompositorAnimations::instance()->getAnimatedBoundingBox(expand ingBox, *anim->effect(), startRange, endRange)) | 172 if (!CompositorAnimations::instance()->getAnimatedBoundingBox(expand ingBox, *anim->effect(), startRange, endRange)) |
| 161 return false; | 173 return false; |
| 162 box.expandTo(expandingBox); | 174 box.expandTo(expandingBox); |
| 163 } | 175 } |
| 164 } | 176 } |
| 165 return true; | 177 return true; |
| 166 } | 178 } |
| 167 | 179 |
| 168 } // namespace blink | 180 } // namespace blink |
| OLD | NEW |