Commit 54b4f85a authored by rsadam's avatar rsadam Committed by Commit bot

Fixes moving fully occluded windows when the a11y keyboard shows.

TEST=WorkspaceLayoutManagerKeyboardTest.AdjustWindowForA11yKeyboard
BUG=407094

Review URL: https://codereview.chromium.org/506133002

Cr-Commit-Position: refs/heads/master@{#292056}
parent 71b32fcc
......@@ -153,12 +153,13 @@ void WorkspaceLayoutManager::OnKeyboardBoundsChanging(
gfx::Rect window_bounds = ScreenUtil::ConvertRectToScreen(
window_,
window->GetTargetBounds());
gfx::Rect intersect = gfx::IntersectRects(window_bounds, new_bounds);
int shift = std::min(intersect.height(),
window->bounds().y() - work_area_in_parent_.y());
int vertical_displacement =
std::max(0, window_bounds.bottom() - new_bounds.y());
int shift = std::min(vertical_displacement,
window_bounds.y() - work_area_in_parent_.y());
if (shift > 0) {
gfx::Point origin(window->bounds().x(), window->bounds().y() - shift);
SetChildBounds(window, gfx::Rect(origin, window->bounds().size()));
gfx::Point origin(window_bounds.x(), window_bounds.y() - shift);
SetChildBounds(window, gfx::Rect(origin, window_bounds.size()));
}
} else if (window_state->HasRestoreBounds()) {
// Keyboard hidden, restore original bounds if they exist.
......
......@@ -1139,6 +1139,21 @@ TEST_F(WorkspaceLayoutManagerKeyboardTest, AdjustWindowForA11yKeyboard) {
HideKeyboard();
EXPECT_EQ(small_window_bound.ToString(), window->bounds().ToString());
gfx::Rect occluded_window_bounds(50,
keyboard_bounds.y() + keyboard_bounds.height()/2, 50,
keyboard_bounds.height()/2);
window->SetBounds(occluded_window_bounds);
EXPECT_EQ(occluded_window_bounds.ToString(),
occluded_window_bounds.ToString());
ShowKeyboard();
EXPECT_EQ(gfx::Rect(50,
keyboard_bounds.y() - keyboard_bounds.height()/2,
occluded_window_bounds.width(),
occluded_window_bounds.height()).ToString(),
window->bounds().ToString());
HideKeyboard();
EXPECT_EQ(occluded_window_bounds.ToString(), window->bounds().ToString());
Blur(&text_input_client);
}
......
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