| 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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 | 67 |
| 68 } // namespace | 68 } // namespace |
| 69 | 69 |
| 70 AnimationStack::AnimationStack() | 70 AnimationStack::AnimationStack() |
| 71 { | 71 { |
| 72 } | 72 } |
| 73 | 73 |
| 74 bool AnimationStack::hasActiveAnimationsOnCompositor(CSSPropertyID property) con
st | 74 bool AnimationStack::hasActiveAnimationsOnCompositor(CSSPropertyID property) con
st |
| 75 { | 75 { |
| 76 for (const auto& effect : m_effects) { | 76 for (const auto& effect : m_effects) { |
| 77 if (effect->animation() && effect->animation()->hasActiveAnimationsOnCom
positor(property)) | 77 if (effect->effect() && effect->effect()->hasActiveAnimationsOnComposito
r(property)) |
| 78 return true; | 78 return true; |
| 79 } | 79 } |
| 80 return false; | 80 return false; |
| 81 } | 81 } |
| 82 | 82 |
| 83 ActiveInterpolationMap AnimationStack::activeInterpolations(AnimationStack* anim
ationStack, const WillBeHeapVector<RawPtrWillBeMember<InertAnimation>>* newAnima
tions, const WillBeHeapHashSet<RawPtrWillBeMember<const AnimationPlayer>>* suppr
essedAnimationPlayers, Animation::Priority priority, double timelineCurrentTime) | 83 ActiveInterpolationMap AnimationStack::activeInterpolations(AnimationStack* anim
ationStack, const WillBeHeapVector<RawPtrWillBeMember<InertAnimation>>* newAnima
tions, const WillBeHeapHashSet<RawPtrWillBeMember<const Animation>>* suppressedA
nimations, KeyframeEffect::Priority priority, double timelineCurrentTime) |
| 84 { | 84 { |
| 85 // We don't exactly know when new animations will start, but timelineCurrent
Time is a good estimate. | 85 // We don't exactly know when new animations will start, but timelineCurrent
Time is a good estimate. |
| 86 | 86 |
| 87 ActiveInterpolationMap result; | 87 ActiveInterpolationMap result; |
| 88 | 88 |
| 89 if (animationStack) { | 89 if (animationStack) { |
| 90 WillBeHeapVector<OwnPtrWillBeMember<SampledEffect>>& effects = animation
Stack->m_effects; | 90 WillBeHeapVector<OwnPtrWillBeMember<SampledEffect>>& effects = animation
Stack->m_effects; |
| 91 // std::sort doesn't work with OwnPtrs | 91 // std::sort doesn't work with OwnPtrs |
| 92 nonCopyingSort(effects.begin(), effects.end(), compareEffects); | 92 nonCopyingSort(effects.begin(), effects.end(), compareEffects); |
| 93 for (const auto& effect : effects) { | 93 for (const auto& effect : effects) { |
| 94 if (effect->priority() != priority || (suppressedAnimationPlayers &&
effect->animation() && suppressedAnimationPlayers->contains(effect->animation()
->player()))) | 94 if (effect->priority() != priority || (suppressedAnimations && effec
t->effect() && suppressedAnimations->contains(effect->effect()->animation()))) |
| 95 continue; | 95 continue; |
| 96 copyToActiveInterpolationMap(effect->interpolations(), result); | 96 copyToActiveInterpolationMap(effect->interpolations(), result); |
| 97 } | 97 } |
| 98 } | 98 } |
| 99 | 99 |
| 100 if (newAnimations) | 100 if (newAnimations) |
| 101 copyNewAnimationsToActiveInterpolationMap(*newAnimations, result); | 101 copyNewAnimationsToActiveInterpolationMap(*newAnimations, result); |
| 102 | 102 |
| 103 return result; | 103 return result; |
| 104 } | 104 } |
| 105 | 105 |
| 106 DEFINE_TRACE(AnimationStack) | 106 DEFINE_TRACE(AnimationStack) |
| 107 { | 107 { |
| 108 visitor->trace(m_effects); | 108 visitor->trace(m_effects); |
| 109 } | 109 } |
| 110 | 110 |
| 111 bool AnimationStack::getAnimatedBoundingBox(FloatBox& box, CSSPropertyID propert
y) const | 111 bool AnimationStack::getAnimatedBoundingBox(FloatBox& box, CSSPropertyID propert
y) const |
| 112 { | 112 { |
| 113 FloatBox originalBox(box); | 113 FloatBox originalBox(box); |
| 114 for (const auto& effect : m_effects) { | 114 for (const auto& sampledEffect : m_effects) { |
| 115 if (effect->animation() && effect->animation()->affects(PropertyHandle(p
roperty))) { | 115 if (sampledEffect->effect() && sampledEffect->effect()->affects(Property
Handle(property))) { |
| 116 Animation* anim = effect->animation(); | 116 KeyframeEffect* effect = sampledEffect->effect(); |
| 117 if (!anim) | 117 const Timing& timing = effect->specifiedTiming(); |
| 118 continue; | |
| 119 const Timing& timing = anim->specifiedTiming(); | |
| 120 double startRange = 0; | 118 double startRange = 0; |
| 121 double endRange = 1; | 119 double endRange = 1; |
| 122 timing.timingFunction->range(&startRange, &endRange); | 120 timing.timingFunction->range(&startRange, &endRange); |
| 123 FloatBox expandingBox(originalBox); | 121 FloatBox expandingBox(originalBox); |
| 124 if (!CompositorAnimations::instance()->getAnimatedBoundingBox(expand
ingBox, *anim->effect(), startRange, endRange)) | 122 if (!CompositorAnimations::instance()->getAnimatedBoundingBox(expand
ingBox, *effect->effect(), startRange, endRange)) |
| 125 return false; | 123 return false; |
| 126 box.expandTo(expandingBox); | 124 box.expandTo(expandingBox); |
| 127 } | 125 } |
| 128 } | 126 } |
| 129 return true; | 127 return true; |
| 130 } | 128 } |
| 131 | 129 |
| 132 } // namespace blink | 130 } // namespace blink |
| OLD | NEW |