summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortzik@chromium.org <tzik@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-06-03 06:10:41 +0000
committertzik@chromium.org <tzik@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-06-03 06:10:41 +0000
commite5745ed3b31afe15a491be1116ab6fc6556cf649 (patch)
tree1f3839eb38d886ddbc4e8682bb0359db79026d06
parent8dbcf0de0787507c255f15c4d47bbda86fd35f1b (diff)
downloadchromium_src-e5745ed3b31afe15a491be1116ab6fc6556cf649.zip
chromium_src-e5745ed3b31afe15a491be1116ab6fc6556cf649.tar.gz
chromium_src-e5745ed3b31afe15a491be1116ab6fc6556cf649.tar.bz2
Revert r274404 and r274409:
"compositor: Tick the UI animations from cc, instead of from timer callbacks." "asan: Fix asan leak from r274404." These CLs seem to break ash_unittests on win8 aura bot: http://build.chromium.org/p/chromium.win/buildstatus?builder=Win8%20Aura&number=19390 BUG=371071 TBR=sadrul@chromium.org NOTREECHECKS=true NOTRY=true Review URL: https://codereview.chromium.org/311783002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@274423 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--ash/desktop_background/desktop_background_controller_unittest.cc4
-rw-r--r--ash/shelf/shelf_layout_manager_unittest.cc7
-rw-r--r--ash/wm/window_animations_unittest.cc24
-rw-r--r--ash/wm/workspace_controller_unittest.cc7
-rw-r--r--content/browser/web_contents/aura/window_slider_unittest.cc8
-rw-r--r--content/browser/web_contents/web_contents_view_aura_browsertest.cc10
-rw-r--r--ui/aura/window_unittest.cc12
-rw-r--r--ui/compositor/compositor.cc16
-rw-r--r--ui/compositor/compositor.gyp2
-rw-r--r--ui/compositor/compositor.h15
-rw-r--r--ui/compositor/layer.cc52
-rw-r--r--ui/compositor/layer.h7
-rw-r--r--ui/compositor/layer_animation_delegate.h3
-rw-r--r--ui/compositor/layer_animator.cc79
-rw-r--r--ui/compositor/layer_animator.h22
-rw-r--r--ui/compositor/layer_animator_collection.cc56
-rw-r--r--ui/compositor/layer_animator_collection.h56
-rw-r--r--ui/compositor/layer_animator_unittest.cc311
-rw-r--r--ui/compositor/layer_unittest.cc50
-rw-r--r--ui/compositor/test/test_layer_animation_delegate.cc5
-rw-r--r--ui/compositor/test/test_layer_animation_delegate.h1
-rw-r--r--ui/keyboard/keyboard_controller_unittest.cc4
22 files changed, 191 insertions, 560 deletions
diff --git a/ash/desktop_background/desktop_background_controller_unittest.cc b/ash/desktop_background/desktop_background_controller_unittest.cc
index 609ea14..4e87be6 100644
--- a/ash/desktop_background/desktop_background_controller_unittest.cc
+++ b/ash/desktop_background/desktop_background_controller_unittest.cc
@@ -53,13 +53,13 @@ void RunAnimationForWidget(views::Widget* widget) {
ui::Layer* layer = widget->GetNativeView()->layer();
ui::LayerAnimatorTestController controller(layer->GetAnimator());
+ gfx::AnimationContainerElement* element = layer->GetAnimator();
// Multiple steps are required to complete complex animations.
// TODO(vollick): This should not be necessary. crbug.com/154017
while (controller.animator()->is_animating()) {
controller.StartThreadedAnimationsIfNeeded();
base::TimeTicks step_time = controller.animator()->last_step_time();
- layer->GetAnimator()->Step(step_time +
- base::TimeDelta::FromMilliseconds(1000));
+ element->Step(step_time + base::TimeDelta::FromMilliseconds(1000));
}
}
diff --git a/ash/shelf/shelf_layout_manager_unittest.cc b/ash/shelf/shelf_layout_manager_unittest.cc
index dd5a35d..3a38fc0 100644
--- a/ash/shelf/shelf_layout_manager_unittest.cc
+++ b/ash/shelf/shelf_layout_manager_unittest.cc
@@ -34,6 +34,7 @@
#include "ui/compositor/layer_animator.h"
#include "ui/compositor/scoped_animation_duration_scale_mode.h"
#include "ui/events/gestures/gesture_configuration.h"
+#include "ui/gfx/animation/animation_container_element.h"
#include "ui/gfx/display.h"
#include "ui/gfx/screen.h"
#include "ui/views/controls/label.h"
@@ -49,8 +50,10 @@ namespace ash {
namespace {
void StepWidgetLayerAnimatorToEnd(views::Widget* widget) {
- widget->GetNativeView()->layer()->GetAnimator()->Step(
- base::TimeTicks::Now() + base::TimeDelta::FromSeconds(1));
+ gfx::AnimationContainerElement* element =
+ static_cast<gfx::AnimationContainerElement*>(
+ widget->GetNativeView()->layer()->GetAnimator());
+ element->Step(base::TimeTicks::Now() + base::TimeDelta::FromSeconds(1));
}
ShelfWidget* GetShelfWidget() {
diff --git a/ash/wm/window_animations_unittest.cc b/ash/wm/window_animations_unittest.cc
index 0e1a4d8..7df1c49 100644
--- a/ash/wm/window_animations_unittest.cc
+++ b/ash/wm/window_animations_unittest.cc
@@ -16,6 +16,7 @@
#include "ui/compositor/layer_animator.h"
#include "ui/compositor/scoped_animation_duration_scale_mode.h"
#include "ui/compositor/scoped_layer_animation_settings.h"
+#include "ui/gfx/animation/animation_container_element.h"
using aura::Window;
using ui::Layer;
@@ -88,8 +89,11 @@ TEST_F(WindowAnimationsTest, HideShowBrightnessGrayscaleAnimation) {
EXPECT_TRUE(window->layer()->visible());
// Stays shown.
- window->layer()->GetAnimator()->Step(base::TimeTicks::Now() +
- base::TimeDelta::FromSeconds(5));
+ gfx::AnimationContainerElement* element =
+ static_cast<gfx::AnimationContainerElement*>(
+ window->layer()->GetAnimator());
+ element->Step(base::TimeTicks::Now() +
+ base::TimeDelta::FromSeconds(5));
EXPECT_EQ(0.0f, window->layer()->GetTargetBrightness());
EXPECT_EQ(0.0f, window->layer()->GetTargetGrayscale());
EXPECT_TRUE(window->layer()->visible());
@@ -137,10 +141,10 @@ TEST_F(WindowAnimationsTest, CrossFadeToBounds) {
EXPECT_EQ(gfx::Transform(), window->layer()->GetTargetTransform());
// Run the animations to completion.
- old_layer->GetAnimator()->Step(base::TimeTicks::Now() +
- base::TimeDelta::FromSeconds(1));
- window->layer()->GetAnimator()->Step(base::TimeTicks::Now() +
- base::TimeDelta::FromSeconds(1));
+ static_cast<gfx::AnimationContainerElement*>(old_layer->GetAnimator())->Step(
+ base::TimeTicks::Now() + base::TimeDelta::FromSeconds(1));
+ static_cast<gfx::AnimationContainerElement*>(window->layer()->GetAnimator())->
+ Step(base::TimeTicks::Now() + base::TimeDelta::FromSeconds(1));
// Cross fade to a smaller size, as in a restore animation.
old_layer = window->layer();
@@ -159,10 +163,10 @@ TEST_F(WindowAnimationsTest, CrossFadeToBounds) {
EXPECT_EQ(1.0f, window->layer()->GetTargetOpacity());
EXPECT_EQ(gfx::Transform(), window->layer()->GetTargetTransform());
- old_layer->GetAnimator()->Step(base::TimeTicks::Now() +
- base::TimeDelta::FromSeconds(1));
- window->layer()->GetAnimator()->Step(base::TimeTicks::Now() +
- base::TimeDelta::FromSeconds(1));
+ static_cast<gfx::AnimationContainerElement*>(old_layer->GetAnimator())->Step(
+ base::TimeTicks::Now() + base::TimeDelta::FromSeconds(1));
+ static_cast<gfx::AnimationContainerElement*>(window->layer()->GetAnimator())->
+ Step(base::TimeTicks::Now() + base::TimeDelta::FromSeconds(1));
}
} // namespace wm
diff --git a/ash/wm/workspace_controller_unittest.cc b/ash/wm/workspace_controller_unittest.cc
index 0504a4b..fcfa414 100644
--- a/ash/wm/workspace_controller_unittest.cc
+++ b/ash/wm/workspace_controller_unittest.cc
@@ -31,7 +31,6 @@
#include "ui/base/ui_base_types.h"
#include "ui/compositor/layer.h"
#include "ui/compositor/scoped_animation_duration_scale_mode.h"
-#include "ui/compositor/test/draw_waiter_for_test.h"
#include "ui/events/event_utils.h"
#include "ui/gfx/screen.h"
#include "ui/views/widget/widget.h"
@@ -1237,12 +1236,6 @@ TEST_F(WorkspaceControllerTest, AnimatedNormToMaxToNormRepositionsRemaining) {
desktop_area.width() - window1->bounds().width()) +
",32 640x320", window1->bounds().ToString());
EXPECT_EQ("0,48 256x512", window2->bounds().ToString());
-
- // Wait for the compositor to draw, which would terminate the pending
- // animations.
- ui::Compositor* compositor = window2->layer()->GetCompositor();
- while (compositor->layer_animator_collection()->HasActiveAnimators())
- ui::DrawWaiterForTest::Wait(compositor);
}
// This tests simulates a browser and an app and verifies the ordering of the
diff --git a/content/browser/web_contents/aura/window_slider_unittest.cc b/content/browser/web_contents/aura/window_slider_unittest.cc
index 4a2d0a5..2ad69c2 100644
--- a/content/browser/web_contents/aura/window_slider_unittest.cc
+++ b/content/browser/web_contents/aura/window_slider_unittest.cc
@@ -341,6 +341,7 @@ TEST_F(WindowSliderTest, WindowSlideInterruptedThenContinues) {
ui::ScopedAnimationDurationScaleMode normal_duration_(
ui::ScopedAnimationDurationScaleMode::NORMAL_DURATION);
ui::LayerAnimator* animator = window->layer()->GetAnimator();
+ gfx::AnimationContainerElement* element = animator;
animator->set_disable_timer_for_test(true);
ui::LayerAnimatorTestController test_controller(animator);
@@ -427,7 +428,7 @@ TEST_F(WindowSliderTest, WindowSlideInterruptedThenContinues) {
ui::ScopedLayerAnimationSettings settings(animator);
base::TimeDelta duration = settings.GetTransitionDuration();
test_controller.StartThreadedAnimationsIfNeeded();
- animator->Step(gfx::FrameTime::Now() + duration);
+ element->Step(gfx::FrameTime::Now() + duration);
EXPECT_TRUE(slider_delegate.slide_completed());
EXPECT_FALSE(slider_delegate.slider_destroyed());
@@ -595,6 +596,7 @@ TEST_F(WindowSliderTest, SwipeDuringSwipeAnimation) {
ui::ScopedAnimationDurationScaleMode normal_duration_(
ui::ScopedAnimationDurationScaleMode::NORMAL_DURATION);
ui::LayerAnimator* animator = window->layer()->GetAnimator();
+ gfx::AnimationContainerElement* element = animator;
animator->set_disable_timer_for_test(true);
ui::LayerAnimatorTestController test_controller(animator);
@@ -617,7 +619,7 @@ TEST_F(WindowSliderTest, SwipeDuringSwipeAnimation) {
test_controller.StartThreadedAnimationsIfNeeded();
base::TimeTicks start_time1 = gfx::FrameTime::Now();
- animator->Step(start_time1 + duration / 2);
+ element->Step(start_time1 + duration/2);
EXPECT_FALSE(slider_delegate.slide_completed());
slider_delegate.Reset();
// Generate another horizontal swipe while the animation from the previous
@@ -638,7 +640,7 @@ TEST_F(WindowSliderTest, SwipeDuringSwipeAnimation) {
test_controller.StartThreadedAnimationsIfNeeded();
base::TimeTicks start_time2 = gfx::FrameTime::Now();
slider_delegate.Reset();
- animator->Step(start_time2 + duration);
+ element->Step(start_time2 + duration);
// The animation for the second slide should now be completed.
EXPECT_TRUE(slider_delegate.slide_completed());
slider_delegate.Reset();
diff --git a/content/browser/web_contents/web_contents_view_aura_browsertest.cc b/content/browser/web_contents/web_contents_view_aura_browsertest.cc
index d4f8523..fa9f3bd 100644
--- a/content/browser/web_contents/web_contents_view_aura_browsertest.cc
+++ b/content/browser/web_contents/web_contents_view_aura_browsertest.cc
@@ -31,7 +31,6 @@
#include "ui/aura/window.h"
#include "ui/aura/window_tree_host.h"
#include "ui/compositor/scoped_animation_duration_scale_mode.h"
-#include "ui/compositor/test/draw_waiter_for_test.h"
#include "ui/events/event_processor.h"
#include "ui/events/event_utils.h"
@@ -263,15 +262,6 @@ class WebContentsViewAuraTest : public ContentBrowserTest {
}
private:
- // BrowserTestBase:
- virtual void TearDownOnMainThread() OVERRIDE {
- aura::Window* window = shell()->web_contents()->GetNativeView();
- ui::Compositor* compositor = window->layer()->GetCompositor();
- while (compositor->layer_animator_collection()->HasActiveAnimators())
- ui::DrawWaiterForTest::Wait(compositor);
- ContentBrowserTest::TearDownOnMainThread();
- }
-
ScreenshotTracker* screenshot_manager_;
DISALLOW_COPY_AND_ASSIGN(WebContentsViewAuraTest);
diff --git a/ui/aura/window_unittest.cc b/ui/aura/window_unittest.cc
index 4422f31..add99d4 100644
--- a/ui/aura/window_unittest.cc
+++ b/ui/aura/window_unittest.cc
@@ -1625,7 +1625,7 @@ TEST_F(WindowTest, SetBoundsInternalShouldCheckTargetBounds) {
EXPECT_FALSE(!w1->layer());
w1->layer()->GetAnimator()->set_disable_timer_for_test(true);
- ui::LayerAnimator* animator = w1->layer()->GetAnimator();
+ gfx::AnimationContainerElement* element = w1->layer()->GetAnimator();
EXPECT_EQ("0,0 100x100", w1->bounds().ToString());
EXPECT_EQ("0,0 100x100", w1->layer()->GetTargetBounds().ToString());
@@ -1655,7 +1655,7 @@ TEST_F(WindowTest, SetBoundsInternalShouldCheckTargetBounds) {
base::TimeTicks start_time =
w1->layer()->GetAnimator()->last_step_time();
- animator->Step(start_time + base::TimeDelta::FromMilliseconds(1000));
+ element->Step(start_time + base::TimeDelta::FromMilliseconds(1000));
EXPECT_EQ("0,0 100x100", w1->bounds().ToString());
}
@@ -2374,8 +2374,8 @@ TEST_F(WindowTest, DelegateNotifiedAsBoundsChange) {
// Animate to the end, which should notify of the change.
base::TimeTicks start_time =
window->layer()->GetAnimator()->last_step_time();
- ui::LayerAnimator* animator = window->layer()->GetAnimator();
- animator->Step(start_time + base::TimeDelta::FromMilliseconds(1000));
+ gfx::AnimationContainerElement* element = window->layer()->GetAnimator();
+ element->Step(start_time + base::TimeDelta::FromMilliseconds(1000));
EXPECT_TRUE(delegate.bounds_changed());
EXPECT_NE("0,0 100x100", window->bounds().ToString());
}
@@ -2416,8 +2416,8 @@ TEST_F(WindowTest, DelegateNotifiedAsBoundsChangeInHiddenLayer) {
// Animate to the end: will *not* notify of the change since we are hidden.
base::TimeTicks start_time =
window->layer()->GetAnimator()->last_step_time();
- ui::LayerAnimator* animator = window->layer()->GetAnimator();
- animator->Step(start_time + base::TimeDelta::FromMilliseconds(1000));
+ gfx::AnimationContainerElement* element = window->layer()->GetAnimator();
+ element->Step(start_time + base::TimeDelta::FromMilliseconds(1000));
// No bounds changed notification at the end of animation since layer
// delegate is NULL.
diff --git a/ui/compositor/compositor.cc b/ui/compositor/compositor.cc
index b511e6d..325425c 100644
--- a/ui/compositor/compositor.cc
+++ b/ui/compositor/compositor.cc
@@ -26,7 +26,6 @@
#include "ui/compositor/compositor_vsync_manager.h"
#include "ui/compositor/dip_util.h"
#include "ui/compositor/layer.h"
-#include "ui/compositor/layer_animator_collection.h"
#include "ui/gfx/frame_time.h"
#include "ui/gl/gl_context.h"
#include "ui/gl/gl_switches.h"
@@ -85,7 +84,6 @@ Compositor::Compositor(gfx::AcceleratedWidget widget,
waiting_on_compositing_end_(false),
draw_on_compositing_end_(false),
swap_state_(SWAP_NONE),
- layer_animator_collection_(this),
schedule_draw_factory_(this) {
root_web_layer_ = cc::Layer::Create();
root_web_layer_->SetAnchorPoint(gfx::PointF(0.f, 0.f));
@@ -219,10 +217,8 @@ void Compositor::Draw() {
if (!IsLocked()) {
// TODO(nduca): Temporary while compositor calls
// compositeImmediately() directly.
- base::TimeTicks now = gfx::FrameTime::Now();
- Animate(now);
Layout();
- host_->Composite(now);
+ host_->Composite(gfx::FrameTime::Now());
}
if (swap_state_ == SWAP_NONE)
NotifyEnd();
@@ -282,12 +278,6 @@ bool Compositor::HasObserver(CompositorObserver* observer) {
return observer_list_.HasObserver(observer);
}
-void Compositor::Animate(base::TimeTicks frame_begin_time) {
- layer_animator_collection_.Progress(frame_begin_time);
- if (layer_animator_collection_.HasActiveAnimators())
- host_->SetNeedsAnimate();
-}
-
void Compositor::Layout() {
// We're sending damage that will be addressed during this composite
// cycle, so we don't need to schedule another composite to address it.
@@ -353,10 +343,6 @@ void Compositor::DidAbortSwapBuffers() {
OnCompositingAborted(this));
}
-void Compositor::ScheduleAnimationForLayerCollection() {
- host_->SetNeedsAnimate();
-}
-
const cc::LayerTreeDebugState& Compositor::GetLayerTreeDebugState() const {
return host_->debug_state();
}
diff --git a/ui/compositor/compositor.gyp b/ui/compositor/compositor.gyp
index 9b19e60..e242dce 100644
--- a/ui/compositor/compositor.gyp
+++ b/ui/compositor/compositor.gyp
@@ -49,8 +49,6 @@
'layer_animation_sequence.h',
'layer_animator.cc',
'layer_animator.h',
- 'layer_animator_collection.cc',
- 'layer_animator_collection.h',
'layer_delegate.h',
'layer_owner.cc',
'layer_owner.h',
diff --git a/ui/compositor/compositor.h b/ui/compositor/compositor.h
index 79bf691..e0606c1 100644
--- a/ui/compositor/compositor.h
+++ b/ui/compositor/compositor.h
@@ -17,7 +17,6 @@
#include "third_party/skia/include/core/SkColor.h"
#include "ui/compositor/compositor_export.h"
#include "ui/compositor/compositor_observer.h"
-#include "ui/compositor/layer_animator_collection.h"
#include "ui/gfx/native_widget_types.h"
#include "ui/gfx/size.h"
#include "ui/gfx/vector2d.h"
@@ -127,8 +126,7 @@ class COMPOSITOR_EXPORT CompositorLock
// view hierarchy.
class COMPOSITOR_EXPORT Compositor
: NON_EXPORTED_BASE(public cc::LayerTreeHostClient),
- NON_EXPORTED_BASE(public cc::LayerTreeHostSingleThreadClient),
- NON_EXPORTED_BASE(public LayerAnimatorCollectionDelegate) {
+ NON_EXPORTED_BASE(public cc::LayerTreeHostSingleThreadClient) {
public:
Compositor(gfx::AcceleratedWidget widget,
ui::ContextFactory* context_factory);
@@ -215,7 +213,7 @@ class COMPOSITOR_EXPORT Compositor
// LayerTreeHostClient implementation.
virtual void WillBeginMainFrame(int frame_id) OVERRIDE {}
virtual void DidBeginMainFrame() OVERRIDE {}
- virtual void Animate(base::TimeTicks frame_begin_time) OVERRIDE;
+ virtual void Animate(base::TimeTicks frame_begin_time) OVERRIDE {}
virtual void Layout() OVERRIDE;
virtual void ApplyScrollAndScale(const gfx::Vector2d& scroll_delta,
float page_scale) OVERRIDE {}
@@ -233,9 +231,6 @@ class COMPOSITOR_EXPORT Compositor
virtual void DidPostSwapBuffers() OVERRIDE;
virtual void DidAbortSwapBuffers() OVERRIDE;
- // LayerAnimatorCollectionDelegate implementation.
- virtual void ScheduleAnimationForLayerCollection() OVERRIDE;
-
int last_started_frame() { return last_started_frame_; }
int last_ended_frame() { return last_ended_frame_; }
@@ -244,10 +239,6 @@ class COMPOSITOR_EXPORT Compositor
const cc::LayerTreeDebugState& GetLayerTreeDebugState() const;
void SetLayerTreeDebugState(const cc::LayerTreeDebugState& debug_state);
- LayerAnimatorCollection* layer_animator_collection() {
- return &layer_animator_collection_;
- }
-
private:
friend class base::RefCounted<Compositor>;
friend class CompositorLock;
@@ -298,8 +289,6 @@ class COMPOSITOR_EXPORT Compositor
enum SwapState { SWAP_NONE, SWAP_POSTED, SWAP_COMPLETED };
SwapState swap_state_;
- LayerAnimatorCollection layer_animator_collection_;
-
base::WeakPtrFactory<Compositor> schedule_draw_factory_;
DISALLOW_COPY_AND_ASSIGN(Compositor);
diff --git a/ui/compositor/layer.cc b/ui/compositor/layer.cc
index 5ceedeb..ca3ff28 100644
--- a/ui/compositor/layer.cc
+++ b/ui/compositor/layer.cc
@@ -142,15 +142,10 @@ void Layer::SetCompositor(Compositor* compositor) {
DCHECK(!compositor || !compositor_);
DCHECK(!compositor || compositor->root_layer() == this);
DCHECK(!parent_);
- if (compositor_) {
- RemoveAnimatorsInTreeFromCollection(
- compositor_->layer_animator_collection());
- }
compositor_ = compositor;
if (compositor) {
OnDeviceScaleFactorChanged(compositor->device_scale_factor());
SendPendingThreadedAnimations();
- AddAnimatorsInTreeToCollection(compositor_->layer_animator_collection());
}
}
@@ -164,21 +159,15 @@ void Layer::Add(Layer* child) {
child->OnDeviceScaleFactorChanged(device_scale_factor_);
if (GetCompositor())
child->SendPendingThreadedAnimations();
- LayerAnimatorCollection* collection = GetLayerAnimatorCollection();
- if (collection)
- child->AddAnimatorsInTreeToCollection(collection);
}
void Layer::Remove(Layer* child) {
// Current bounds are used to calculate offsets when layers are reparented.
// Stop (and complete) an ongoing animation to update the bounds immediately.
- LayerAnimator* child_animator = child->animator_;
- if (child_animator)
- child_animator->StopAnimatingProperty(ui::LayerAnimationElement::BOUNDS);
- LayerAnimatorCollection* collection = GetLayerAnimatorCollection();
- if (collection)
- child->RemoveAnimatorsInTreeFromCollection(collection);
-
+ if (child->GetAnimator()) {
+ child->GetAnimator()->StopAnimatingProperty(
+ ui::LayerAnimationElement::BOUNDS);
+ }
std::vector<Layer*>::iterator i =
std::find(children_.begin(), children_.end(), child);
DCHECK(i != children_.end());
@@ -884,11 +873,6 @@ void Layer::RemoveThreadedAnimation(int animation_id) {
pending_threaded_animations_.end());
}
-LayerAnimatorCollection* Layer::GetLayerAnimatorCollection() {
- Compositor* compositor = GetCompositor();
- return compositor ? compositor->layer_animator_collection() : NULL;
-}
-
void Layer::SendPendingThreadedAnimations() {
for (cc::ScopedPtrVector<cc::Animation>::iterator it =
pending_threaded_animations_.begin();
@@ -946,32 +930,4 @@ void Layer::RecomputePosition() {
cc_layer_->SetPosition(gfx::PointF(bounds_.x(), bounds_.y()));
}
-void Layer::AddAnimatorsInTreeToCollection(
- LayerAnimatorCollection* collection) {
- DCHECK(collection);
- if (IsAnimating())
- animator_->AddToCollection(collection);
- std::for_each(
- children_.begin(),
- children_.end(),
- std::bind2nd(std::mem_fun(&Layer::AddAnimatorsInTreeToCollection),
- collection));
-}
-
-void Layer::RemoveAnimatorsInTreeFromCollection(
- LayerAnimatorCollection* collection) {
- DCHECK(collection);
- if (IsAnimating())
- animator_->RemoveFromCollection(collection);
- std::for_each(
- children_.begin(),
- children_.end(),
- std::bind2nd(std::mem_fun(&Layer::RemoveAnimatorsInTreeFromCollection),
- collection));
-}
-
-bool Layer::IsAnimating() const {
- return animator_ && animator_->is_animating();
-}
-
} // namespace ui
diff --git a/ui/compositor/layer.h b/ui/compositor/layer.h
index bb70ba1..2b0d913 100644
--- a/ui/compositor/layer.h
+++ b/ui/compositor/layer.h
@@ -366,7 +366,6 @@ class COMPOSITOR_EXPORT Layer
virtual void AddThreadedAnimation(
scoped_ptr<cc::Animation> animation) OVERRIDE;
virtual void RemoveThreadedAnimation(int animation_id) OVERRIDE;
- virtual LayerAnimatorCollection* GetLayerAnimatorCollection() OVERRIDE;
// Creates a corresponding composited layer for |type_|.
void CreateWebLayer();
@@ -390,12 +389,6 @@ class COMPOSITOR_EXPORT Layer
// be called once we have been added to a tree.
void SendPendingThreadedAnimations();
- void AddAnimatorsInTreeToCollection(LayerAnimatorCollection* collection);
- void RemoveAnimatorsInTreeFromCollection(LayerAnimatorCollection* collection);
-
- // Returns whether the layer has an animating LayerAnimator.
- bool IsAnimating() const;
-
const LayerType type_;
Compositor* compositor_;
diff --git a/ui/compositor/layer_animation_delegate.h b/ui/compositor/layer_animation_delegate.h
index 2f38d54..1d57c71 100644
--- a/ui/compositor/layer_animation_delegate.h
+++ b/ui/compositor/layer_animation_delegate.h
@@ -14,8 +14,6 @@
namespace ui {
-class LayerAnimatorCollection;
-
// Layer animations interact with the layers using this interface.
class COMPOSITOR_EXPORT LayerAnimationDelegate {
public:
@@ -37,7 +35,6 @@ class COMPOSITOR_EXPORT LayerAnimationDelegate {
virtual float GetDeviceScaleFactor() const = 0;
virtual void AddThreadedAnimation(scoped_ptr<cc::Animation> animation) = 0;
virtual void RemoveThreadedAnimation(int animation_id) = 0;
- virtual LayerAnimatorCollection* GetLayerAnimatorCollection() = 0;
protected:
virtual ~LayerAnimationDelegate() {}
diff --git a/ui/compositor/layer_animator.cc b/ui/compositor/layer_animator.cc
index 39585a7..ce2b0ff 100644
--- a/ui/compositor/layer_animator.cc
+++ b/ui/compositor/layer_animator.cc
@@ -14,7 +14,7 @@
#include "ui/compositor/layer_animation_delegate.h"
#include "ui/compositor/layer_animation_observer.h"
#include "ui/compositor/layer_animation_sequence.h"
-#include "ui/compositor/layer_animator_collection.h"
+#include "ui/gfx/animation/animation_container.h"
#include "ui/gfx/frame_time.h"
#define SAFE_INVOKE_VOID(function, running_anim, ...) \
@@ -31,9 +31,22 @@
namespace ui {
+class LayerAnimator;
+
namespace {
const int kDefaultTransitionDurationMs = 120;
+const int kTimerIntervalMs = 10;
+
+// Returns the AnimationContainer we're added to.
+gfx::AnimationContainer* GetAnimationContainer() {
+ static gfx::AnimationContainer* container = NULL;
+ if (!container) {
+ container = new gfx::AnimationContainer();
+ container->AddRef();
+ }
+ return container;
+}
} // namespace
@@ -111,17 +124,7 @@ base::TimeDelta LayerAnimator::GetTransitionDuration() const {
}
void LayerAnimator::SetDelegate(LayerAnimationDelegate* delegate) {
- if (delegate_ && is_started_) {
- LayerAnimatorCollection* collection = GetLayerAnimatorCollection();
- if (collection)
- collection->StopAnimator(this);
- }
delegate_ = delegate;
- if (delegate_ && is_started_) {
- LayerAnimatorCollection* collection = GetLayerAnimatorCollection();
- if (collection)
- collection->StartAnimator(this);
- }
}
void LayerAnimator::StartAnimation(LayerAnimationSequence* animation) {
@@ -178,9 +181,8 @@ void LayerAnimator::StartTogether(
adding_animations_ = true;
if (!is_animating()) {
- LayerAnimatorCollection* collection = GetLayerAnimatorCollection();
- if (collection && collection->HasActiveAnimators())
- last_step_time_ = collection->last_tick_time();
+ if (GetAnimationContainer()->is_running())
+ last_step_time_ = GetAnimationContainer()->last_tick_time();
else
last_step_time_ = gfx::FrameTime::Now();
}
@@ -341,20 +343,6 @@ void LayerAnimator::OnThreadedAnimationStarted(
}
}
-void LayerAnimator::AddToCollection(LayerAnimatorCollection* collection) {
- if (is_animating() && !is_started_) {
- collection->StartAnimator(this);
- is_started_ = true;
- }
-}
-
-void LayerAnimator::RemoveFromCollection(LayerAnimatorCollection* collection) {
- if (is_animating() && is_started_) {
- collection->StopAnimator(this);
- is_started_ = false;
- }
-}
-
// LayerAnimator protected -----------------------------------------------------
void LayerAnimator::ProgressAnimation(LayerAnimationSequence* sequence,
@@ -407,6 +395,14 @@ void LayerAnimator::Step(base::TimeTicks now) {
}
}
+void LayerAnimator::SetStartTime(base::TimeTicks start_time) {
+ // Do nothing.
+}
+
+base::TimeDelta LayerAnimator::GetTimerInterval() const {
+ return base::TimeDelta::FromMilliseconds(kTimerIntervalMs);
+}
+
void LayerAnimator::StopAnimatingInternal(bool abort) {
scoped_refptr<LayerAnimator> retain(this);
while (is_animating()) {
@@ -435,16 +431,12 @@ void LayerAnimator::UpdateAnimationState() {
return;
const bool should_start = is_animating();
- LayerAnimatorCollection* collection = GetLayerAnimatorCollection();
- if (collection) {
- if (should_start && !is_started_)
- collection->StartAnimator(this);
- else if (!should_start && is_started_)
- collection->StopAnimator(this);
- is_started_ = should_start;
- } else {
- is_started_ = false;
- }
+ if (should_start && !is_started_)
+ GetAnimationContainer()->Start(this);
+ else if (!should_start && is_started_)
+ GetAnimationContainer()->Stop(this);
+
+ is_started_ = should_start;
}
LayerAnimationSequence* LayerAnimator::RemoveAnimation(
@@ -761,15 +753,14 @@ bool LayerAnimator::StartSequenceImmediately(LayerAnimationSequence* sequence) {
// a resolution that can be as bad as 15ms. If this causes glitches in the
// animations, this can be switched to HighResNow() (animation uses Now()
// internally).
- // All LayerAnimators share the same LayerAnimatorCollection. Use the
+ // All LayerAnimators share the same AnimationContainer. Use the
// last_tick_time() from there to ensure animations started during the same
// event complete at the same time.
base::TimeTicks start_time;
- LayerAnimatorCollection* collection = GetLayerAnimatorCollection();
if (is_animating() || adding_animations_)
start_time = last_step_time_;
- else if (collection && collection->HasActiveAnimators())
- start_time = collection->last_tick_time();
+ else if (GetAnimationContainer()->is_running())
+ start_time = GetAnimationContainer()->last_tick_time();
else
start_time = gfx::FrameTime::Now();
@@ -848,10 +839,6 @@ void LayerAnimator::PurgeDeletedAnimations() {
}
}
-LayerAnimatorCollection* LayerAnimator::GetLayerAnimatorCollection() {
- return delegate_ ? delegate_->GetLayerAnimatorCollection() : NULL;
-}
-
LayerAnimator::RunningAnimation::RunningAnimation(
const base::WeakPtr<LayerAnimationSequence>& sequence)
: sequence_(sequence) {
diff --git a/ui/compositor/layer_animator.h b/ui/compositor/layer_animator.h
index 69744f8..a1e0ad2 100644
--- a/ui/compositor/layer_animator.h
+++ b/ui/compositor/layer_animator.h
@@ -9,13 +9,13 @@
#include <vector>
#include "base/compiler_specific.h"
-#include "base/gtest_prod_util.h"
#include "base/memory/linked_ptr.h"
#include "base/memory/ref_counted.h"
#include "base/observer_list.h"
#include "base/time/time.h"
#include "ui/compositor/compositor_export.h"
#include "ui/compositor/layer_animation_element.h"
+#include "ui/gfx/animation/animation_container_element.h"
#include "ui/gfx/animation/tween.h"
namespace gfx {
@@ -29,7 +29,6 @@ class Layer;
class LayerAnimationSequence;
class LayerAnimationDelegate;
class LayerAnimationObserver;
-class LayerAnimatorCollection;
class ScopedLayerAnimationSettings;
// When a property of layer needs to be changed it is set by way of
@@ -41,7 +40,9 @@ class ScopedLayerAnimationSettings;
// ensure that it is not disposed of until it finishes executing. It does this
// by holding a reference to itself for the duration of methods for which it
// must guarantee that |this| is valid.
-class COMPOSITOR_EXPORT LayerAnimator : public base::RefCounted<LayerAnimator> {
+class COMPOSITOR_EXPORT LayerAnimator
+ : public gfx::AnimationContainerElement,
+ public base::RefCounted<LayerAnimator> {
public:
enum PreemptionStrategy {
IMMEDIATELY_SET_NEW_TARGET,
@@ -187,11 +188,6 @@ class COMPOSITOR_EXPORT LayerAnimator : public base::RefCounted<LayerAnimator> {
}
base::TimeTicks last_step_time() const { return last_step_time_; }
- void Step(base::TimeTicks time_now);
-
- void AddToCollection(LayerAnimatorCollection* collection);
- void RemoveFromCollection(LayerAnimatorCollection* collection);
-
protected:
virtual ~LayerAnimator();
@@ -211,9 +207,6 @@ class COMPOSITOR_EXPORT LayerAnimator : public base::RefCounted<LayerAnimator> {
friend class base::RefCounted<LayerAnimator>;
friend class ScopedLayerAnimationSettings;
friend class LayerAnimatorTestController;
- FRIEND_TEST_ALL_PREFIXES(LayerAnimatorTest, AnimatorStartedCorrectly);
- FRIEND_TEST_ALL_PREFIXES(LayerAnimatorTest,
- AnimatorRemovedFromCollectionWhenLayerIsDestroyed);
class RunningAnimation {
public:
@@ -232,6 +225,11 @@ class COMPOSITOR_EXPORT LayerAnimator : public base::RefCounted<LayerAnimator> {
typedef std::vector<RunningAnimation> RunningAnimations;
typedef std::deque<linked_ptr<LayerAnimationSequence> > AnimationQueue;
+ // Implementation of AnimationContainerElement
+ virtual void SetStartTime(base::TimeTicks start_time) OVERRIDE;
+ virtual void Step(base::TimeTicks time_now) OVERRIDE;
+ virtual base::TimeDelta GetTimerInterval() const OVERRIDE;
+
// Finishes all animations by either advancing them to their final state or by
// aborting them.
void StopAnimatingInternal(bool abort);
@@ -309,8 +307,6 @@ class COMPOSITOR_EXPORT LayerAnimator : public base::RefCounted<LayerAnimator> {
// Cleans up any running animations that may have been deleted.
void PurgeDeletedAnimations();
- LayerAnimatorCollection* GetLayerAnimatorCollection();
-
// This is the queue of animations to run.
AnimationQueue animation_queue_;
diff --git a/ui/compositor/layer_animator_collection.cc b/ui/compositor/layer_animator_collection.cc
deleted file mode 100644
index 12142d8..0000000
--- a/ui/compositor/layer_animator_collection.cc
+++ /dev/null
@@ -1,56 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "ui/compositor/layer_animator_collection.h"
-
-#include <set>
-
-#include "base/time/time.h"
-#include "ui/compositor/layer_animator.h"
-#include "ui/gfx/frame_time.h"
-
-namespace ui {
-
-LayerAnimatorCollection::LayerAnimatorCollection(
- LayerAnimatorCollectionDelegate* delegate)
- : delegate_(delegate),
- last_tick_time_(gfx::FrameTime::Now()) {
-}
-
-LayerAnimatorCollection::~LayerAnimatorCollection() {
-}
-
-void LayerAnimatorCollection::StartAnimator(
- scoped_refptr<LayerAnimator> animator) {
- DCHECK_EQ(0U, animators_.count(animator));
- if (!animators_.size())
- last_tick_time_ = gfx::FrameTime::Now();
- animators_.insert(animator);
- if (delegate_)
- delegate_->ScheduleAnimationForLayerCollection();
-}
-
-void LayerAnimatorCollection::StopAnimator(
- scoped_refptr<LayerAnimator> animator) {
- DCHECK_GT(animators_.count(animator), 0U);
- animators_.erase(animator);
-}
-
-bool LayerAnimatorCollection::HasActiveAnimators() const {
- return !animators_.empty();
-}
-
-void LayerAnimatorCollection::Progress(base::TimeTicks now) {
- last_tick_time_ = now;
- std::set<scoped_refptr<LayerAnimator> > list = animators_;
- for (std::set<scoped_refptr<LayerAnimator> >::iterator iter = list.begin();
- iter != list.end();
- ++iter) {
- // Make sure the animator is still valid.
- if (animators_.count(*iter) > 0)
- (*iter)->Step(now);
- }
-}
-
-} // namespace ui
diff --git a/ui/compositor/layer_animator_collection.h b/ui/compositor/layer_animator_collection.h
deleted file mode 100644
index 2789eda..0000000
--- a/ui/compositor/layer_animator_collection.h
+++ /dev/null
@@ -1,56 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef UI_COMPOSITOR_LAYER_ANIMATOR_COLLECTION_H_
-#define UI_COMPOSITOR_LAYER_ANIMATOR_COLLECTION_H_
-
-#include <set>
-
-#include "base/callback.h"
-#include "base/memory/ref_counted.h"
-#include "base/time/time.h"
-#include "ui/compositor/compositor_export.h"
-
-namespace base {
-class TimeTicks;
-}
-
-namespace ui {
-
-class LayerAnimator;
-
-class COMPOSITOR_EXPORT LayerAnimatorCollectionDelegate {
- public:
- virtual ~LayerAnimatorCollectionDelegate() {}
-
- virtual void ScheduleAnimationForLayerCollection() = 0;
-};
-
-// A collection of LayerAnimators that should be updated at each animation step
-// in the compositor.
-class COMPOSITOR_EXPORT LayerAnimatorCollection {
- public:
- explicit LayerAnimatorCollection(LayerAnimatorCollectionDelegate* delegate);
- ~LayerAnimatorCollection();
-
- void StartAnimator(scoped_refptr<LayerAnimator> animator);
- void StopAnimator(scoped_refptr<LayerAnimator> animator);
-
- bool HasActiveAnimators() const;
-
- void Progress(base::TimeTicks now);
-
- base::TimeTicks last_tick_time() const { return last_tick_time_; }
-
- private:
- LayerAnimatorCollectionDelegate* delegate_;
- base::TimeTicks last_tick_time_;
- std::set<scoped_refptr<LayerAnimator> > animators_;
-
- DISALLOW_COPY_AND_ASSIGN(LayerAnimatorCollection);
-};
-
-} // namespace ui
-
-#endif // UI_COMPOSITOR_LAYER_ANIMATOR_COLLECTION_H_
diff --git a/ui/compositor/layer_animator_unittest.cc b/ui/compositor/layer_animator_unittest.cc
index 3ae8c2b..66efca7 100644
--- a/ui/compositor/layer_animator_unittest.cc
+++ b/ui/compositor/layer_animator_unittest.cc
@@ -14,12 +14,9 @@
#include "ui/compositor/layer_animation_delegate.h"
#include "ui/compositor/layer_animation_element.h"
#include "ui/compositor/layer_animation_sequence.h"
-#include "ui/compositor/layer_animator_collection.h"
#include "ui/compositor/scoped_animation_duration_scale_mode.h"
#include "ui/compositor/scoped_layer_animation_settings.h"
-#include "ui/compositor/test/context_factories_for_test.h"
#include "ui/compositor/test/layer_animator_test_controller.h"
-#include "ui/compositor/test/test_compositor_host.h"
#include "ui/compositor/test/test_layer_animation_delegate.h"
#include "ui/compositor/test/test_layer_animation_observer.h"
#include "ui/compositor/test/test_utils.h"
@@ -27,6 +24,8 @@
#include "ui/gfx/rect.h"
#include "ui/gfx/transform.h"
+using gfx::AnimationContainerElement;
+
namespace ui {
namespace {
@@ -197,13 +196,14 @@ class TestLayerAnimationSequence : public LayerAnimationSequence {
TEST(LayerAnimatorTest, ImplicitAnimation) {
scoped_refptr<LayerAnimator> animator(
LayerAnimator::CreateImplicitAnimator());
+ AnimationContainerElement* element = animator.get();
animator->set_disable_timer_for_test(true);
TestLayerAnimationDelegate delegate;
animator->SetDelegate(&delegate);
base::TimeTicks now = gfx::FrameTime::Now();
animator->SetBrightness(0.5);
EXPECT_TRUE(animator->is_animating());
- animator->Step(now + base::TimeDelta::FromSeconds(1));
+ element->Step(now + base::TimeDelta::FromSeconds(1));
EXPECT_FLOAT_EQ(delegate.GetBrightnessForAnimation(), 0.5);
}
@@ -285,6 +285,7 @@ TEST(LayerAnimatorTest, AbortAllAnimations) {
// trivial case and should result in the animation being started immediately.
TEST(LayerAnimatorTest, ScheduleAnimationThatCanRunImmediately) {
scoped_refptr<LayerAnimator> animator(LayerAnimator::CreateDefaultAnimator());
+ AnimationContainerElement* element = animator.get();
animator->set_disable_timer_for_test(true);
TestLayerAnimationDelegate delegate;
animator->SetDelegate(&delegate);
@@ -307,12 +308,12 @@ TEST(LayerAnimatorTest, ScheduleAnimationThatCanRunImmediately) {
base::TimeTicks start_time = animator->last_step_time();
- animator->Step(start_time + base::TimeDelta::FromMilliseconds(500));
+ element->Step(start_time + base::TimeDelta::FromMilliseconds(500));
EXPECT_TRUE(animator->is_animating());
EXPECT_FLOAT_EQ(delegate.GetBrightnessForAnimation(), middle_brightness);
- animator->Step(start_time + base::TimeDelta::FromMilliseconds(1000));
+ element->Step(start_time + base::TimeDelta::FromMilliseconds(1000));
EXPECT_FALSE(animator->is_animating());
EXPECT_FLOAT_EQ(delegate.GetBrightnessForAnimation(), target_brightness);
@@ -323,7 +324,7 @@ TEST(LayerAnimatorTest, ScheduleThreadedAnimationThatCanRunImmediately) {
double epsilon = 0.00001;
LayerAnimatorTestController test_controller(
LayerAnimator::CreateDefaultAnimator());
- LayerAnimator* animator = test_controller.animator();
+ AnimationContainerElement* element = test_controller.animator();
test_controller.animator()->set_disable_timer_for_test(true);
TestLayerAnimationDelegate delegate;
test_controller.animator()->SetDelegate(&delegate);
@@ -353,7 +354,7 @@ TEST(LayerAnimatorTest, ScheduleThreadedAnimationThatCanRunImmediately) {
cc::Animation::Opacity,
effective_start));
- animator->Step(effective_start + delta / 2);
+ element->Step(effective_start + delta/2);
EXPECT_TRUE(test_controller.animator()->is_animating());
EXPECT_NEAR(
@@ -362,7 +363,7 @@ TEST(LayerAnimatorTest, ScheduleThreadedAnimationThatCanRunImmediately) {
last_progressed_fraction(),
epsilon);
- animator->Step(effective_start + delta);
+ element->Step(effective_start + delta);
EXPECT_FALSE(test_controller.animator()->is_animating());
EXPECT_FLOAT_EQ(delegate.GetOpacityForAnimation(), target_opacity);
@@ -372,6 +373,7 @@ TEST(LayerAnimatorTest, ScheduleThreadedAnimationThatCanRunImmediately) {
// should start immediately and should progress in lock step.
TEST(LayerAnimatorTest, ScheduleTwoAnimationsThatCanRunImmediately) {
scoped_refptr<LayerAnimator> animator(LayerAnimator::CreateDefaultAnimator());
+ AnimationContainerElement* element = animator.get();
animator->set_disable_timer_for_test(true);
TestLayerAnimationDelegate delegate;
animator->SetDelegate(&delegate);
@@ -405,13 +407,13 @@ TEST(LayerAnimatorTest, ScheduleTwoAnimationsThatCanRunImmediately) {
base::TimeTicks start_time = animator->last_step_time();
- animator->Step(start_time + base::TimeDelta::FromMilliseconds(500));
+ element->Step(start_time + base::TimeDelta::FromMilliseconds(500));
EXPECT_TRUE(animator->is_animating());
EXPECT_FLOAT_EQ(delegate.GetBrightnessForAnimation(), middle_brightness);
CheckApproximatelyEqual(delegate.GetBoundsForAnimation(), middle_bounds);
- animator->Step(start_time + base::TimeDelta::FromMilliseconds(1000));
+ element->Step(start_time + base::TimeDelta::FromMilliseconds(1000));
EXPECT_FALSE(animator->is_animating());
EXPECT_FLOAT_EQ(delegate.GetBrightnessForAnimation(), target_brightness);
@@ -424,7 +426,7 @@ TEST(LayerAnimatorTest, ScheduleThreadedAndNonThreadedAnimations) {
double epsilon = 0.00001;
LayerAnimatorTestController test_controller(
LayerAnimator::CreateDefaultAnimator());
- LayerAnimator* animator = test_controller.animator();
+ AnimationContainerElement* element = test_controller.animator();
test_controller.animator()->set_disable_timer_for_test(true);
TestLayerAnimationDelegate delegate;
test_controller.animator()->SetDelegate(&delegate);
@@ -468,7 +470,7 @@ TEST(LayerAnimatorTest, ScheduleThreadedAndNonThreadedAnimations) {
cc::Animation::Opacity,
effective_start));
- animator->Step(effective_start + delta / 2);
+ element->Step(effective_start + delta/2);
EXPECT_TRUE(test_controller.animator()->is_animating());
EXPECT_NEAR(
@@ -478,7 +480,7 @@ TEST(LayerAnimatorTest, ScheduleThreadedAndNonThreadedAnimations) {
epsilon);
CheckApproximatelyEqual(delegate.GetBoundsForAnimation(), middle_bounds);
- animator->Step(effective_start + delta);
+ element->Step(effective_start + delta);
EXPECT_FALSE(test_controller.animator()->is_animating());
EXPECT_FLOAT_EQ(delegate.GetOpacityForAnimation(), target_opacity);
@@ -489,6 +491,7 @@ TEST(LayerAnimatorTest, ScheduleThreadedAndNonThreadedAnimations) {
// animations should run one after another.
TEST(LayerAnimatorTest, ScheduleTwoAnimationsOnSameProperty) {
scoped_refptr<LayerAnimator> animator(LayerAnimator::CreateDefaultAnimator());
+ AnimationContainerElement* element = animator.get();
animator->set_disable_timer_for_test(true);
TestLayerAnimationDelegate delegate;
animator->SetDelegate(&delegate);
@@ -516,22 +519,22 @@ TEST(LayerAnimatorTest, ScheduleTwoAnimationsOnSameProperty) {
base::TimeTicks start_time = animator->last_step_time();
- animator->Step(start_time + base::TimeDelta::FromMilliseconds(500));
+ element->Step(start_time + base::TimeDelta::FromMilliseconds(500));
EXPECT_TRUE(animator->is_animating());
EXPECT_FLOAT_EQ(delegate.GetBrightnessForAnimation(), middle_brightness);
- animator->Step(start_time + base::TimeDelta::FromMilliseconds(1000));
+ element->Step(start_time + base::TimeDelta::FromMilliseconds(1000));
EXPECT_TRUE(animator->is_animating());
EXPECT_FLOAT_EQ(delegate.GetBrightnessForAnimation(), target_brightness);
- animator->Step(start_time + base::TimeDelta::FromMilliseconds(1500));
+ element->Step(start_time + base::TimeDelta::FromMilliseconds(1500));
EXPECT_TRUE(animator->is_animating());
EXPECT_FLOAT_EQ(delegate.GetBrightnessForAnimation(), middle_brightness);
- animator->Step(start_time + base::TimeDelta::FromMilliseconds(2000));
+ element->Step(start_time + base::TimeDelta::FromMilliseconds(2000));
EXPECT_FALSE(animator->is_animating());
EXPECT_FLOAT_EQ(delegate.GetBrightnessForAnimation(), start_brightness);
@@ -542,6 +545,7 @@ TEST(LayerAnimatorTest, ScheduleTwoAnimationsOnSameProperty) {
// order.
TEST(LayerAnimatorTest, ScheduleBlockedAnimation) {
scoped_refptr<LayerAnimator> animator(LayerAnimator::CreateDefaultAnimator());
+ AnimationContainerElement* element = animator.get();
animator->set_disable_timer_for_test(true);
TestLayerAnimationDelegate delegate;
animator->SetDelegate(&delegate);
@@ -585,31 +589,31 @@ TEST(LayerAnimatorTest, ScheduleBlockedAnimation) {
base::TimeTicks start_time = animator->last_step_time();
- animator->Step(start_time + base::TimeDelta::FromMilliseconds(500));
+ element->Step(start_time + base::TimeDelta::FromMilliseconds(500));
EXPECT_TRUE(animator->is_animating());
EXPECT_FLOAT_EQ(delegate.GetGrayscaleForAnimation(), middle_grayscale);
CheckApproximatelyEqual(delegate.GetBoundsForAnimation(), start_bounds);
- animator->Step(start_time + base::TimeDelta::FromMilliseconds(1000));
+ element->Step(start_time + base::TimeDelta::FromMilliseconds(1000));
EXPECT_TRUE(animator->is_animating());
EXPECT_FLOAT_EQ(delegate.GetGrayscaleForAnimation(), target_grayscale);
CheckApproximatelyEqual(delegate.GetBoundsForAnimation(), start_bounds);
- animator->Step(start_time + base::TimeDelta::FromMilliseconds(2000));
+ element->Step(start_time + base::TimeDelta::FromMilliseconds(2000));
EXPECT_TRUE(animator->is_animating());
EXPECT_FLOAT_EQ(delegate.GetGrayscaleForAnimation(), start_grayscale);
CheckApproximatelyEqual(delegate.GetBoundsForAnimation(), start_bounds);
- animator->Step(start_time + base::TimeDelta::FromMilliseconds(3000));
+ element->Step(start_time + base::TimeDelta::FromMilliseconds(3000));
EXPECT_TRUE(animator->is_animating());
EXPECT_FLOAT_EQ(delegate.GetGrayscaleForAnimation(), start_grayscale);
CheckApproximatelyEqual(delegate.GetBoundsForAnimation(), target_bounds);
- animator->Step(start_time + base::TimeDelta::FromMilliseconds(4000));
+ element->Step(start_time + base::TimeDelta::FromMilliseconds(4000));
EXPECT_FALSE(animator->is_animating());
EXPECT_FLOAT_EQ(delegate.GetGrayscaleForAnimation(), start_grayscale);
@@ -621,6 +625,7 @@ TEST(LayerAnimatorTest, ScheduleBlockedAnimation) {
// the second grayscale animation starts.
TEST(LayerAnimatorTest, ScheduleTogether) {
scoped_refptr<LayerAnimator> animator(LayerAnimator::CreateDefaultAnimator());
+ AnimationContainerElement* element = animator.get();
animator->set_disable_timer_for_test(true);
TestLayerAnimationDelegate delegate;
animator->SetDelegate(&delegate);
@@ -657,13 +662,13 @@ TEST(LayerAnimatorTest, ScheduleTogether) {
base::TimeTicks start_time = animator->last_step_time();
- animator->Step(start_time + base::TimeDelta::FromMilliseconds(1000));
+ element->Step(start_time + base::TimeDelta::FromMilliseconds(1000));
EXPECT_TRUE(animator->is_animating());
EXPECT_FLOAT_EQ(delegate.GetGrayscaleForAnimation(), target_grayscale);
CheckApproximatelyEqual(delegate.GetBoundsForAnimation(), start_bounds);
- animator->Step(start_time + base::TimeDelta::FromMilliseconds(2000));
+ element->Step(start_time + base::TimeDelta::FromMilliseconds(2000));
EXPECT_FALSE(animator->is_animating());
EXPECT_FLOAT_EQ(delegate.GetGrayscaleForAnimation(), start_grayscale);
@@ -674,6 +679,7 @@ TEST(LayerAnimatorTest, ScheduleTogether) {
// case (see the trival case for ScheduleAnimation).
TEST(LayerAnimatorTest, StartAnimationThatCanRunImmediately) {
scoped_refptr<LayerAnimator> animator(LayerAnimator::CreateDefaultAnimator());
+ AnimationContainerElement* element = animator.get();
animator->set_disable_timer_for_test(true);
TestLayerAnimationDelegate delegate;
animator->SetDelegate(&delegate);
@@ -696,12 +702,12 @@ TEST(LayerAnimatorTest, StartAnimationThatCanRunImmediately) {
base::TimeTicks start_time = animator->last_step_time();
- animator->Step(start_time + base::TimeDelta::FromMilliseconds(500));
+ element->Step(start_time + base::TimeDelta::FromMilliseconds(500));
EXPECT_TRUE(animator->is_animating());
EXPECT_FLOAT_EQ(delegate.GetBrightnessForAnimation(), middle_brightness);
- animator->Step(start_time + base::TimeDelta::FromMilliseconds(1000));
+ element->Step(start_time + base::TimeDelta::FromMilliseconds(1000));
EXPECT_FALSE(animator->is_animating());
EXPECT_FLOAT_EQ(delegate.GetBrightnessForAnimation(), target_brightness);
@@ -712,7 +718,7 @@ TEST(LayerAnimatorTest, StartThreadedAnimationThatCanRunImmediately) {
double epsilon = 0.00001;
LayerAnimatorTestController test_controller(
LayerAnimator::CreateDefaultAnimator());
- LayerAnimator* animator = test_controller.animator();
+ AnimationContainerElement* element = test_controller.animator();
test_controller.animator()->set_disable_timer_for_test(true);
TestLayerAnimationDelegate delegate;
test_controller.animator()->SetDelegate(&delegate);
@@ -742,7 +748,7 @@ TEST(LayerAnimatorTest, StartThreadedAnimationThatCanRunImmediately) {
cc::Animation::Opacity,
effective_start));
- animator->Step(effective_start + delta / 2);
+ element->Step(effective_start + delta/2);
EXPECT_TRUE(test_controller.animator()->is_animating());
EXPECT_NEAR(
@@ -751,7 +757,7 @@ TEST(LayerAnimatorTest, StartThreadedAnimationThatCanRunImmediately) {
last_progressed_fraction(),
epsilon);
- animator->Step(effective_start + delta);
+ element->Step(effective_start + delta);
EXPECT_FALSE(test_controller.animator()->is_animating());
EXPECT_FLOAT_EQ(delegate.GetOpacityForAnimation(), target_opacity);
}
@@ -787,6 +793,7 @@ TEST(LayerAnimatorTest, PreemptBySettingNewTarget) {
// Preempt by animating to new target, with a non-threaded animation.
TEST(LayerAnimatorTest, PreemptByImmediatelyAnimatingToNewTarget) {
scoped_refptr<LayerAnimator> animator(LayerAnimator::CreateDefaultAnimator());
+ AnimationContainerElement* element = animator.get();
animator->set_disable_timer_for_test(true);
TestLayerAnimationDelegate delegate;
animator->SetDelegate(&delegate);
@@ -809,7 +816,7 @@ TEST(LayerAnimatorTest, PreemptByImmediatelyAnimatingToNewTarget) {
base::TimeTicks start_time = animator->last_step_time();
- animator->Step(start_time + base::TimeDelta::FromMilliseconds(500));
+ element->Step(start_time + base::TimeDelta::FromMilliseconds(500));
animator->StartAnimation(
new LayerAnimationSequence(
@@ -826,13 +833,13 @@ TEST(LayerAnimatorTest, PreemptByImmediatelyAnimatingToNewTarget) {
EXPECT_TRUE(animator->is_animating());
- animator->Step(start_time + base::TimeDelta::FromMilliseconds(1000));
+ element->Step(start_time + base::TimeDelta::FromMilliseconds(1000));
EXPECT_TRUE(animator->is_animating());
EXPECT_FLOAT_EQ(delegate.GetBrightnessForAnimation(),
0.5 * (start_brightness + middle_brightness));
- animator->Step(start_time + base::TimeDelta::FromMilliseconds(1500));
+ element->Step(start_time + base::TimeDelta::FromMilliseconds(1500));
EXPECT_FALSE(animator->is_animating());
EXPECT_FLOAT_EQ(delegate.GetBrightnessForAnimation(), start_brightness);
@@ -843,7 +850,7 @@ TEST(LayerAnimatorTest, PreemptThreadedByImmediatelyAnimatingToNewTarget) {
double epsilon = 0.00001;
LayerAnimatorTestController test_controller(
LayerAnimator::CreateDefaultAnimator());
- LayerAnimator* animator = test_controller.animator();
+ AnimationContainerElement* element = test_controller.animator();
test_controller.animator()->set_disable_timer_for_test(true);
TestLayerAnimationDelegate delegate;
test_controller.animator()->SetDelegate(&delegate);
@@ -874,7 +881,7 @@ TEST(LayerAnimatorTest, PreemptThreadedByImmediatelyAnimatingToNewTarget) {
cc::Animation::Opacity,
effective_start));
- animator->Step(effective_start + delta / 2);
+ element->Step(effective_start + delta/2);
test_controller.animator()->StartAnimation(
new LayerAnimationSequence(
@@ -899,7 +906,7 @@ TEST(LayerAnimatorTest, PreemptThreadedByImmediatelyAnimatingToNewTarget) {
cc::Animation::Opacity,
second_effective_start));
- animator->Step(second_effective_start + delta / 2);
+ element->Step(second_effective_start + delta/2);
EXPECT_TRUE(test_controller.animator()->is_animating());
EXPECT_NEAR(
@@ -908,7 +915,7 @@ TEST(LayerAnimatorTest, PreemptThreadedByImmediatelyAnimatingToNewTarget) {
last_progressed_fraction(),
epsilon);
- animator->Step(second_effective_start + delta);
+ element->Step(second_effective_start + delta);
EXPECT_FALSE(test_controller.animator()->is_animating());
EXPECT_FLOAT_EQ(delegate.GetOpacityForAnimation(), start_opacity);
@@ -917,6 +924,7 @@ TEST(LayerAnimatorTest, PreemptThreadedByImmediatelyAnimatingToNewTarget) {
// Preempt by enqueuing the new animation.
TEST(LayerAnimatorTest, PreemptEnqueueNewAnimation) {
scoped_refptr<LayerAnimator> animator(LayerAnimator::CreateDefaultAnimator());
+ AnimationContainerElement* element = animator.get();
animator->set_disable_timer_for_test(true);
TestLayerAnimationDelegate delegate;
animator->SetDelegate(&delegate);
@@ -938,7 +946,7 @@ TEST(LayerAnimatorTest, PreemptEnqueueNewAnimation) {
base::TimeTicks start_time = animator->last_step_time();
- animator->Step(start_time + base::TimeDelta::FromMilliseconds(500));
+ element->Step(start_time + base::TimeDelta::FromMilliseconds(500));
animator->StartAnimation(
new LayerAnimationSequence(
@@ -950,17 +958,17 @@ TEST(LayerAnimatorTest, PreemptEnqueueNewAnimation) {
EXPECT_TRUE(animator->is_animating());
- animator->Step(start_time + base::TimeDelta::FromMilliseconds(1000));
+ element->Step(start_time + base::TimeDelta::FromMilliseconds(1000));
EXPECT_TRUE(animator->is_animating());
EXPECT_FLOAT_EQ(delegate.GetBrightnessForAnimation(), target_brightness);
- animator->Step(start_time + base::TimeDelta::FromMilliseconds(1500));
+ element->Step(start_time + base::TimeDelta::FromMilliseconds(1500));
EXPECT_TRUE(animator->is_animating());
EXPECT_FLOAT_EQ(delegate.GetBrightnessForAnimation(), middle_brightness);
- animator->Step(start_time + base::TimeDelta::FromMilliseconds(2000));
+ element->Step(start_time + base::TimeDelta::FromMilliseconds(2000));
EXPECT_FALSE(animator->is_animating());
EXPECT_FLOAT_EQ(delegate.GetBrightnessForAnimation(), start_brightness);
@@ -971,6 +979,7 @@ TEST(LayerAnimatorTest, PreemptEnqueueNewAnimation) {
// animation started.
TEST(LayerAnimatorTest, PreemptyByReplacingQueuedAnimations) {
scoped_refptr<LayerAnimator> animator(LayerAnimator::CreateDefaultAnimator());
+ AnimationContainerElement* element = animator.get();
animator->set_disable_timer_for_test(true);
TestLayerAnimationDelegate delegate;
animator->SetDelegate(&delegate);
@@ -992,7 +1001,7 @@ TEST(LayerAnimatorTest, PreemptyByReplacingQueuedAnimations) {
base::TimeTicks start_time = animator->last_step_time();
- animator->Step(start_time + base::TimeDelta::FromMilliseconds(500));
+ element->Step(start_time + base::TimeDelta::FromMilliseconds(500));
animator->StartAnimation(
new LayerAnimationSequence(
@@ -1009,17 +1018,17 @@ TEST(LayerAnimatorTest, PreemptyByReplacingQueuedAnimations) {
EXPECT_TRUE(animator->is_animating());
EXPECT_FLOAT_EQ(delegate.GetBrightnessForAnimation(), middle_brightness);
- animator->Step(start_time + base::TimeDelta::FromMilliseconds(1000));
+ element->Step(start_time + base::TimeDelta::FromMilliseconds(1000));
EXPECT_TRUE(animator->is_animating());
EXPECT_FLOAT_EQ(delegate.GetBrightnessForAnimation(), target_brightness);
- animator->Step(start_time + base::TimeDelta::FromMilliseconds(1500));
+ element->Step(start_time + base::TimeDelta::FromMilliseconds(1500));
EXPECT_TRUE(animator->is_animating());
EXPECT_FLOAT_EQ(delegate.GetBrightnessForAnimation(), middle_brightness);
- animator->Step(start_time + base::TimeDelta::FromMilliseconds(2000));
+ element->Step(start_time + base::TimeDelta::FromMilliseconds(2000));
EXPECT_FALSE(animator->is_animating());
EXPECT_FLOAT_EQ(delegate.GetBrightnessForAnimation(), start_brightness);
@@ -1104,6 +1113,7 @@ TEST(LayerAnimatorTest, MultiPreemptBySettingNewTarget) {
// Preempt by animating to new target.
TEST(LayerAnimatorTest, MultiPreemptByImmediatelyAnimatingToNewTarget) {
scoped_refptr<LayerAnimator> animator(LayerAnimator::CreateDefaultAnimator());
+ AnimationContainerElement* element = animator.get();
animator->set_disable_timer_for_test(true);
TestLayerAnimationDelegate delegate;
animator->SetDelegate(&delegate);
@@ -1134,7 +1144,7 @@ TEST(LayerAnimatorTest, MultiPreemptByImmediatelyAnimatingToNewTarget) {
base::TimeTicks start_time = animator->last_step_time();
- animator->Step(start_time + base::TimeDelta::FromMilliseconds(500));
+ element->Step(start_time + base::TimeDelta::FromMilliseconds(500));
animator->StartTogether(
CreateMultiSequence(
@@ -1154,7 +1164,7 @@ TEST(LayerAnimatorTest, MultiPreemptByImmediatelyAnimatingToNewTarget) {
EXPECT_TRUE(animator->is_animating());
- animator->Step(start_time + base::TimeDelta::FromMilliseconds(1000));
+ element->Step(start_time + base::TimeDelta::FromMilliseconds(1000));
EXPECT_TRUE(animator->is_animating());
EXPECT_FLOAT_EQ(delegate.GetGrayscaleForAnimation(),
@@ -1162,7 +1172,7 @@ TEST(LayerAnimatorTest, MultiPreemptByImmediatelyAnimatingToNewTarget) {
EXPECT_FLOAT_EQ(delegate.GetBrightnessForAnimation(),
0.5 * (start_brightness + middle_brightness));
- animator->Step(start_time + base::TimeDelta::FromMilliseconds(1500));
+ element->Step(start_time + base::TimeDelta::FromMilliseconds(1500));
EXPECT_FALSE(animator->is_animating());
EXPECT_FLOAT_EQ(delegate.GetGrayscaleForAnimation(), start_grayscale);
@@ -1174,7 +1184,7 @@ TEST(LayerAnimatorTest, MultiPreemptThreadedByImmediatelyAnimatingToNewTarget) {
double epsilon = 0.00001;
LayerAnimatorTestController test_controller(
LayerAnimator::CreateDefaultAnimator());
- LayerAnimator* animator = test_controller.animator();
+ AnimationContainerElement* element = test_controller.animator();
test_controller.animator()->set_disable_timer_for_test(true);
TestLayerAnimationDelegate delegate;
test_controller.animator()->SetDelegate(&delegate);
@@ -1213,7 +1223,7 @@ TEST(LayerAnimatorTest, MultiPreemptThreadedByImmediatelyAnimatingToNewTarget) {
cc::Animation::Opacity,
effective_start));
- animator->Step(effective_start + delta / 2);
+ element->Step(effective_start + delta/2);
test_controller.animator()->StartTogether(
CreateMultiSequence(
@@ -1243,7 +1253,7 @@ TEST(LayerAnimatorTest, MultiPreemptThreadedByImmediatelyAnimatingToNewTarget) {
cc::Animation::Opacity,
second_effective_start));
- animator->Step(second_effective_start + delta / 2);
+ element->Step(second_effective_start + delta/2);
EXPECT_TRUE(test_controller.animator()->is_animating());
EXPECT_NEAR(
@@ -1255,7 +1265,7 @@ TEST(LayerAnimatorTest, MultiPreemptThreadedByImmediatelyAnimatingToNewTarget) {
0.5 * (start_brightness + middle_brightness),
epsilon);
- animator->Step(second_effective_start + delta);
+ element->Step(second_effective_start + delta);
EXPECT_FALSE(test_controller.animator()->is_animating());
EXPECT_FLOAT_EQ(delegate.GetOpacityForAnimation(), start_opacity);
@@ -1265,6 +1275,7 @@ TEST(LayerAnimatorTest, MultiPreemptThreadedByImmediatelyAnimatingToNewTarget) {
// Preempt by enqueuing the new animation.
TEST(LayerAnimatorTest, MultiPreemptEnqueueNewAnimation) {
scoped_refptr<LayerAnimator> animator(LayerAnimator::CreateDefaultAnimator());
+ AnimationContainerElement* element = animator.get();
animator->set_disable_timer_for_test(true);
TestLayerAnimationDelegate delegate;
animator->SetDelegate(&delegate);
@@ -1293,7 +1304,7 @@ TEST(LayerAnimatorTest, MultiPreemptEnqueueNewAnimation) {
base::TimeTicks start_time = animator->last_step_time();
- animator->Step(start_time + base::TimeDelta::FromMilliseconds(500));
+ element->Step(start_time + base::TimeDelta::FromMilliseconds(500));
animator->StartTogether(
CreateMultiSequence(
@@ -1307,19 +1318,19 @@ TEST(LayerAnimatorTest, MultiPreemptEnqueueNewAnimation) {
EXPECT_TRUE(animator->is_animating());
- animator->Step(start_time + base::TimeDelta::FromMilliseconds(1000));
+ element->Step(start_time + base::TimeDelta::FromMilliseconds(1000));
EXPECT_TRUE(animator->is_animating());
EXPECT_FLOAT_EQ(delegate.GetGrayscaleForAnimation(), target_grayscale);
EXPECT_FLOAT_EQ(delegate.GetBrightnessForAnimation(), target_brightness);
- animator->Step(start_time + base::TimeDelta::FromMilliseconds(1500));
+ element->Step(start_time + base::TimeDelta::FromMilliseconds(1500));
EXPECT_TRUE(animator->is_animating());
EXPECT_FLOAT_EQ(delegate.GetGrayscaleForAnimation(), middle_grayscale);
EXPECT_FLOAT_EQ(delegate.GetBrightnessForAnimation(), middle_brightness);
- animator->Step(start_time + base::TimeDelta::FromMilliseconds(2000));
+ element->Step(start_time + base::TimeDelta::FromMilliseconds(2000));
EXPECT_FALSE(animator->is_animating());
EXPECT_FLOAT_EQ(delegate.GetGrayscaleForAnimation(), start_grayscale);
@@ -1331,6 +1342,7 @@ TEST(LayerAnimatorTest, MultiPreemptEnqueueNewAnimation) {
// animation started.
TEST(LayerAnimatorTest, MultiPreemptByReplacingQueuedAnimations) {
scoped_refptr<LayerAnimator> animator(LayerAnimator::CreateDefaultAnimator());
+ AnimationContainerElement* element = animator.get();
animator->set_disable_timer_for_test(true);
TestLayerAnimationDelegate delegate;
animator->SetDelegate(&delegate);
@@ -1359,7 +1371,7 @@ TEST(LayerAnimatorTest, MultiPreemptByReplacingQueuedAnimations) {
base::TimeTicks start_time = animator->last_step_time();
- animator->Step(start_time + base::TimeDelta::FromMilliseconds(500));
+ element->Step(start_time + base::TimeDelta::FromMilliseconds(500));
animator->StartTogether(
CreateMultiSequence(
@@ -1380,19 +1392,19 @@ TEST(LayerAnimatorTest, MultiPreemptByReplacingQueuedAnimations) {
EXPECT_FLOAT_EQ(delegate.GetGrayscaleForAnimation(), middle_grayscale);
EXPECT_FLOAT_EQ(delegate.GetBrightnessForAnimation(), middle_brightness);
- animator->Step(start_time + base::TimeDelta::FromMilliseconds(1000));
+ element->Step(start_time + base::TimeDelta::FromMilliseconds(1000));
EXPECT_TRUE(animator->is_animating());
EXPECT_FLOAT_EQ(delegate.GetGrayscaleForAnimation(), target_grayscale);
EXPECT_FLOAT_EQ(delegate.GetBrightnessForAnimation(), target_brightness);
- animator->Step(start_time + base::TimeDelta::FromMilliseconds(1500));
+ element->Step(start_time + base::TimeDelta::FromMilliseconds(1500));
EXPECT_TRUE(animator->is_animating());
EXPECT_FLOAT_EQ(delegate.GetGrayscaleForAnimation(), middle_grayscale);
EXPECT_FLOAT_EQ(delegate.GetBrightnessForAnimation(), middle_brightness);
- animator->Step(start_time + base::TimeDelta::FromMilliseconds(2000));
+ element->Step(start_time + base::TimeDelta::FromMilliseconds(2000));
EXPECT_FALSE(animator->is_animating());
EXPECT_FLOAT_EQ(delegate.GetGrayscaleForAnimation(), start_grayscale);
@@ -1402,6 +1414,7 @@ TEST(LayerAnimatorTest, MultiPreemptByReplacingQueuedAnimations) {
// Test that non-threaded cyclic sequences continue to animate.
TEST(LayerAnimatorTest, CyclicSequences) {
scoped_refptr<LayerAnimator> animator(LayerAnimator::CreateDefaultAnimator());
+ AnimationContainerElement* element = animator.get();
animator->set_disable_timer_for_test(true);
TestLayerAnimationDelegate delegate;
animator->SetDelegate(&delegate);
@@ -1427,29 +1440,29 @@ TEST(LayerAnimatorTest, CyclicSequences) {
base::TimeTicks start_time = animator->last_step_time();
- animator->Step(start_time + base::TimeDelta::FromMilliseconds(1000));
+ element->Step(start_time + base::TimeDelta::FromMilliseconds(1000));
EXPECT_TRUE(animator->is_animating());
EXPECT_FLOAT_EQ(delegate.GetBrightnessForAnimation(), target_brightness);
- animator->Step(start_time + base::TimeDelta::FromMilliseconds(2000));
+ element->Step(start_time + base::TimeDelta::FromMilliseconds(2000));
EXPECT_TRUE(animator->is_animating());
EXPECT_FLOAT_EQ(delegate.GetBrightnessForAnimation(), start_brightness);
- animator->Step(start_time + base::TimeDelta::FromMilliseconds(3000));
+ element->Step(start_time + base::TimeDelta::FromMilliseconds(3000));
EXPECT_TRUE(animator->is_animating());
EXPECT_FLOAT_EQ(delegate.GetBrightnessForAnimation(), target_brightness);
// Skip ahead by a lot.
- animator->Step(start_time + base::TimeDelta::FromMilliseconds(1000000000));
+ element->Step(start_time + base::TimeDelta::FromMilliseconds(1000000000));
EXPECT_TRUE(animator->is_animating());
EXPECT_FLOAT_EQ(delegate.GetBrightnessForAnimation(), start_brightness);
// Skip ahead by a lot.
- animator->Step(start_time + base::TimeDelta::FromMilliseconds(1000001000));
+ element->Step(start_time + base::TimeDelta::FromMilliseconds(1000001000));
EXPECT_TRUE(animator->is_animating());
EXPECT_FLOAT_EQ(delegate.GetBrightnessForAnimation(), target_brightness);
@@ -1463,7 +1476,7 @@ TEST(LayerAnimatorTest, CyclicSequences) {
TEST(LayerAnimatorTest, ThreadedCyclicSequences) {
LayerAnimatorTestController test_controller(
LayerAnimator::CreateDefaultAnimator());
- LayerAnimator* animator = test_controller.animator();
+ AnimationContainerElement* element = test_controller.animator();
test_controller.animator()->set_disable_timer_for_test(true);
TestLayerAnimationDelegate delegate;
test_controller.animator()->SetDelegate(&delegate);
@@ -1497,7 +1510,7 @@ TEST(LayerAnimatorTest, ThreadedCyclicSequences) {
cc::Animation::Opacity,
effective_start));
- animator->Step(effective_start + delta);
+ element->Step(effective_start + delta);
EXPECT_TRUE(test_controller.animator()->is_animating());
EXPECT_FLOAT_EQ(delegate.GetOpacityForAnimation(), target_opacity);
@@ -1510,7 +1523,7 @@ TEST(LayerAnimatorTest, ThreadedCyclicSequences) {
cc::Animation::Opacity,
second_effective_start));
- animator->Step(second_effective_start + delta);
+ element->Step(second_effective_start + delta);
EXPECT_TRUE(test_controller.animator()->is_animating());
EXPECT_FLOAT_EQ(delegate.GetOpacityForAnimation(), start_opacity);
@@ -1524,7 +1537,7 @@ TEST(LayerAnimatorTest, ThreadedCyclicSequences) {
cc::Animation::Opacity,
third_effective_start));
- animator->Step(third_effective_start + delta);
+ element->Step(third_effective_start + delta);
EXPECT_TRUE(test_controller.animator()->is_animating());
EXPECT_FLOAT_EQ(delegate.GetOpacityForAnimation(), target_opacity);
@@ -1538,7 +1551,7 @@ TEST(LayerAnimatorTest, ThreadedCyclicSequences) {
fourth_effective_start));
// Skip ahead by a lot.
- animator->Step(fourth_effective_start + 1000 * delta);
+ element->Step(fourth_effective_start + 1000 * delta);
EXPECT_TRUE(test_controller.animator()->is_animating());
EXPECT_FLOAT_EQ(delegate.GetOpacityForAnimation(), target_opacity);
@@ -1553,7 +1566,7 @@ TEST(LayerAnimatorTest, ThreadedCyclicSequences) {
fifth_effective_start));
// Skip ahead by a lot.
- animator->Step(fifth_effective_start + 999 * delta);
+ element->Step(fifth_effective_start + 999 * delta);
EXPECT_TRUE(test_controller.animator()->is_animating());
EXPECT_FLOAT_EQ(delegate.GetOpacityForAnimation(), start_opacity);
@@ -1566,6 +1579,7 @@ TEST(LayerAnimatorTest, ThreadedCyclicSequences) {
TEST(LayerAnimatorTest, AddObserverExplicit) {
scoped_refptr<LayerAnimator> animator(LayerAnimator::CreateDefaultAnimator());
+ AnimationContainerElement* element = animator.get();
animator->set_disable_timer_for_test(true);
TestLayerAnimationObserver observer;
TestLayerAnimationDelegate delegate;
@@ -1588,7 +1602,7 @@ TEST(LayerAnimatorTest, AddObserverExplicit) {
base::TimeTicks start_time = animator->last_step_time();
- animator->Step(start_time + base::TimeDelta::FromMilliseconds(1000));
+ element->Step(start_time + base::TimeDelta::FromMilliseconds(1000));
EXPECT_EQ(observer.last_ended_sequence(), sequence);
@@ -1607,6 +1621,7 @@ TEST(LayerAnimatorTest, AddObserverExplicit) {
// when the object goes out of scope.
TEST(LayerAnimatorTest, ImplicitAnimationObservers) {
scoped_refptr<LayerAnimator> animator(LayerAnimator::CreateDefaultAnimator());
+ AnimationContainerElement* element = animator.get();
animator->set_disable_timer_for_test(true);
TestImplicitAnimationObserver observer(false);
TestLayerAnimationDelegate delegate;
@@ -1623,7 +1638,7 @@ TEST(LayerAnimatorTest, ImplicitAnimationObservers) {
EXPECT_FALSE(observer.animations_completed());
base::TimeTicks start_time = animator->last_step_time();
- animator->Step(start_time + base::TimeDelta::FromMilliseconds(1000));
+ element->Step(start_time + base::TimeDelta::FromMilliseconds(1000));
EXPECT_TRUE(observer.animations_completed());
EXPECT_TRUE(observer.WasAnimationCompletedForProperty(
LayerAnimationElement::BRIGHTNESS));
@@ -1665,6 +1680,7 @@ TEST(LayerAnimatorTest, AnimatorKeptAliveBySettings) {
TestLayerAnimator* animator = new TestLayerAnimator();
LayerAnimatorDestructionObserver destruction_observer;
animator->SetDestructionObserver(&destruction_observer);
+ AnimationContainerElement* element = animator;
animator->set_disable_timer_for_test(true);
TestLayerAnimationDelegate delegate;
animator->SetDelegate(&delegate);
@@ -1674,7 +1690,7 @@ TEST(LayerAnimatorTest, AnimatorKeptAliveBySettings) {
ScopedLayerAnimationSettings settings(animator);
base::TimeTicks now = gfx::FrameTime::Now();
animator->SetBrightness(0.5);
- animator->Step(now + base::TimeDelta::FromSeconds(1));
+ element->Step(now + base::TimeDelta::FromSeconds(1));
EXPECT_FALSE(destruction_observer.IsAnimatorDeleted());
}
// ScopedLayerAnimationSettings was destroyed, so Animator should be deleted.
@@ -1754,6 +1770,7 @@ TEST(LayerAnimatorTest, AbortedAnimationStatusInImplicitObservers) {
TEST(LayerAnimatorTest, RemoveObserverShouldRemoveFromSequences) {
scoped_refptr<LayerAnimator> animator(LayerAnimator::CreateDefaultAnimator());
+ AnimationContainerElement* element = animator.get();
animator->set_disable_timer_for_test(true);
TestLayerAnimationObserver observer;
TestLayerAnimationObserver removed_observer;
@@ -1780,7 +1797,7 @@ TEST(LayerAnimatorTest, RemoveObserverShouldRemoveFromSequences) {
base::TimeTicks start_time = animator->last_step_time();
- animator->Step(start_time + base::TimeDelta::FromMilliseconds(1000));
+ element->Step(start_time + base::TimeDelta::FromMilliseconds(1000));
EXPECT_EQ(observer.last_ended_sequence(), sequence);
EXPECT_TRUE(!removed_observer.last_ended_sequence());
@@ -1816,6 +1833,7 @@ TEST(LayerAnimatorTest, ObserverReleasedBeforeAnimationSequenceEnds) {
TEST(LayerAnimatorTest, ObserverAttachedAfterAnimationStarted) {
scoped_refptr<LayerAnimator> animator(LayerAnimator::CreateDefaultAnimator());
+ AnimationContainerElement* element = animator.get();
animator->set_disable_timer_for_test(true);
TestImplicitAnimationObserver observer(false);
@@ -1833,14 +1851,14 @@ TEST(LayerAnimatorTest, ObserverAttachedAfterAnimationStarted) {
animator->StartAnimation(sequence);
base::TimeTicks start_time = animator->last_step_time();
- animator->Step(start_time + base::TimeDelta::FromMilliseconds(500));
+ element->Step(start_time + base::TimeDelta::FromMilliseconds(500));
setter.AddObserver(&observer);
// Start observing an in-flight animation.
sequence->AddObserver(&observer);
- animator->Step(start_time + base::TimeDelta::FromMilliseconds(1000));
+ element->Step(start_time + base::TimeDelta::FromMilliseconds(1000));
}
EXPECT_TRUE(observer.animations_completed());
@@ -1850,6 +1868,7 @@ TEST(LayerAnimatorTest, ObserverAttachedAfterAnimationStarted) {
TEST(LayerAnimatorTest, ObserverDetachedBeforeAnimationFinished) {
scoped_refptr<LayerAnimator> animator(LayerAnimator::CreateDefaultAnimator());
+ AnimationContainerElement* element = animator.get();
animator->set_disable_timer_for_test(true);
TestImplicitAnimationObserver observer(false);
@@ -1867,7 +1886,7 @@ TEST(LayerAnimatorTest, ObserverDetachedBeforeAnimationFinished) {
animator->StartAnimation(sequence);
base::TimeTicks start_time = animator->last_step_time();
- animator->Step(start_time + base::TimeDelta::FromMilliseconds(500));
+ element->Step(start_time + base::TimeDelta::FromMilliseconds(500));
}
EXPECT_FALSE(observer.animations_completed());
@@ -1893,6 +1912,7 @@ TEST(LayerAnimatorTest, ObserverDeletesAnimationsOnEnd) {
ScopedAnimationDurationScaleMode normal_duration_mode(
ScopedAnimationDurationScaleMode::NORMAL_DURATION);
scoped_refptr<LayerAnimator> animator(new TestLayerAnimator());
+ AnimationContainerElement* element = animator.get();
animator->set_disable_timer_for_test(true);
TestLayerAnimationDelegate delegate;
animator->SetDelegate(&delegate);
@@ -1926,7 +1946,7 @@ TEST(LayerAnimatorTest, ObserverDeletesAnimationsOnEnd) {
ASSERT_TRUE(animator->IsAnimatingProperty(LayerAnimationElement::BOUNDS));
base::TimeTicks start_time = animator->last_step_time();
- animator->Step(start_time + halfway_delta);
+ element->Step(start_time + halfway_delta);
// Completing the brightness animation should have stopped the bounds
// animation.
@@ -1962,6 +1982,7 @@ TEST(LayerAnimatorTest, CallbackDeletesAnimationInProgress) {
ScopedAnimationDurationScaleMode normal_duration_mode(
ScopedAnimationDurationScaleMode::NORMAL_DURATION);
scoped_refptr<LayerAnimator> animator(new TestLayerAnimator());
+ AnimationContainerElement* element = animator.get();
animator->set_disable_timer_for_test(true);
TestLayerAnimationDeletingDelegate delegate(animator.get(), 30);
animator->SetDelegate(&delegate);
@@ -1982,14 +2003,14 @@ TEST(LayerAnimatorTest, CallbackDeletesAnimationInProgress) {
ASSERT_TRUE(animator->IsAnimatingProperty(LayerAnimationElement::BOUNDS));
base::TimeTicks start_time = animator->last_step_time();
- ASSERT_NO_FATAL_FAILURE(animator->Step(start_time + bounds_delta1));
+ ASSERT_NO_FATAL_FAILURE(element->Step(start_time + bounds_delta1));
ASSERT_TRUE(animator->IsAnimatingProperty(LayerAnimationElement::BOUNDS));
// The next step should change the animated bounds past the threshold and
// cause the animaton to stop.
- ASSERT_NO_FATAL_FAILURE(animator->Step(start_time + bounds_delta2));
+ ASSERT_NO_FATAL_FAILURE(element->Step(start_time + bounds_delta2));
ASSERT_FALSE(animator->IsAnimatingProperty(LayerAnimationElement::BOUNDS));
- ASSERT_NO_FATAL_FAILURE(animator->Step(start_time + final_delta));
+ ASSERT_NO_FATAL_FAILURE(element->Step(start_time + final_delta));
// Completing the animation should have stopped the bounds
// animation.
@@ -2179,6 +2200,7 @@ TEST(LayerAnimatorTest, GetTargetGrayscale) {
// Verifies color property is modified appropriately.
TEST(LayerAnimatorTest, Color) {
scoped_refptr<LayerAnimator> animator(LayerAnimator::CreateDefaultAnimator());
+ AnimationContainerElement* element = animator.get();
animator->set_disable_timer_for_test(true);
TestLayerAnimationDelegate delegate;
animator->SetDelegate(&delegate);
@@ -2201,13 +2223,13 @@ TEST(LayerAnimatorTest, Color) {
base::TimeTicks start_time = animator->last_step_time();
- animator->Step(start_time + base::TimeDelta::FromMilliseconds(500));
+ element->Step(start_time + base::TimeDelta::FromMilliseconds(500));
EXPECT_TRUE(animator->is_animating());
EXPECT_EQ(ColorToString(middle_color),
ColorToString(delegate.GetColorForAnimation()));
- animator->Step(start_time + base::TimeDelta::FromMilliseconds(1000));
+ element->Step(start_time + base::TimeDelta::FromMilliseconds(1000));
EXPECT_FALSE(animator->is_animating());
EXPECT_EQ(ColorToString(target_color),
@@ -2315,6 +2337,7 @@ TEST(LayerAnimatorTest, ObserverDeletesAnimatorAfterFinishingAnimation) {
observer->set_delete_on_animation_ended(true);
observer->set_delete_on_animation_aborted(true);
LayerAnimator* animator = observer->animator();
+ AnimationContainerElement* element = observer->animator();
animator->set_disable_timer_for_test(true);
TestLayerAnimationDelegate delegate;
animator->SetDelegate(&delegate);
@@ -2337,7 +2360,7 @@ TEST(LayerAnimatorTest, ObserverDeletesAnimatorAfterFinishingAnimation) {
animator->StartAnimation(bounds_sequence);
base::TimeTicks start_time = animator->last_step_time();
- animator->Step(start_time + base::TimeDelta::FromMilliseconds(1500));
+ element->Step(start_time + base::TimeDelta::FromMilliseconds(1500));
EXPECT_TRUE(observer_was_deleted);
}
@@ -2502,122 +2525,4 @@ TEST(LayerAnimatorTest, TestScopedCounterAnimation) {
}
-class CollectionLayerAnimationDelegate : public TestLayerAnimationDelegate {
- public:
- CollectionLayerAnimationDelegate() : collection(NULL) {}
- virtual ~CollectionLayerAnimationDelegate() {}
-
- // LayerAnimationDelegate:
- virtual LayerAnimatorCollection* GetLayerAnimatorCollection() OVERRIDE {
- return &collection;
- }
-
- private:
- LayerAnimatorCollection collection;
-};
-
-TEST(LayerAnimatorTest, LayerAnimatorCollectionTickTime) {
- Layer layer;
- LayerAnimator* animator = layer.GetAnimator();
- CollectionLayerAnimationDelegate delegate;
- animator->SetDelegate(&delegate);
-
- LayerAnimatorCollection* collection = delegate.GetLayerAnimatorCollection();
- base::TimeTicks null;
- collection->Progress(null);
- EXPECT_TRUE(collection->last_tick_time().is_null());
-
- // Adding an animator to the collection should update the last tick time.
- collection->StartAnimator(layer.GetAnimator());
- EXPECT_TRUE(collection->HasActiveAnimators());
- EXPECT_FALSE(collection->last_tick_time().is_null());
-
- collection->StopAnimator(layer.GetAnimator());
- EXPECT_FALSE(collection->HasActiveAnimators());
-}
-
-TEST(LayerAnimatorTest, AnimatorStartedCorrectly) {
- Layer layer;
- LayerAnimatorTestController test_controller(layer.GetAnimator());
- LayerAnimator* animator = test_controller.animator();
- ASSERT_FALSE(animator->is_started_);
-
- TestLayerAnimationDelegate test_delegate;
- animator->SetDelegate(&test_delegate);
- double target_opacity = 1.0;
- base::TimeDelta time_delta = base::TimeDelta::FromSeconds(1);
- animator->ScheduleAnimation(new LayerAnimationSequence(
- LayerAnimationElement::CreateOpacityElement(target_opacity, time_delta)));
- EXPECT_FALSE(animator->is_started_);
-
- CollectionLayerAnimationDelegate collection_delegate;
- animator->SetDelegate(&collection_delegate);
- animator->UpdateAnimationState();
- EXPECT_TRUE(animator->is_started_);
- animator->SetDelegate(NULL);
-}
-
-TEST(LayerAnimatorTest, AnimatorRemovedFromCollectionWhenLayerIsDestroyed) {
- scoped_ptr<Layer> layer(new Layer(LAYER_TEXTURED));
- LayerAnimatorTestController test_controller(layer->GetAnimator());
- scoped_refptr<LayerAnimator> animator = test_controller.animator();
- CollectionLayerAnimationDelegate collection_delegate;
- animator->SetDelegate(&collection_delegate);
-
- double target_opacity = 1.0;
- base::TimeDelta time_delta = base::TimeDelta::FromSeconds(1);
- animator->ScheduleAnimation(new LayerAnimationSequence(
- LayerAnimationElement::CreateOpacityElement(target_opacity, time_delta)));
-
- EXPECT_TRUE(
- collection_delegate.GetLayerAnimatorCollection()->HasActiveAnimators());
-
- layer.reset();
- EXPECT_EQ(NULL, animator->delegate());
- EXPECT_FALSE(
- collection_delegate.GetLayerAnimatorCollection()->HasActiveAnimators());
-}
-
-TEST(LayerAnimatorTest, LayerMovedBetweenCompositorsDuringAnimation) {
- bool enable_pixel_output = false;
- ui::ContextFactory* context_factory =
- InitializeContextFactoryForTests(enable_pixel_output);
- const gfx::Rect bounds(10, 10, 100, 100);
- scoped_ptr<TestCompositorHost> host_1(
- TestCompositorHost::Create(bounds, context_factory));
- scoped_ptr<TestCompositorHost> host_2(
- TestCompositorHost::Create(bounds, context_factory));
- host_1->Show();
- host_2->Show();
-
- Compositor* compositor_1 = host_1->GetCompositor();
- Layer root_1;
- compositor_1->SetRootLayer(&root_1);
-
- Compositor* compositor_2 = host_2->GetCompositor();
- Layer root_2;
- compositor_2->SetRootLayer(&root_2);
-
- // Verify that neither compositor has active animators.
- EXPECT_FALSE(compositor_1->layer_animator_collection()->HasActiveAnimators());
- EXPECT_FALSE(compositor_2->layer_animator_collection()->HasActiveAnimators());
-
- Layer layer;
- root_1.Add(&layer);
- LayerAnimator* animator = layer.GetAnimator();
- double target_opacity = 1.0;
- base::TimeDelta time_delta = base::TimeDelta::FromSeconds(1);
- animator->ScheduleAnimation(new LayerAnimationSequence(
- LayerAnimationElement::CreateOpacityElement(target_opacity, time_delta)));
- EXPECT_TRUE(compositor_1->layer_animator_collection()->HasActiveAnimators());
- EXPECT_FALSE(compositor_2->layer_animator_collection()->HasActiveAnimators());
-
- root_2.Add(&layer);
- EXPECT_FALSE(compositor_1->layer_animator_collection()->HasActiveAnimators());
- EXPECT_TRUE(compositor_2->layer_animator_collection()->HasActiveAnimators());
- host_2.reset();
- host_1.reset();
- TerminateContextFactoryForTests();
-}
-
} // namespace ui
diff --git a/ui/compositor/layer_unittest.cc b/ui/compositor/layer_unittest.cc
index 9c4b8a0..f216af3 100644
--- a/ui/compositor/layer_unittest.cc
+++ b/ui/compositor/layer_unittest.cc
@@ -1507,54 +1507,4 @@ TEST_F(LayerWithRealCompositorTest, SwitchCCLayerAnimations) {
EXPECT_FLOAT_EQ(l1->opacity(), 0.5f);
}
-// Tests that the animators in the layer tree is added to the
-// animator-collection when the root-layer is set to the compositor.
-TEST_F(LayerWithDelegateTest, RootLayerAnimatorsInCompositor) {
- scoped_ptr<Layer> root(CreateLayer(LAYER_SOLID_COLOR));
- scoped_ptr<Layer> child(CreateColorLayer(SK_ColorRED, gfx::Rect(10, 10)));
- child->SetAnimator(LayerAnimator::CreateImplicitAnimator());
- child->SetOpacity(0.5f);
- root->Add(child.get());
-
- EXPECT_FALSE(compositor()->layer_animator_collection()->HasActiveAnimators());
- compositor()->SetRootLayer(root.get());
- EXPECT_TRUE(compositor()->layer_animator_collection()->HasActiveAnimators());
-}
-
-// Tests that adding/removing a layer adds/removes the animator from its entire
-// subtree from the compositor's animator-collection.
-TEST_F(LayerWithDelegateTest, AddRemoveLayerUpdatesAnimatorsFromSubtree) {
- scoped_ptr<Layer> root(CreateLayer(LAYER_TEXTURED));
- scoped_ptr<Layer> child(CreateLayer(LAYER_TEXTURED));
- scoped_ptr<Layer> grandchild(CreateColorLayer(SK_ColorRED,
- gfx::Rect(10, 10)));
- root->Add(child.get());
- child->Add(grandchild.get());
- compositor()->SetRootLayer(root.get());
-
- grandchild->SetAnimator(LayerAnimator::CreateImplicitAnimator());
- grandchild->SetOpacity(0.5f);
- EXPECT_TRUE(compositor()->layer_animator_collection()->HasActiveAnimators());
-
- root->Remove(child.get());
- EXPECT_FALSE(compositor()->layer_animator_collection()->HasActiveAnimators());
-
- root->Add(child.get());
- EXPECT_TRUE(compositor()->layer_animator_collection()->HasActiveAnimators());
-}
-
-TEST_F(LayerWithDelegateTest, DestroyingLayerRemovesTheAnimatorFromCollection) {
- scoped_ptr<Layer> root(CreateLayer(LAYER_TEXTURED));
- scoped_ptr<Layer> child(CreateLayer(LAYER_TEXTURED));
- root->Add(child.get());
- compositor()->SetRootLayer(root.get());
-
- child->SetAnimator(LayerAnimator::CreateImplicitAnimator());
- child->SetOpacity(0.5f);
- EXPECT_TRUE(compositor()->layer_animator_collection()->HasActiveAnimators());
-
- child.reset();
- EXPECT_FALSE(compositor()->layer_animator_collection()->HasActiveAnimators());
-}
-
} // namespace ui
diff --git a/ui/compositor/test/test_layer_animation_delegate.cc b/ui/compositor/test/test_layer_animation_delegate.cc
index e6053d6..ce875e6 100644
--- a/ui/compositor/test/test_layer_animation_delegate.cc
+++ b/ui/compositor/test/test_layer_animation_delegate.cc
@@ -98,9 +98,4 @@ void TestLayerAnimationDelegate::AddThreadedAnimation(
void TestLayerAnimationDelegate::RemoveThreadedAnimation(int animation_id) {
}
-LayerAnimatorCollection*
-TestLayerAnimationDelegate::GetLayerAnimatorCollection() {
- return NULL;
-}
-
} // namespace ui
diff --git a/ui/compositor/test/test_layer_animation_delegate.h b/ui/compositor/test/test_layer_animation_delegate.h
index 0732c99..014ed3a 100644
--- a/ui/compositor/test/test_layer_animation_delegate.h
+++ b/ui/compositor/test/test_layer_animation_delegate.h
@@ -39,7 +39,6 @@ class TestLayerAnimationDelegate : public LayerAnimationDelegate {
virtual void AddThreadedAnimation(
scoped_ptr<cc::Animation> animation) OVERRIDE;
virtual void RemoveThreadedAnimation(int animation_id) OVERRIDE;
- virtual LayerAnimatorCollection* GetLayerAnimatorCollection() OVERRIDE;
private:
gfx::Rect bounds_;
diff --git a/ui/keyboard/keyboard_controller_unittest.cc b/ui/keyboard/keyboard_controller_unittest.cc
index 52a98bd..f264493 100644
--- a/ui/keyboard/keyboard_controller_unittest.cc
+++ b/ui/keyboard/keyboard_controller_unittest.cc
@@ -41,13 +41,13 @@ void RunAnimationForLayer(ui::Layer* layer) {
ui::ScopedAnimationDurationScaleMode::ZERO_DURATION);
ui::LayerAnimatorTestController controller(layer->GetAnimator());
+ gfx::AnimationContainerElement* element = layer->GetAnimator();
// Multiple steps are required to complete complex animations.
// TODO(vollick): This should not be necessary. crbug.com/154017
while (controller.animator()->is_animating()) {
controller.StartThreadedAnimationsIfNeeded();
base::TimeTicks step_time = controller.animator()->last_step_time();
- controller.animator()->Step(step_time +
- base::TimeDelta::FromMilliseconds(1000));
+ element->Step(step_time + base::TimeDelta::FromMilliseconds(1000));
}
}