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

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: Add early return. 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
« no previous file with comments | « ash/wm/workspace/workspace_layout_manager.h ('k') | ash/wm/workspace/workspace_layout_manager_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..0326e6a6f3f8d6418773e85e229f3899059deb38 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,32 @@ void WorkspaceLayoutManager::SetChildBounds(
}
//////////////////////////////////////////////////////////////////////////////
+// WorkspaceLayoutManager, keyboard::KeyboardControllerObserver implementation:
+
+void WorkspaceLayoutManager::OnKeyboardBoundsChanging(
+ const gfx::Rect& new_bounds) {
+ aura::Window* root_window = window_->GetRootWindow();
+ ui::InputMethod* input_method =
+ root_window->GetProperty(aura::client::kRootWindowInputMethodKey);
+ ui::TextInputClient* text_input_client = input_method->GetTextInputClient();
+ if(!text_input_client)
+ return;
+ aura::Window *window = text_input_client->GetAttachedWindow();
+ if (!window || !window_->Contains(window))
+ return;
+ 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());
+ 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() {
« no previous file with comments | « ash/wm/workspace/workspace_layout_manager.h ('k') | ash/wm/workspace/workspace_layout_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698