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

Side by Side Diff: cc/animation/layer_animation_controller.cc

Issue 1637083004: CC Animation: Remove meaningless method from WebLayer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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
« no previous file with comments | « cc/animation/layer_animation_controller.h ('k') | cc/blink/web_layer_impl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "cc/animation/layer_animation_controller.h" 5 #include "cc/animation/layer_animation_controller.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <vector> 10 #include <vector>
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 removed_transform_animation = true; 106 removed_transform_animation = true;
107 } 107 }
108 } 108 }
109 109
110 animations_.erase(animations_to_remove, animations_.end()); 110 animations_.erase(animations_to_remove, animations_.end());
111 UpdateActivation(NORMAL_ACTIVATION); 111 UpdateActivation(NORMAL_ACTIVATION);
112 if (removed_transform_animation) 112 if (removed_transform_animation)
113 UpdatePotentiallyAnimatingTransform(); 113 UpdatePotentiallyAnimatingTransform();
114 } 114 }
115 115
116 void LayerAnimationController::RemoveAnimation(
117 int animation_id,
118 Animation::TargetProperty target_property) {
119 bool removed_transform_animation = false;
120 auto does_not_have_id_or_property = [animation_id, target_property](
121 const scoped_ptr<Animation>& animation) {
122 return animation->id() != animation_id ||
123 animation->target_property() != target_property;
124 };
125 // Since we want to use the animations that we're going to remove, we need to
126 // use a stable_parition here instead of remove_if. Remove_if leaves the
127 // removed items in an unspecified state.
128 auto animations_to_remove = std::stable_partition(
129 animations_.begin(), animations_.end(), does_not_have_id_or_property);
130 if (animations_to_remove == animations_.end())
131 return;
132
133 if (target_property == Animation::SCROLL_OFFSET)
134 scroll_offset_animation_was_interrupted_ = true;
135 else if (target_property == Animation::TRANSFORM &&
136 !(*animations_to_remove)->is_finished())
137 removed_transform_animation = true;
138
139 animations_.erase(animations_to_remove, animations_.end());
140 UpdateActivation(NORMAL_ACTIVATION);
141 if (removed_transform_animation)
142 UpdatePotentiallyAnimatingTransform();
143 }
144
145 void LayerAnimationController::AbortAnimation(int animation_id) { 116 void LayerAnimationController::AbortAnimation(int animation_id) {
146 bool aborted_transform_animation = false; 117 bool aborted_transform_animation = false;
147 if (Animation* animation = GetAnimationById(animation_id)) { 118 if (Animation* animation = GetAnimationById(animation_id)) {
148 if (!animation->is_finished()) { 119 if (!animation->is_finished()) {
149 animation->SetRunState(Animation::ABORTED, last_tick_time_); 120 animation->SetRunState(Animation::ABORTED, last_tick_time_);
150 if (animation->target_property() == Animation::TRANSFORM) 121 if (animation->target_property() == Animation::TRANSFORM)
151 aborted_transform_animation = true; 122 aborted_transform_animation = true;
152 } 123 }
153 } 124 }
154 if (aborted_transform_animation) 125 if (aborted_transform_animation)
(...skipping 1096 matching lines...) Expand 10 before | Expand all | Expand 10 after
1251 &value_observers_); 1222 &value_observers_);
1252 LayerAnimationValueObserver* obs; 1223 LayerAnimationValueObserver* obs;
1253 while ((obs = it.GetNext()) != nullptr) 1224 while ((obs = it.GetNext()) != nullptr)
1254 if (obs->IsActive()) 1225 if (obs->IsActive())
1255 return true; 1226 return true;
1256 } 1227 }
1257 return false; 1228 return false;
1258 } 1229 }
1259 1230
1260 } // namespace cc 1231 } // namespace cc
OLDNEW
« no previous file with comments | « cc/animation/layer_animation_controller.h ('k') | cc/blink/web_layer_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698