OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "ui/compositor/test/layer_animator_test_controller.h" |
| 6 #include "ui/compositor/layer_animation_sequence.h" |
| 7 |
| 8 namespace ui { |
| 9 |
| 10 LayerAnimatorTestController::LayerAnimatorTestController( |
| 11 scoped_refptr<LayerAnimator> animator) |
| 12 : animator_(animator) { |
| 13 } |
| 14 |
| 15 LayerAnimatorTestController::~LayerAnimatorTestController() { |
| 16 } |
| 17 |
| 18 LayerAnimationSequence* LayerAnimatorTestController::GetRunningSequence( |
| 19 LayerAnimationElement::AnimatableProperty property) { |
| 20 LayerAnimator::RunningAnimation* running_animation = |
| 21 animator_->GetRunningAnimation(property); |
| 22 if (running_animation) |
| 23 return running_animation->sequence(); |
| 24 else |
| 25 return NULL; |
| 26 } |
| 27 |
| 28 void LayerAnimatorTestController::StartThreadedAnimationsIfNeeded() { |
| 29 LayerAnimationSequence* sequence = |
| 30 GetRunningSequence(LayerAnimationElement::OPACITY); |
| 31 |
| 32 if (!sequence) |
| 33 return; |
| 34 |
| 35 LayerAnimationElement* element = sequence->CurrentElement(); |
| 36 if (element->properties().find(LayerAnimationElement::OPACITY) == |
| 37 element->properties().end()) |
| 38 return; |
| 39 |
| 40 if (!element->Started() || |
| 41 element->effective_start_time() != base::TimeTicks()) |
| 42 return; |
| 43 |
| 44 animator_->OnThreadedAnimationStarted(cc::AnimationEvent( |
| 45 cc::AnimationEvent::Started, |
| 46 0, |
| 47 element->animation_group_id(), |
| 48 cc::Animation::Opacity, |
| 49 (base::TimeTicks::Now() - base::TimeTicks()).InSecondsF())); |
| 50 } |
| 51 |
| 52 } // namespace ui |
OLD | NEW |