Commit 78f1faa6 authored by Andrew Xu's avatar Andrew Xu Committed by Commit Bot

vk: Fix wrong occluded rect sent to observers

In KeyboardController::NotifyKeyboardBoundsChanging, when keyboard
window is null or invisible, |visual_bounds_in_root_| is reset and
it changes the return value of GetWorkspaceOccludedBoundsInScreen.
However we still use the old value returned by GetWorkspaceOccluded-
BoundsInScreen before condition block as parameter. This CL fixes
this issue.

Bug: 960174
Change-Id: Iee95babce7a01328d90a1065b2da8f171ff7d844
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1618181
Commit-Queue: Andrew Xu <andrewxu@chromium.org>
Reviewed-by: default avatarXiyuan Xia <xiyuan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#661011}
parent 6dc05fb8
...@@ -381,17 +381,24 @@ void KeyboardController::MoveToParentContainer(aura::Window* parent) { ...@@ -381,17 +381,24 @@ void KeyboardController::MoveToParentContainer(aura::Window* parent) {
// private // private
void KeyboardController::NotifyKeyboardBoundsChanging( void KeyboardController::NotifyKeyboardBoundsChanging(
const gfx::Rect& new_bounds_in_root) { const gfx::Rect& new_bounds_in_root) {
visual_bounds_in_root_ = new_bounds_in_root; gfx::Rect occluded_bounds_in_screen;
gfx::Rect occluded_bounds_in_screen = GetWorkspaceOccludedBoundsInScreen();
aura::Window* window = GetKeyboardWindow(); aura::Window* window = GetKeyboardWindow();
if (window && window->IsVisible()) { if (window && window->IsVisible()) {
visual_bounds_in_root_ = new_bounds_in_root;
// |visual_bounds_in_root_| affects the result of
// GetWorkspaceOccludedBoundsInScreen. Calculate |occluded_bounds_in_screen|
// after updating |visual_bounds_in_root_|.
// TODO(andrewxu): Add the unit test case for issue 960174.
occluded_bounds_in_screen = GetWorkspaceOccludedBoundsInScreen();
// TODO(https://crbug.com/943446): Use screen bounds for visual bounds. // TODO(https://crbug.com/943446): Use screen bounds for visual bounds.
notification_manager_.SendNotifications( notification_manager_.SendNotifications(
container_behavior_->OccludedBoundsAffectWorkspaceLayout(), container_behavior_->OccludedBoundsAffectWorkspaceLayout(),
new_bounds_in_root, occluded_bounds_in_screen, observer_list_); new_bounds_in_root, occluded_bounds_in_screen, observer_list_);
} else { } else {
visual_bounds_in_root_ = gfx::Rect(); visual_bounds_in_root_ = gfx::Rect();
occluded_bounds_in_screen = GetWorkspaceOccludedBoundsInScreen();
} }
EnsureCaretInWorkArea(occluded_bounds_in_screen); EnsureCaretInWorkArea(occluded_bounds_in_screen);
......
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