summaryrefslogtreecommitdiffstats
path: root/chrome/renderer
diff options
context:
space:
mode:
authordhollowa@chromium.org <dhollowa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-12 02:10:13 +0000
committerdhollowa@chromium.org <dhollowa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-12 02:10:13 +0000
commite1751fb1116682ffba80cbc127b9da66c6d72a3c (patch)
treeaf347a4584c63e8c26be368f7ee8e9d1674b6a72 /chrome/renderer
parented7e6ddb36da793ce54afb2a9ea2d8d022f80141 (diff)
downloadchromium_src-e1751fb1116682ffba80cbc127b9da66c6d72a3c.zip
chromium_src-e1751fb1116682ffba80cbc127b9da66c6d72a3c.tar.gz
chromium_src-e1751fb1116682ffba80cbc127b9da66c6d72a3c.tar.bz2
[Auto-fill] Input field loses keyboard focus with 'ESC' key.
Clearing the suggested value in the focused node can cause selection to be lost. We force selection range to restore text cursor. BUG=58362 TEST=Manual, according to bug steps. Review URL: http://codereview.chromium.org/3671003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@62227 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer')
-rw-r--r--chrome/renderer/form_manager.cc8
1 files changed, 8 insertions, 0 deletions
diff --git a/chrome/renderer/form_manager.cc b/chrome/renderer/form_manager.cc
index fc0db89..9c49fd6 100644
--- a/chrome/renderer/form_manager.cc
+++ b/chrome/renderer/form_manager.cc
@@ -618,6 +618,14 @@ bool FormManager::ClearPreviewedFormWithNode(const WebNode& node) {
input_element.setSuggestedValue(string16());
input_element.setAutofilled(false);
+
+ // Clearing the suggested value in the focused node (above) can cause
+ // selection to be lost. We force selection range to restore the text
+ // cursor.
+ if (node == input_element) {
+ input_element.setSelectionRange(input_element.value().length(),
+ input_element.value().length());
+ }
}
return true;