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

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

Issue 1701853002: Code clean up: Rename SampledEffect variables to sampledEffect instead of effect (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@_refCountPSKs
Patch Set: Created 4 years, 10 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
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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 && (RuntimeEnabledFeatures::stackedCSSPropertyAnimationsEnabled() || !property.isCSSProperty() || property.isPresentationAttribute()) 54 && (RuntimeEnabledFeatures::stackedCSSPropertyAnimationsEnabled() || !property.isCSSProperty() || property.isPresentationAttribute())
55 && interpolation->isInvalidatableInterpolation() 55 && interpolation->isInvalidatableInterpolation()
56 && toInvalidatableInterpolation(*interpolation).dependsOnUnderlyingV alue()) { 56 && toInvalidatableInterpolation(*interpolation).dependsOnUnderlyingV alue()) {
57 activeInterpolations.append(interpolation.get()); 57 activeInterpolations.append(interpolation.get());
58 } else { 58 } else {
59 activeInterpolations.at(0) = interpolation.get(); 59 activeInterpolations.at(0) = interpolation.get();
60 } 60 }
61 } 61 }
62 } 62 }
63 63
64 bool compareEffects(const Member<SampledEffect>& effect1, const Member<SampledEf fect>& effect2) 64 bool compareSampledEffects(const Member<SampledEffect>& sampledEffect1, const Me mber<SampledEffect>& sampledEffect2)
65 { 65 {
66 ASSERT(effect1 && effect2); 66 ASSERT(sampledEffect1 && sampledEffect2);
67 return effect1->sequenceNumber() < effect2->sequenceNumber(); 67 return sampledEffect1->sequenceNumber() < sampledEffect2->sequenceNumber();
68 } 68 }
69 69
70 void copyNewAnimationsToActiveInterpolationsMap(const HeapVector<Member<const In ertEffect>>& newAnimations, AnimationStack::PropertyHandleFilter propertyHandleF ilter, ActiveInterpolationsMap& result) 70 void copyNewAnimationsToActiveInterpolationsMap(const HeapVector<Member<const In ertEffect>>& newAnimations, AnimationStack::PropertyHandleFilter propertyHandleF ilter, ActiveInterpolationsMap& result)
71 { 71 {
72 for (const auto& newAnimation : newAnimations) { 72 for (const auto& newAnimation : newAnimations) {
73 Vector<RefPtr<Interpolation>> sample; 73 Vector<RefPtr<Interpolation>> sample;
74 newAnimation->sample(sample); 74 newAnimation->sample(sample);
75 if (!sample.isEmpty()) 75 if (!sample.isEmpty())
76 copyToActiveInterpolationsMap(sample, propertyHandleFilter, result); 76 copyToActiveInterpolationsMap(sample, propertyHandleFilter, result);
77 } 77 }
78 } 78 }
79 79
80 } // namespace 80 } // namespace
81 81
82 AnimationStack::AnimationStack() 82 AnimationStack::AnimationStack()
83 { 83 {
84 } 84 }
85 85
86 bool AnimationStack::hasActiveAnimationsOnCompositor(CSSPropertyID property) con st 86 bool AnimationStack::hasActiveAnimationsOnCompositor(CSSPropertyID property) con st
87 { 87 {
88 for (const auto& sampledEffect : m_effects) { 88 for (const auto& sampledEffect : m_sampledEffects) {
89 // TODO(dstockwell): move the playing check into AnimationEffect and exp ose both hasAnimations and hasActiveAnimations 89 // TODO(dstockwell): move the playing check into AnimationEffect and exp ose both hasAnimations and hasActiveAnimations
90 if (sampledEffect->effect() && sampledEffect->effect()->animation()->pla ying() && sampledEffect->effect()->hasActiveAnimationsOnCompositor(property)) 90 if (sampledEffect->effect() && sampledEffect->effect()->animation()->pla ying() && sampledEffect->effect()->hasActiveAnimationsOnCompositor(property))
91 return true; 91 return true;
92 } 92 }
93 return false; 93 return false;
94 } 94 }
95 95
96 ActiveInterpolationsMap AnimationStack::activeInterpolations(AnimationStack* ani mationStack, const HeapVector<Member<const InertEffect>>* newAnimations, const H eapHashSet<Member<const Animation>>* suppressedAnimations, KeyframeEffect::Prior ity priority, PropertyHandleFilter propertyHandleFilter) 96 ActiveInterpolationsMap AnimationStack::activeInterpolations(AnimationStack* ani mationStack, const HeapVector<Member<const InertEffect>>* newAnimations, const H eapHashSet<Member<const Animation>>* suppressedAnimations, KeyframeEffect::Prior ity priority, PropertyHandleFilter propertyHandleFilter)
97 { 97 {
98 ActiveInterpolationsMap result; 98 ActiveInterpolationsMap result;
99 99
100 if (animationStack) { 100 if (animationStack) {
101 HeapVector<Member<SampledEffect>>& effects = animationStack->m_effects; 101 HeapVector<Member<SampledEffect>>& sampledEffects = animationStack->m_sa mpledEffects;
102 // std::sort doesn't work with OwnPtrs 102 // std::sort doesn't work with OwnPtrs
103 nonCopyingSort(effects.begin(), effects.end(), compareEffects); 103 nonCopyingSort(sampledEffects.begin(), sampledEffects.end(), compareSamp ledEffects);
104 animationStack->removeClearedEffects(); 104 animationStack->removeClearedSampledEffects();
105 for (const auto& effect : effects) { 105 for (const auto& sampledEffect : sampledEffects) {
106 if (effect->priority() != priority || (suppressedAnimations && effec t->effect() && suppressedAnimations->contains(effect->effect()->animation()))) 106 if (sampledEffect->priority() != priority || (suppressedAnimations & & sampledEffect->effect() && suppressedAnimations->contains(sampledEffect->effec t()->animation())))
107 continue; 107 continue;
108 copyToActiveInterpolationsMap(effect->interpolations(), propertyHand leFilter, result); 108 copyToActiveInterpolationsMap(sampledEffect->interpolations(), prope rtyHandleFilter, result);
109 } 109 }
110 } 110 }
111 111
112 if (newAnimations) 112 if (newAnimations)
113 copyNewAnimationsToActiveInterpolationsMap(*newAnimations, propertyHandl eFilter, result); 113 copyNewAnimationsToActiveInterpolationsMap(*newAnimations, propertyHandl eFilter, result);
114 114
115 return result; 115 return result;
116 } 116 }
117 117
118 void AnimationStack::removeClearedEffects() 118 void AnimationStack::removeClearedSampledEffects()
119 { 119 {
120 size_t dest = 0; 120 size_t dest = 0;
121 for (auto& effect : m_effects) { 121 for (auto& sampledEffect : m_sampledEffects) {
122 if (effect->effect()) 122 if (sampledEffect->effect())
123 m_effects[dest++].swap(effect); 123 m_sampledEffects[dest++].swap(sampledEffect);
124 } 124 }
125 m_effects.shrink(dest); 125 m_sampledEffects.shrink(dest);
126 } 126 }
127 127
128 DEFINE_TRACE(AnimationStack) 128 DEFINE_TRACE(AnimationStack)
129 { 129 {
130 visitor->trace(m_effects); 130 visitor->trace(m_sampledEffects);
131 } 131 }
132 132
133 bool AnimationStack::getAnimatedBoundingBox(FloatBox& box, CSSPropertyID propert y) const 133 bool AnimationStack::getAnimatedBoundingBox(FloatBox& box, CSSPropertyID propert y) const
134 { 134 {
135 FloatBox originalBox(box); 135 FloatBox originalBox(box);
136 for (const auto& sampledEffect : m_effects) { 136 for (const auto& sampledEffect : m_sampledEffects) {
137 if (sampledEffect->effect() && sampledEffect->effect()->affects(Property Handle(property))) { 137 if (sampledEffect->effect() && sampledEffect->effect()->affects(Property Handle(property))) {
138 KeyframeEffect* effect = sampledEffect->effect(); 138 KeyframeEffect* effect = sampledEffect->effect();
139 const Timing& timing = effect->specifiedTiming(); 139 const Timing& timing = effect->specifiedTiming();
140 double startRange = 0; 140 double startRange = 0;
141 double endRange = 1; 141 double endRange = 1;
142 timing.timingFunction->range(&startRange, &endRange); 142 timing.timingFunction->range(&startRange, &endRange);
143 FloatBox expandingBox(originalBox); 143 FloatBox expandingBox(originalBox);
144 if (!CompositorAnimations::instance()->getAnimatedBoundingBox(expand ingBox, *effect->model(), startRange, endRange)) 144 if (!CompositorAnimations::instance()->getAnimatedBoundingBox(expand ingBox, *effect->model(), startRange, endRange))
145 return false; 145 return false;
146 box.expandTo(expandingBox); 146 box.expandTo(expandingBox);
147 } 147 }
148 } 148 }
149 return true; 149 return true;
150 } 150 }
151 151
152 } // namespace blink 152 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698