OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "ui/compositor/layer_animator.h" | 5 #include "ui/compositor/layer_animator.h" |
6 | 6 |
7 #include "base/debug/trace_event.h" | 7 #include "base/debug/trace_event.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "ui/base/animation/animation_container.h" | 10 #include "ui/base/animation/animation_container.h" |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 LayerAnimator* LayerAnimator::CreateDefaultAnimator() { | 79 LayerAnimator* LayerAnimator::CreateDefaultAnimator() { |
80 return new LayerAnimator(base::TimeDelta::FromMilliseconds(0)); | 80 return new LayerAnimator(base::TimeDelta::FromMilliseconds(0)); |
81 } | 81 } |
82 | 82 |
83 // static | 83 // static |
84 LayerAnimator* LayerAnimator::CreateImplicitAnimator() { | 84 LayerAnimator* LayerAnimator::CreateImplicitAnimator() { |
85 return new LayerAnimator( | 85 return new LayerAnimator( |
86 base::TimeDelta::FromMilliseconds(kDefaultTransitionDurationMs)); | 86 base::TimeDelta::FromMilliseconds(kDefaultTransitionDurationMs)); |
87 } | 87 } |
88 | 88 |
| 89 // static |
| 90 scoped_ptr<test::AnimationContainerTestHelper> |
| 91 LayerAnimator::CreateAnimatorHelperForTest() { |
| 92 scoped_ptr<test::AnimationContainerTestHelper> result; |
| 93 result.reset(new test::AnimationContainerTestHelper(GetAnimationContainer())); |
| 94 return result.Pass(); |
| 95 } |
| 96 |
89 // This macro provides the implementation for the setter and getter (well, | 97 // This macro provides the implementation for the setter and getter (well, |
90 // the getter of the target value) for an animated property. For example, | 98 // the getter of the target value) for an animated property. For example, |
91 // it is used for the implementations of SetTransform and GetTargetTransform. | 99 // it is used for the implementations of SetTransform and GetTargetTransform. |
92 // It is worth noting that SetFoo avoids invoking the usual animation machinery | 100 // It is worth noting that SetFoo avoids invoking the usual animation machinery |
93 // if the transition duration is zero -- in this case we just set the property | 101 // if the transition duration is zero -- in this case we just set the property |
94 // on the layer animation delegate immediately. | 102 // on the layer animation delegate immediately. |
95 #define ANIMATED_PROPERTY(type, property, name, member_type, member) \ | 103 #define ANIMATED_PROPERTY(type, property, name, member_type, member) \ |
96 void LayerAnimator::Set##name(type value) { \ | 104 void LayerAnimator::Set##name(type value) { \ |
97 base::TimeDelta duration = GetTransitionDuration(); \ | 105 base::TimeDelta duration = GetTransitionDuration(); \ |
98 if (duration == base::TimeDelta() && delegate() && \ | 106 if (duration == base::TimeDelta() && delegate() && \ |
(...skipping 650 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
749 LayerAnimator::RunningAnimation::RunningAnimation( | 757 LayerAnimator::RunningAnimation::RunningAnimation( |
750 const base::WeakPtr<LayerAnimationSequence>& sequence, | 758 const base::WeakPtr<LayerAnimationSequence>& sequence, |
751 base::TimeTicks start_time) | 759 base::TimeTicks start_time) |
752 : sequence_(sequence), | 760 : sequence_(sequence), |
753 start_time_(start_time) { | 761 start_time_(start_time) { |
754 } | 762 } |
755 | 763 |
756 LayerAnimator::RunningAnimation::~RunningAnimation() { } | 764 LayerAnimator::RunningAnimation::~RunningAnimation() { } |
757 | 765 |
758 } // namespace ui | 766 } // namespace ui |
OLD | NEW |