Remove current_keyboard_bounds() access from LockLayoutManager logic
This also makes the lock screen UIs floating-keyboard-friendly. It seems that the obscuring bounds and workspace displacing bounds don't quite fit the behavior pattern that is needed here, but at the same time, I would like to remove all instances of "keyboard bounds getter + some caller-specific conditional logic" throughout the codebase. So I had to add another getter called GetKeyboardLockScreenOffsetBounds(). Specifically, it seems that WebLoginUi is temporarily overriding the overscroll enable state independent of whether the keyboard is locked. This makes the current bounds getters not 100% applicable. I'd like to revisit this and clean it up a bit, but for now, I'd like to get the one-off logic out of the layout manager and into the KeyboardController so that I can add the floating keyboard condition as well. Bug: 787713 Change-Id: I556941b0fa1e060349c3030a0e08eefb7693314f Reviewed-on: https://chromium-review.googlesource.com/828421 Commit-Queue: Blake O'Hare <blakeo@chromium.org> Reviewed-by: Mitsuru Oshima <oshima@chromium.org> Reviewed-by: Yuichiro Hanada <yhanada@chromium.org> Cr-Commit-Position: refs/heads/master@{#525277}
This commit is contained in:
@ -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) {
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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();
|
||||
|
@ -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(
|
||||
|
Reference in New Issue
Block a user