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

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: kevers' review 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
« no previous file with comments | « no previous file | chrome/browser/ui/ash/ash_keyboard_controller_proxy_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..2a096dfd935f37f640b3e8f208f9a4196ee408a0 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,24 +202,31 @@ 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);
+ // Must hide keyboard container here instead of when animation finished or
+ // aborted. Otherwise, if we regain focus during hide animation, show
+ // animation wont be triggered because Chrome still thinks the keyboard
+ // container is visible and ignores show keyboard request.
+ container->Hide();
+ container->layer()->SetOpacity(kAnimationStartOrAfterHideOpacity);
}
void AshKeyboardControllerProxy::OnLayerAnimationEnded(
ui::LayerAnimationSequence* sequence) {
if (!animation_window_)
return;
+
ui::LayerAnimator* animator = animation_window_->layer()->GetAnimator();
if (animator && !animator->is_animating()) {
- KeyboardControllerProxy::HideKeyboardContainer(animation_window_);
+ // Hides keyboard window after keyboard window container's animation
+ // finished. Otherwise, keyboard window hides immediately and makes it looks
+ // like no animation at all.
+ GetKeyboardWindow()->Hide();
James Cook 2014/01/15 20:49:57 I'm having a hard time following this and the Hide
bshe 2014/01/16 17:47:58 Looks like it is possible if I add a check conditi
animator->RemoveObserver(this);
animation_window_ = NULL;
}
« no previous file with comments | « no previous file | chrome/browser/ui/ash/ash_keyboard_controller_proxy_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698