summaryrefslogtreecommitdiffstats
path: root/views
diff options
context:
space:
mode:
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();
}
}