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

Unified Diff: cc/animation/element_animations.cc

Issue 2377223002: CC Animations: Rewrite unit tests to work with AnimationPlayer. (Closed)
Patch Set: Reparent. Created 4 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/animation/element_animations.h ('k') | cc/animation/element_animations_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/animation/element_animations.cc
diff --git a/cc/animation/element_animations.cc b/cc/animation/element_animations.cc
index c50e05ea5aa617485e3a24729eeacee62e3f1cd4..6b29c31808aae2c0727c223173244244c39ee0f8 100644
--- a/cc/animation/element_animations.cc
+++ b/cc/animation/element_animations.cc
@@ -11,6 +11,7 @@
#include "base/macros.h"
#include "base/memory/ptr_util.h"
#include "cc/animation/animation_delegate.h"
+#include "cc/animation/animation_events.h"
#include "cc/animation/animation_host.h"
#include "cc/animation/animation_player.h"
#include "cc/animation/keyframed_animation_curve.h"
@@ -158,18 +159,6 @@ void ElementAnimations::PushPropertiesTo(
UpdateActivation(ActivationType::NORMAL);
}
-void ElementAnimations::AddAnimation(std::unique_ptr<Animation> animation) {
- // TODO(loyso): Erase this. Rewrite element_animations_unittest to use
- // AnimationPlayer::AddAnimation.
-
- // Add animation to the first player.
- DCHECK(players_list_->might_have_observers());
- ElementAnimations::PlayersList::Iterator it(players_list_.get());
- AnimationPlayer* player = it.GetNext();
- DCHECK(player);
- player->AddAnimation(std::move(animation));
-}
-
void ElementAnimations::Animate(base::TimeTicks monotonic_time) {
DCHECK(!monotonic_time.is_null());
if (!has_element_in_active_list() && !has_element_in_pending_list())
@@ -554,96 +543,45 @@ bool ElementAnimations::HasAnyAnimation() const {
return false;
}
-bool ElementAnimations::IsPotentiallyAnimatingProperty(
- TargetProperty::Type target_property,
- ElementListType list_type) const {
+bool ElementAnimations::HasAnyAnimationTargetingProperty(
+ TargetProperty::Type property) const {
ElementAnimations::PlayersList::Iterator it(players_list_.get());
AnimationPlayer* player;
while ((player = it.GetNext()) != nullptr) {
- if (player->IsPotentiallyAnimatingProperty(target_property, list_type))
+ if (player->GetAnimation(property))
return true;
}
-
return false;
}
-bool ElementAnimations::IsCurrentlyAnimatingProperty(
+bool ElementAnimations::IsPotentiallyAnimatingProperty(
TargetProperty::Type target_property,
ElementListType list_type) const {
ElementAnimations::PlayersList::Iterator it(players_list_.get());
AnimationPlayer* player;
while ((player = it.GetNext()) != nullptr) {
- if (player->IsCurrentlyAnimatingProperty(target_property, list_type))
+ if (player->IsPotentiallyAnimatingProperty(target_property, list_type))
return true;
}
return false;
}
-void ElementAnimations::SetScrollOffsetAnimationWasInterrupted() {
- scroll_offset_animation_was_interrupted_ = true;
-}
-
-bool ElementAnimations::needs_to_start_animations_for_testing() const {
+bool ElementAnimations::IsCurrentlyAnimatingProperty(
+ TargetProperty::Type target_property,
+ ElementListType list_type) const {
ElementAnimations::PlayersList::Iterator it(players_list_.get());
AnimationPlayer* player;
while ((player = it.GetNext()) != nullptr) {
- if (player->needs_to_start_animations())
+ if (player->IsCurrentlyAnimatingProperty(target_property, list_type))
return true;
}
return false;
}
-void ElementAnimations::PauseAnimation(int animation_id,
- base::TimeDelta time_offset) {
- ElementAnimations::PlayersList::Iterator it(players_list_.get());
- AnimationPlayer* player;
- while ((player = it.GetNext()) != nullptr)
- player->PauseAnimation(animation_id, time_offset.InSecondsF());
-}
-
-void ElementAnimations::RemoveAnimation(int animation_id) {
- ElementAnimations::PlayersList::Iterator it(players_list_.get());
- AnimationPlayer* player;
- while ((player = it.GetNext()) != nullptr)
- player->RemoveAnimation(animation_id);
-}
-
-void ElementAnimations::AbortAnimation(int animation_id) {
- ElementAnimations::PlayersList::Iterator it(players_list_.get());
- AnimationPlayer* player;
- while ((player = it.GetNext()) != nullptr)
- player->AbortAnimation(animation_id);
-}
-
-void ElementAnimations::AbortAnimations(TargetProperty::Type target_property,
- bool needs_completion) {
- ElementAnimations::PlayersList::Iterator it(players_list_.get());
- AnimationPlayer* player;
- while ((player = it.GetNext()) != nullptr)
- player->AbortAnimations(target_property, needs_completion);
-}
-
-Animation* ElementAnimations::GetAnimation(
- TargetProperty::Type target_property) const {
- ElementAnimations::PlayersList::Iterator it(players_list_.get());
- AnimationPlayer* player;
- while ((player = it.GetNext()) != nullptr) {
- if (Animation* animation = player->GetAnimation(target_property))
- return animation;
- }
- return nullptr;
-}
-
-Animation* ElementAnimations::GetAnimationById(int animation_id) const {
- ElementAnimations::PlayersList::Iterator it(players_list_.get());
- AnimationPlayer* player;
- while ((player = it.GetNext()) != nullptr) {
- if (Animation* animation = player->GetAnimationById(animation_id))
- return animation;
- }
- return nullptr;
+void ElementAnimations::SetScrollOffsetAnimationWasInterrupted() {
+ scroll_offset_animation_was_interrupted_ = true;
}
void ElementAnimations::OnFilterAnimated(ElementListType list_type,
« no previous file with comments | « cc/animation/element_animations.h ('k') | cc/animation/element_animations_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698