Commit 67fa126c authored by oka@chromium.org's avatar oka@chromium.org Committed by Commit Bot

Fix blink of wallpaper seen on opening virtual keyboard

Bug: 805369
Test: Fix failed test and `git cl try`
Change-Id: If77f7d2502cb17891d82914928c031f62d4e5f94
Reviewed-on: https://chromium-review.googlesource.com/954163Reviewed-by: default avatarBlake O'Hare <blakeo@chromium.org>
Reviewed-by: default avatarYuichiro Hanada <yhanada@chromium.org>
Commit-Queue: Keigo Oka <oka@chromium.org>
Cr-Commit-Position: refs/heads/master@{#544998}
parent 740ded48
...@@ -400,6 +400,11 @@ void KeyboardController::HideAnimationFinished() { ...@@ -400,6 +400,11 @@ void KeyboardController::HideAnimationFinished() {
} }
} }
void KeyboardController::ShowAnimationFinished() {
MarkKeyboardLoadFinished();
NotifyKeyboardBoundsChangingAndEnsureCaretInWorkArea();
}
void KeyboardController::SetContainerBehaviorInternal( void KeyboardController::SetContainerBehaviorInternal(
const ContainerType type) { const ContainerType type) {
switch (type) { switch (type) {
...@@ -642,8 +647,9 @@ void KeyboardController::PopulateKeyboardContent(int64_t display_id, ...@@ -642,8 +647,9 @@ void KeyboardController::PopulateKeyboardContent(int64_t display_id,
ui_->ShowKeyboardContainer(container_.get()); ui_->ShowKeyboardContainer(container_.get());
animation_observer_ = std::make_unique<CallbackAnimationObserver>( animation_observer_ =
base::BindOnce(&MarkKeyboardLoadFinished)); std::make_unique<CallbackAnimationObserver>(base::BindOnce(
&KeyboardController::ShowAnimationFinished, base::Unretained(this)));
ui::ScopedLayerAnimationSettings settings(container_animator); ui::ScopedLayerAnimationSettings settings(container_animator);
settings.AddObserver(animation_observer_.get()); settings.AddObserver(animation_observer_.get());
...@@ -654,7 +660,6 @@ void KeyboardController::PopulateKeyboardContent(int64_t display_id, ...@@ -654,7 +660,6 @@ void KeyboardController::PopulateKeyboardContent(int64_t display_id,
queued_container_type_ = nullptr; queued_container_type_ = nullptr;
ChangeState(KeyboardControllerState::SHOWN); ChangeState(KeyboardControllerState::SHOWN);
NotifyKeyboardBoundsChangingAndEnsureCaretInWorkArea();
} }
bool KeyboardController::WillHideKeyboard() const { bool KeyboardController::WillHideKeyboard() const {
......
...@@ -225,8 +225,10 @@ class KEYBOARD_EXPORT KeyboardController : public ui::InputMethodObserver, ...@@ -225,8 +225,10 @@ class KEYBOARD_EXPORT KeyboardController : public ui::InputMethodObserver,
// Returns true if keyboard is scheduled to hide. // Returns true if keyboard is scheduled to hide.
bool WillHideKeyboard() const; bool WillHideKeyboard() const;
// Called when the hide animation finishes. // Called when the hide animation finished.
void HideAnimationFinished(); void HideAnimationFinished();
// Called when the show animation finished.
void ShowAnimationFinished();
void NotifyKeyboardBoundsChangingAndEnsureCaretInWorkArea(); void NotifyKeyboardBoundsChangingAndEnsureCaretInWorkArea();
......
...@@ -709,11 +709,11 @@ TEST_F(KeyboardControllerAnimationTest, ContainerAnimation) { ...@@ -709,11 +709,11 @@ TEST_F(KeyboardControllerAnimationTest, ContainerAnimation) {
gfx::Transform transform; gfx::Transform transform;
transform.Translate(0, keyboard::kFullWidthKeyboardAnimationDistance); transform.Translate(0, keyboard::kFullWidthKeyboardAnimationDistance);
EXPECT_EQ(transform, layer->transform()); EXPECT_EQ(transform, layer->transform());
// animation occurs in a cloned layer, so the actual final bounds should // Actual final bounds should be notified after animation finishes to avoid
// already be applied to the container. // flash of background being seen.
EXPECT_EQ(keyboard_container()->bounds(), notified_visible_bounds()); EXPECT_EQ(gfx::Rect(), notified_visible_bounds());
EXPECT_EQ(keyboard_container()->bounds(), notified_occluding_bounds()); EXPECT_EQ(gfx::Rect(), notified_occluding_bounds());
EXPECT_TRUE(notified_is_available()); EXPECT_FALSE(notified_is_available());
RunAnimationForLayer(layer); RunAnimationForLayer(layer);
EXPECT_TRUE(keyboard_container()->IsVisible()); EXPECT_TRUE(keyboard_container()->IsVisible());
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment