summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/renderer_host/render_view_host.cc4
-rw-r--r--chrome/browser/renderer_host/render_view_host.h3
-rw-r--r--chrome/browser/ui/touch/frame/touch_browser_frame_view.cc9
3 files changed, 16 insertions, 0 deletions
diff --git a/chrome/browser/renderer_host/render_view_host.cc b/chrome/browser/renderer_host/render_view_host.cc
index c35be60..83b1f8c 100644
--- a/chrome/browser/renderer_host/render_view_host.cc
+++ b/chrome/browser/renderer_host/render_view_host.cc
@@ -695,6 +695,10 @@ void RenderViewHost::ClearFocusedNode() {
Send(new ViewMsg_ClearFocusedNode(routing_id()));
}
+void RenderViewHost::ScrollFocusedEditableNodeIntoView() {
+ Send(new ViewMsg_ScrollFocusedEditableNodeIntoView(routing_id()));
+}
+
void RenderViewHost::UpdateWebPreferences(const WebPreferences& prefs) {
Send(new ViewMsg_UpdateWebPreferences(routing_id(), prefs));
}
diff --git a/chrome/browser/renderer_host/render_view_host.h b/chrome/browser/renderer_host/render_view_host.h
index db915e6..4a23704 100644
--- a/chrome/browser/renderer_host/render_view_host.h
+++ b/chrome/browser/renderer_host/render_view_host.h
@@ -366,6 +366,9 @@ class RenderViewHost : public RenderWidgetHost {
// Clears the node that is currently focused (if any).
void ClearFocusedNode();
+ // Tells the renderer view to scroll to the focused node.
+ void ScrollFocusedEditableNodeIntoView();
+
// Update render view specific (WebKit) preferences.
void UpdateWebPreferences(const WebPreferences& prefs);
diff --git a/chrome/browser/ui/touch/frame/touch_browser_frame_view.cc b/chrome/browser/ui/touch/frame/touch_browser_frame_view.cc
index 39ae523..1fd5197 100644
--- a/chrome/browser/ui/touch/frame/touch_browser_frame_view.cc
+++ b/chrome/browser/ui/touch/frame/touch_browser_frame_view.cc
@@ -7,6 +7,7 @@
#include <algorithm>
#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/renderer_host/render_view_host.h"
#include "chrome/browser/renderer_host/site_instance.h"
#include "chrome/browser/tab_contents/navigation_controller.h"
#include "chrome/browser/tab_contents/tab_contents.h"
@@ -98,6 +99,14 @@ void TouchBrowserFrameView::UpdateKeyboardAndLayout(bool should_show_keyboard) {
// Because the NonClientFrameView is a sibling of the ClientView, we rely on
// the parent to resize the ClientView instead of resizing it directly.
GetParent()->Layout();
+
+ // The keyboard that pops up may end up hiding the text entry. So make sure
+ // the renderer scrolls when necessary to keep the textfield visible.
+ if (keyboard_showing_) {
+ RenderViewHost* host =
+ browser_view()->browser()->GetSelectedTabContents()->render_view_host();
+ host->ScrollFocusedEditableNodeIntoView();
+ }
}
void TouchBrowserFrameView::Observe(NotificationType type,