From e2fa1cca45ffa1aa37e94f306b2508f78408a886 Mon Sep 17 00:00:00 2001 From: "dmazzoni@chromium.org" Date: Wed, 22 Aug 2012 14:07:27 +0000 Subject: Make on-screen keyboard not pop up when switching to a tab. On Windows 8, the on-screen keyboard pops up when a tap occurs inside a focused text box. The tap and the focus can occur in any order; if a tap occurs and later a text box under the tap point gets focused, the OSK will appear. In addition, we fudge the algorithm by telling Windows that focused text boxes have infinite size - that way a tap somewhere on the web that leads to a text box getting focus will open the keyboard. This normally makes sense, as there are often larger click targets around smaller text boxes. This leads to incorrect behavior when you tap on an item in the menu and that results in switching to a tab that already has a focused text box. Windows 8 was interpreting the tap as being on the text box and popping-up the OSK. With the new logic, when switching to a tab that was previously hidden, we first only pop up the OSK if the user taps directly on a focused text box - and as soon as focus changes within the page, we go back to the previous behavior where any tap that focuses a text box can pop up the OSK. BUG=140993 TEST=Select Sign In from menu while sign in page is already open. OSK should not pop up until you click on the text field. Review URL: https://chromiumcodereview.appspot.com/10834418 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@152766 0039d316-1c4b-4281-b951-d872f2087c98 --- content/renderer/renderer_accessibility_focus_only.cc | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'content/renderer') diff --git a/content/renderer/renderer_accessibility_focus_only.cc b/content/renderer/renderer_accessibility_focus_only.cc index da6ed79..d78e125 100644 --- a/content/renderer/renderer_accessibility_focus_only.cc +++ b/content/renderer/renderer_accessibility_focus_only.cc @@ -7,11 +7,13 @@ #include "content/common/accessibility_node_data.h" #include "content/renderer/render_view_impl.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebElement.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebNode.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" using WebKit::WebDocument; +using WebKit::WebElement; using WebKit::WebFrame; using WebKit::WebNode; using WebKit::WebView; @@ -112,7 +114,14 @@ void RendererAccessibilityFocusOnly::HandleFocusedNodeChanged( AccessibilityNodeData& child = notification.acc_tree.children[0]; child.id = next_id_; child.role = AccessibilityNodeData::ROLE_GROUP; - child.location = gfx::Rect(render_view_->size()); + + if (!node.isNull() && node.isElementNode()) { + child.location = gfx::Rect( + const_cast(node).to().boundsInViewportSpace()); + } else { + child.location = gfx::Rect(); + } + if (node_has_focus) { child.state = (1 << AccessibilityNodeData::STATE_FOCUSABLE) | -- cgit v1.1