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

Unified Diff: chrome/browser/ui/ash/ash_keyboard_controller_proxy.cc

Issue 134133003: Fix VK animation related issues (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/ash/ash_keyboard_controller_proxy.cc
diff --git a/chrome/browser/ui/ash/ash_keyboard_controller_proxy.cc b/chrome/browser/ui/ash/ash_keyboard_controller_proxy.cc
index 6e40b63f8ee6bb81242d9dcc194babca4c8ca7e2..8aed9c330a282baacc7077643d3db33e961eb02a 100644
--- a/chrome/browser/ui/ash/ash_keyboard_controller_proxy.cc
+++ b/chrome/browser/ui/ash/ash_keyboard_controller_proxy.cc
@@ -41,6 +41,10 @@ const char* kVirtualKeyboardExtensionID = "mppnpdlheglhdfmldimlhpnegondlapf";
// The virtual keyboard show/hide animation duration.
const int kAnimationDurationMs = 200;
+// The opacity of virtual keyboard container when show animation starts or
+// hide animation finishes.
+const float kAnimationStartOrAfterHideOpacity = 0.2f;
+
Context::Type TextInputTypeToGeneratedInputTypeEnum(ui::TextInputType type) {
switch (type) {
case ui::TEXT_INPUT_TYPE_NONE:
@@ -158,17 +162,18 @@ void AshKeyboardControllerProxy::ShowKeyboardContainer(
gfx::Transform transform;
transform.Translate(0, GetKeyboardWindow()->bounds().height());
container->SetTransform(transform);
- container->layer()->SetOpacity(0.0);
+ container->layer()->SetOpacity(kAnimationStartOrAfterHideOpacity);
}
+ container_animator->set_preemption_strategy(
+ ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET);
+
{
// Scope the following animation settings as we don't want to animate
// visibility change that triggered by a call to the base class function
// ShowKeyboardContainer with these settings. The container should become
// visible immediately.
ui::ScopedLayerAnimationSettings settings(container_animator);
- settings.SetPreemptionStrategy(
- ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET);
settings.SetTweenType(gfx::Tween::EASE_IN);
settings.SetTransitionDuration(
base::TimeDelta::FromMilliseconds(kAnimationDurationMs));
@@ -197,15 +202,13 @@ void AshKeyboardControllerProxy::HideKeyboardContainer(
container_animator->AddObserver(this);
animation_window_ = container;
ui::ScopedLayerAnimationSettings settings(container_animator);
- settings.SetPreemptionStrategy(
- ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET);
settings.SetTweenType(gfx::Tween::EASE_OUT);
settings.SetTransitionDuration(
base::TimeDelta::FromMilliseconds(kAnimationDurationMs));
gfx::Transform transform;
transform.Translate(0, GetKeyboardWindow()->bounds().height());
container->SetTransform(transform);
- container->layer()->SetOpacity(0.0);
+ container->layer()->SetOpacity(kAnimationStartOrAfterHideOpacity);
}
void AshKeyboardControllerProxy::OnLayerAnimationEnded(
@@ -213,7 +216,7 @@ void AshKeyboardControllerProxy::OnLayerAnimationEnded(
if (!animation_window_)
return;
ui::LayerAnimator* animator = animation_window_->layer()->GetAnimator();
- if (animator && !animator->is_animating()) {
+ if (!animator->is_animating()) {
KeyboardControllerProxy::HideKeyboardContainer(animation_window_);
animator->RemoveObserver(this);
James Cook 2014/01/16 17:55:03 Is it possible to leak this observer? I'm not cle
bshe 2014/01/16 20:09:04 We have a few animations at the same time. So OnLa
animation_window_ = NULL;
@@ -224,10 +227,7 @@ void AshKeyboardControllerProxy::OnLayerAnimationAborted(
ui::LayerAnimationSequence* sequence) {
if (!animation_window_)
return;
- ui::LayerAnimator* animator = animation_window_->layer()->GetAnimator();
- if (animator) {
- animator->RemoveObserver(this);
- }
+ animation_window_->layer()->GetAnimator()->RemoveObserver(this);
animation_window_ = NULL;
};

Powered by Google App Engine
This is Rietveld 408576698