diff --git a/ash/wm/lock_layout_manager_unittest.cc b/ash/wm/lock_layout_manager_unittest.cc index 587b4ff22a4bd..49fcfa1ff0dc7 100644 --- a/ash/wm/lock_layout_manager_unittest.cc +++ b/ash/wm/lock_layout_manager_unittest.cc @@ -277,6 +277,13 @@ TEST_F(LockLayoutManagerTest, KeyboardBounds) { keyboard::SetKeyboardOverscrollOverride( keyboard::KEYBOARD_OVERSCROLL_OVERRIDE_NONE); + + keyboard->SetContainerType(keyboard::ContainerType::FLOATING); + ShowKeyboard(true); + primary_display = display::Screen::GetScreen()->GetPrimaryDisplay(); + screen_bounds = primary_display.bounds(); + EXPECT_EQ(screen_bounds.ToString(), window->GetBoundsInScreen().ToString()); + ShowKeyboard(false); } TEST_F(LockLayoutManagerTest, MultipleMonitors) { diff --git a/ash/wm/lock_window_state.cc b/ash/wm/lock_window_state.cc index bd7aa477b67e5..d27367b443019 100644 --- a/ash/wm/lock_window_state.cc +++ b/ash/wm/lock_window_state.cc @@ -181,16 +181,13 @@ gfx::Rect LockWindowState::GetWindowBounds(aura::Window* window) { keyboard::KeyboardController* keyboard_controller = keyboard::KeyboardController::GetInstance(); - gfx::Rect keyboard_bounds; - - if (keyboard_controller && !keyboard::IsKeyboardOverscrollEnabled() && - keyboard_controller->keyboard_visible()) { - keyboard_bounds = keyboard_controller->current_keyboard_bounds(); - } - + const int keyboard_height = + keyboard_controller + ? keyboard_controller->GetKeyboardLockScreenOffsetBounds().height() + : 0; gfx::Rect bounds = ScreenUtil::GetDisplayBoundsWithShelf(window); bounds.Inset(0, Shelf::ForWindow(window)->GetAccessibilityPanelHeight(), 0, - keyboard_bounds.height()); + keyboard_height); return bounds; } diff --git a/ui/keyboard/keyboard_controller.cc b/ui/keyboard/keyboard_controller.cc index fd3883d78b87b..ed64c39aabb48 100644 --- a/ui/keyboard/keyboard_controller.cc +++ b/ui/keyboard/keyboard_controller.cc @@ -708,8 +708,17 @@ void KeyboardController::ReportLingeringState() { } const gfx::Rect KeyboardController::GetWorkspaceObscuringBounds() const { - if (keyboard_visible() && - container_behavior_->BoundsAffectWorkspaceLayout()) { + if (keyboard_visible() && container_behavior_->BoundsObscureUsableRegion()) + return current_keyboard_bounds_; + return gfx::Rect(); +} + +const gfx::Rect KeyboardController::GetKeyboardLockScreenOffsetBounds() const { + // Overscroll is generally dependent on lock state, however, its behavior + // temporarily overridden by a static field in certain lock screen contexts. + // Furthermore, floating keyboard should never affect layout. + if (keyboard_visible() && !keyboard::IsKeyboardOverscrollEnabled() && + container_behavior_->GetType() != ContainerType::FLOATING) { return current_keyboard_bounds_; } return gfx::Rect(); diff --git a/ui/keyboard/keyboard_controller.h b/ui/keyboard/keyboard_controller.h index 6ae5d286e1b3e..01025634abbdf 100644 --- a/ui/keyboard/keyboard_controller.h +++ b/ui/keyboard/keyboard_controller.h @@ -145,6 +145,10 @@ class KEYBOARD_EXPORT KeyboardController : public ui::InputMethodObserver, // region of the screen, an empty rectangle will get returned. const gfx::Rect GetWorkspaceObscuringBounds() const; + // Returns the current bounds that affect the window layout of the various + // lock screens. + const gfx::Rect GetKeyboardLockScreenOffsetBounds() const; + KeyboardControllerState GetStateForTest() const { return state_; } const gfx::Rect AdjustSetBoundsRequest(