summaryrefslogtreecommitdiffstats
path: root/views
diff options
context:
space:
mode:
authorxji@chromium.org <xji@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-10 22:05:18 +0000
committerxji@chromium.org <xji@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-10 22:05:18 +0000
commit534338524f8c22104b39a3aef2bd409827b666ef (patch)
tree4333b6884a19866ac833370c28e70a95fe9fc8e7 /views
parent2ad69c89162c0bb2cb9560d1d70ddbd928a37dc3 (diff)
downloadchromium_src-534338524f8c22104b39a3aef2bd409827b666ef.zip
chromium_src-534338524f8c22104b39a3aef2bd409827b666ef.tar.gz
chromium_src-534338524f8c22104b39a3aef2bd409827b666ef.tar.bz2
Same issue as in omnibox, keyboard layout change inside DefWindowProc() in
NativeTextfieldWin::HandleKeystroke(). Restore keyboard layout after DefWindowProc(). BUG=14049 TEST=open find-in-page, type in pure Hebrew, press HOME/END/shift-HOME/shift-END, keyboard layout should not be changed. Review URL: http://codereview.chromium.org/2738008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@49455 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views')
-rw-r--r--views/controls/textfield/native_textfield_win.cc25
1 files changed, 23 insertions, 2 deletions
diff --git a/views/controls/textfield/native_textfield_win.cc b/views/controls/textfield/native_textfield_win.cc
index a981b79..75c8325 100644
--- a/views/controls/textfield/native_textfield_win.cc
+++ b/views/controls/textfield/native_textfield_win.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -774,7 +774,28 @@ void NativeTextfieldWin::HandleKeystroke(UINT message,
if (!handled) {
OnBeforePossibleChange();
- DefWindowProc(message, key, MAKELPARAM(repeat_count, flags));
+
+ if (key == base::VKEY_HOME || key == base::VKEY_END) {
+ // DefWindowProc() might reset the keyboard layout when it receives a
+ // keydown event for VKEY_HOME or VKEY_END. When the window was created
+ // with WS_EX_LAYOUTRTL and the current keyboard layout is not a RTL one,
+ // if the input text is pure LTR text, the layout changes to the first RTL
+ // keyboard layout in keyboard layout queue; if the input text is
+ // bidirectional text, the layout changes to the keyboard layout of the
+ // first RTL character in input text. When the window was created without
+ // WS_EX_LAYOUTRTL and the current keyboard layout is not a LTR one, if
+ // the input text is pure RTL text, the layout changes to English; if the
+ // input text is bidirectional text, the layout changes to the keyboard
+ // layout of the first LTR character in input text. Such keyboard layout
+ // change behavior is surprising and inconsistent with keyboard behavior
+ // elsewhere, so reset the layout in this case.
+ HKL layout = GetKeyboardLayout(0);
+ DefWindowProc(message, key, MAKELPARAM(repeat_count, flags));
+ ActivateKeyboardLayout(layout, KLF_REORDER);
+ } else {
+ DefWindowProc(message, key, MAKELPARAM(repeat_count, flags));
+ }
+
OnAfterPossibleChange();
}
}