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

Unified Diff: ash/wm/workspace/workspace_layout_manager.cc

Issue 313463002: Prevent a11y on-screen keyboard from occluding active text field. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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
Index: ash/wm/workspace/workspace_layout_manager.cc
diff --git a/ash/wm/workspace/workspace_layout_manager.cc b/ash/wm/workspace/workspace_layout_manager.cc
index 668f895d2eae1b1e240eaa5fc0b063c997bf4211..801d34356280d941ba1a491c57352deb35bf08c1 100644
--- a/ash/wm/workspace/workspace_layout_manager.cc
+++ b/ash/wm/workspace/workspace_layout_manager.cc
@@ -21,10 +21,13 @@
#include "ui/aura/client/aura_constants.h"
#include "ui/aura/window.h"
#include "ui/aura/window_observer.h"
+#include "ui/base/ime/input_method.h"
+#include "ui/base/ime/text_input_client.h"
#include "ui/base/ui_base_types.h"
#include "ui/compositor/layer.h"
#include "ui/events/event.h"
#include "ui/gfx/screen.h"
+#include "ui/keyboard/keyboard_controller_observer.h"
#include "ui/wm/core/window_util.h"
#include "ui/wm/public/activation_client.h"
@@ -124,6 +127,33 @@ void WorkspaceLayoutManager::SetChildBounds(
}
//////////////////////////////////////////////////////////////////////////////
+// WorkspaceLayoutManager, keyboard::KeyboardControllerObserver implementation:
+
+void WorkspaceLayoutManager::OnKeyboardBoundsChanging(
+ const gfx::Rect& new_bounds) {
+ aura::Window* root_window = ash::Shell::GetInstance()->GetPrimaryRootWindow();
flackr 2014/06/02 20:24:52 Should use the managed root window (i.e. window_->
kevers 2014/06/03 13:21:18 Done.
+ ui::InputMethod* input_method =
+ root_window->GetProperty(aura::client::kRootWindowInputMethodKey);
+ ui::TextInputClient* text_input_client = input_method->GetTextInputClient();
+ if(text_input_client) {
+ aura::Window *window = text_input_client->GetAttachedWindow();
+ if (window && window->parent() &&
+ window->parent()->layout_manager() == this) {
flackr 2014/06/02 20:24:52 I think this condition can just be window_->Contai
kevers 2014/06/03 13:21:18 Done.
+ gfx::Rect window_bounds = window->GetBoundsInScreen();
flackr 2014/06/02 20:24:52 Should this be target bounds (converted to screen
kevers 2014/06/03 13:21:18 Done.
+ gfx::Rect intersect = gfx::IntersectRects(window_bounds, new_bounds);
+ if (intersect.height() > 0) {
+ int shift = std::min(intersect.height(),
+ 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()));
+ }
+ }
+ }
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
// WorkspaceLayoutManager, ash::ShellObserver implementation:
void WorkspaceLayoutManager::OnDisplayWorkAreaInsetsChanged() {

Powered by Google App Engine
This is Rietveld 408576698