diff options
author | sadrul@chromium.org <sadrul@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-12-20 18:58:38 +0000 |
---|---|---|
committer | sadrul@chromium.org <sadrul@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-12-20 18:58:38 +0000 |
commit | 76cc967de7e8174f8ab920cf6ac44f60eca13576 (patch) | |
tree | c56996960037cbfaf6afef6850aace4380776dc0 /chrome | |
parent | b83e8a33e5c10843a756db36b4d3536340c06e95 (diff) | |
download | chromium_src-76cc967de7e8174f8ab920cf6ac44f60eca13576.zip chromium_src-76cc967de7e8174f8ab920cf6ac44f60eca13576.tar.gz chromium_src-76cc967de7e8174f8ab920cf6ac44f60eca13576.tar.bz2 |
touchui: Make sure the textfield isn't obscured by the keyboard.
When the virtual keyboard pops up, it can end up hiding the textfield when it's
towards the bottom of the page. So make sure the textfield is visible after the
keyboard is displayed.
BUG=keyboard hides a focused textfield if it's towards the bottom of the page.
TEST=see bug
Review URL: http://codereview.chromium.org/6074001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@69730 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/browser/renderer_host/render_view_host.cc | 4 | ||||
-rw-r--r-- | chrome/browser/renderer_host/render_view_host.h | 3 | ||||
-rw-r--r-- | chrome/browser/ui/touch/frame/touch_browser_frame_view.cc | 9 |
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, |