Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(752)

Unified Diff: ui/keyboard/keyboard_ui.cc

Issue 2259033003: New accessibility virtual keyboard behavior in non-sticky mode. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixes Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/keyboard/keyboard_controller.cc ('k') | ui/views/controls/textfield/textfield.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/keyboard/keyboard_ui.cc
diff --git a/ui/keyboard/keyboard_ui.cc b/ui/keyboard/keyboard_ui.cc
index 816933bf7e6afbb60488e9af8e7030645900125f..517d3a12351b20c01572ddf64daf7d70d16adda9 100644
--- a/ui/keyboard/keyboard_ui.cc
+++ b/ui/keyboard/keyboard_ui.cc
@@ -4,9 +4,11 @@
#include "ui/keyboard/keyboard_ui.h"
+#include "base/command_line.h"
#include "ui/aura/window.h"
#include "ui/base/ime/input_method.h"
#include "ui/base/ime/text_input_client.h"
+#include "ui/base/ui_base_switches.h"
#include "ui/keyboard/keyboard_controller.h"
namespace keyboard {
@@ -29,14 +31,31 @@ void KeyboardUI::HideKeyboardContainer(aura::Window* container) {
}
void KeyboardUI::EnsureCaretInWorkArea() {
- if (GetInputMethod()->GetTextInputClient()) {
+ if (GetInputMethod()) {
aura::Window* keyboard_window = GetKeyboardWindow();
aura::Window* root_window = keyboard_window->GetRootWindow();
gfx::Rect available_bounds = root_window->bounds();
gfx::Rect keyboard_bounds = keyboard_window->bounds();
- available_bounds.set_height(available_bounds.height() -
- keyboard_bounds.height());
- GetInputMethod()->GetTextInputClient()->EnsureCaretInRect(available_bounds);
+
+ // Only use new virtual keyboard behavior if flag enabled and in non-sticky
+ // mode.
+ bool new_vk_behavior =
+ (base::CommandLine::ForCurrentProcess()->HasSwitch(
+ ::switches::kUseNewVirtualKeyboardBehavior) &&
+ !keyboard::KeyboardController::GetInstance()->get_lock_keyboard());
+
+ if (new_vk_behavior) {
+ // Inform InputMethod of new available screen bounds
+ if (keyboard_controller_->keyboard_visible())
+ available_bounds.set_height(available_bounds.height() -
+ keyboard_bounds.height());
+ GetInputMethod()->SetAvailableBounds(available_bounds);
+ } else if (GetInputMethod()->GetTextInputClient()) {
+ available_bounds.set_height(available_bounds.height() -
+ keyboard_bounds.height());
+ GetInputMethod()->GetTextInputClient()->EnsureCaretInRect(
+ available_bounds);
+ }
}
}
« no previous file with comments | « ui/keyboard/keyboard_controller.cc ('k') | ui/views/controls/textfield/textfield.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698