Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(30)

Side by Side Diff: Source/core/animation/AnimationStack.cpp

Issue 1113173003: Web Animations: Update naming to reflect spec changes (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: No, really. Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/animation/AnimationStack.h ('k') | Source/core/animation/AnimationStackTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 animationStack->removeClearedEffects(); 93 animationStack->removeClearedEffects();
94 for (const auto& effect : effects) { 94 for (const auto& effect : effects) {
95 if (effect->priority() != priority || (suppressedAnimationPlayers && effect->animation() && suppressedAnimationPlayers->contains(effect->animation() ->player()))) 95 if (effect->priority() != priority || (suppressedAnimations && effec t->effect() && suppressedAnimations->contains(effect->effect()->animation())))
96 continue; 96 continue;
97 copyToActiveInterpolationMap(effect->interpolations(), result); 97 copyToActiveInterpolationMap(effect->interpolations(), result);
98 } 98 }
99 } 99 }
100 100
101 if (newAnimations) 101 if (newAnimations)
102 copyNewAnimationsToActiveInterpolationMap(*newAnimations, result); 102 copyNewAnimationsToActiveInterpolationMap(*newAnimations, result);
103 103
104 return result; 104 return result;
105 } 105 }
106 106
107 void AnimationStack::removeClearedEffects() 107 void AnimationStack::removeClearedEffects()
108 { 108 {
109 size_t dest = 0; 109 size_t dest = 0;
110 for (auto& effect : m_effects) { 110 for (auto& effect : m_effects) {
111 if (effect->animation()) 111 if (effect->effect())
112 m_effects[dest++].swap(effect); 112 m_effects[dest++].swap(effect);
113 } 113 }
114 m_effects.shrink(dest); 114 m_effects.shrink(dest);
115 } 115 }
116 116
117 DEFINE_TRACE(AnimationStack) 117 DEFINE_TRACE(AnimationStack)
118 { 118 {
119 visitor->trace(m_effects); 119 visitor->trace(m_effects);
120 } 120 }
121 121
122 bool AnimationStack::getAnimatedBoundingBox(FloatBox& box, CSSPropertyID propert y) const 122 bool AnimationStack::getAnimatedBoundingBox(FloatBox& box, CSSPropertyID propert y) const
123 { 123 {
124 FloatBox originalBox(box); 124 FloatBox originalBox(box);
125 for (const auto& effect : m_effects) { 125 for (const auto& sampledEffect : m_effects) {
126 if (effect->animation() && effect->animation()->affects(PropertyHandle(p roperty))) { 126 if (sampledEffect->effect() && sampledEffect->effect()->affects(Property Handle(property))) {
127 Animation* anim = effect->animation(); 127 KeyframeEffect* effect = sampledEffect->effect();
128 if (!anim) 128 const Timing& timing = effect->specifiedTiming();
129 continue;
130 const Timing& timing = anim->specifiedTiming();
131 double startRange = 0; 129 double startRange = 0;
132 double endRange = 1; 130 double endRange = 1;
133 timing.timingFunction->range(&startRange, &endRange); 131 timing.timingFunction->range(&startRange, &endRange);
134 FloatBox expandingBox(originalBox); 132 FloatBox expandingBox(originalBox);
135 if (!CompositorAnimations::instance()->getAnimatedBoundingBox(expand ingBox, *anim->effect(), startRange, endRange)) 133 if (!CompositorAnimations::instance()->getAnimatedBoundingBox(expand ingBox, *effect->effect(), startRange, endRange))
136 return false; 134 return false;
137 box.expandTo(expandingBox); 135 box.expandTo(expandingBox);
138 } 136 }
139 } 137 }
140 return true; 138 return true;
141 } 139 }
142 140
143 } // namespace blink 141 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/animation/AnimationStack.h ('k') | Source/core/animation/AnimationStackTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698