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

Unified Diff: ui/keyboard/keyboard_controller.cc

Issue 195793004: Implement overscroll support for the virtual keyboard. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge ToT Created 6 years, 8 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 | « content/renderer/render_widget.cc ('k') | ui/keyboard/keyboard_switches.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/keyboard/keyboard_controller.cc
diff --git a/ui/keyboard/keyboard_controller.cc b/ui/keyboard/keyboard_controller.cc
index 52c7c1477194cec5035abf0bb3903c853968afbf..312dd3ab75808acd774797a083b75405bcbbbeab 100644
--- a/ui/keyboard/keyboard_controller.cc
+++ b/ui/keyboard/keyboard_controller.cc
@@ -6,6 +6,9 @@
#include "base/bind.h"
#include "base/command_line.h"
+#include "content/public/browser/render_widget_host.h"
+#include "content/public/browser/render_widget_host_iterator.h"
+#include "content/public/browser/render_widget_host_view.h"
#include "ui/aura/window.h"
#include "ui/aura/window_delegate.h"
#include "ui/base/cursor/cursor.h"
@@ -234,6 +237,32 @@ void KeyboardController::NotifyKeyboardBoundsChanging(
FOR_EACH_OBSERVER(KeyboardControllerObserver,
observer_list_,
OnKeyboardBoundsChanging(new_bounds));
+ if (keyboard::IsKeyboardOverscrollEnabled()) {
+ // Adjust the height of the viewport for visible windows on the primary
+ // display.
+ // TODO(kevers): Add EnvObserver to properly initialize insets if a
+ // window is created while the keyboard is visible.
+ scoped_ptr<content::RenderWidgetHostIterator> widgets(
+ content::RenderWidgetHost::GetRenderWidgetHosts());
+ aura::Window *keyboard_window = proxy_->GetKeyboardWindow();
+ aura::Window *root_window = keyboard_window->GetRootWindow();
+ while (content::RenderWidgetHost* widget = widgets->GetNextHost()) {
+ content::RenderWidgetHostView* view = widget->GetView();
+ aura::Window *window = view->GetNativeView();
+ if (window != keyboard_window && window->GetRootWindow() == root_window)
+ {
+ gfx::Rect window_bounds = window->GetBoundsInScreen();
+ gfx::Rect intersect = gfx::IntersectRects(window_bounds, new_bounds);
+ int overlap = intersect.height();
+ if (overlap > 0 && overlap < window_bounds.height())
+ view->SetInsets(gfx::Insets(0, 0, overlap, 0));
+ else
+ view->SetInsets(gfx::Insets(0, 0, 0, 0));
+ // TODO(kevers): Add window observer to native window to update insets
+ // on a window move or resize.
+ }
+ }
+ }
}
}
« no previous file with comments | « content/renderer/render_widget.cc ('k') | ui/keyboard/keyboard_switches.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698