Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/views/animation/ink_drop_animation_controller_impl.h" | 5 #include "ui/views/animation/ink_drop_animation_controller_impl.h" |
| 6 | 6 |
| 7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
| 8 #include "base/timer/timer.h" | 8 #include "base/timer/timer.h" |
| 9 #include "ui/compositor/layer.h" | 9 #include "ui/compositor/layer.h" |
| 10 #include "ui/views/animation/ink_drop_host.h" | 10 #include "ui/views/animation/ink_drop_host.h" |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 106 SetHoveredInternal(is_hovered, | 106 SetHoveredInternal(is_hovered, |
| 107 is_hovered ? base::TimeDelta::FromMilliseconds( | 107 is_hovered ? base::TimeDelta::FromMilliseconds( |
| 108 kHoverFadeInFromUserInputDurationInMs) | 108 kHoverFadeInFromUserInputDurationInMs) |
| 109 : base::TimeDelta::FromMilliseconds( | 109 : base::TimeDelta::FromMilliseconds( |
| 110 kHoverFadeOutFromUserInputDurationInMs)); | 110 kHoverFadeOutFromUserInputDurationInMs)); |
| 111 } | 111 } |
| 112 | 112 |
| 113 void InkDropAnimationControllerImpl::CompleteHiddenTargetedAnimations() { | 113 void InkDropAnimationControllerImpl::CompleteHiddenTargetedAnimations() { |
| 114 if (ink_drop_animation_->target_ink_drop_state() == InkDropState::HIDDEN || | 114 if (ink_drop_animation_->target_ink_drop_state() == InkDropState::HIDDEN || |
| 115 ShouldAnimateToHidden(ink_drop_animation_->target_ink_drop_state())) { | 115 ShouldAnimateToHidden(ink_drop_animation_->target_ink_drop_state())) { |
| 116 ink_drop_animation_->HideImmediately(); | 116 CreateInkDropAnimation(); |
|
Evan Stade
2016/03/31 03:41:27
this change probably warrants a rename of the fn.
bruthig
2016/03/31 19:39:03
I was really, really hoping not to tie the lifetim
Evan Stade
2016/03/31 21:07:38
I don't think that's a perf optimization worth wor
bruthig
2016/03/31 22:46:19
Acknowledged. At one point I was flirting with th
Evan Stade
2016/04/01 19:03:13
I guess ink drop delegate can store the last touch
| |
| 117 } | 117 } |
| 118 } | 118 } |
| 119 | 119 |
| 120 void InkDropAnimationControllerImpl::CreateInkDropAnimation() { | 120 void InkDropAnimationControllerImpl::CreateInkDropAnimation() { |
| 121 DestroyInkDropAnimation(); | 121 DestroyInkDropAnimation(); |
| 122 ink_drop_animation_ = ink_drop_host_->CreateInkDropAnimation(); | 122 ink_drop_animation_ = ink_drop_host_->CreateInkDropAnimation(); |
| 123 ink_drop_animation_->set_observer(this); | 123 ink_drop_animation_->set_observer(this); |
| 124 root_layer_->Add(ink_drop_animation_->GetRootLayer()); | 124 root_layer_->Add(ink_drop_animation_->GetRootLayer()); |
| 125 } | 125 } |
| 126 | 126 |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 207 hover_after_animation_timer_.reset(); | 207 hover_after_animation_timer_.reset(); |
| 208 } | 208 } |
| 209 | 209 |
| 210 void InkDropAnimationControllerImpl::HoverAfterAnimationTimerFired() { | 210 void InkDropAnimationControllerImpl::HoverAfterAnimationTimerFired() { |
| 211 SetHoveredInternal(true, base::TimeDelta::FromMilliseconds( | 211 SetHoveredInternal(true, base::TimeDelta::FromMilliseconds( |
| 212 kHoverFadeInAfterAnimationDurationInMs)); | 212 kHoverFadeInAfterAnimationDurationInMs)); |
| 213 hover_after_animation_timer_.reset(); | 213 hover_after_animation_timer_.reset(); |
| 214 } | 214 } |
| 215 | 215 |
| 216 } // namespace views | 216 } // namespace views |
| OLD | NEW |