Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(158)

Unified Diff: ui/views/controls/textfield/native_textfield_views.cc

Issue 14827004: cros: Arrow key traversal in views. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ui/views/controls/textfield/native_textfield_views.cc
diff --git a/ui/views/controls/textfield/native_textfield_views.cc b/ui/views/controls/textfield/native_textfield_views.cc
index 2df59c9a592d7f753ec4bd0819aa71ca2445798d..4dad43a208af45dc3e81b4eb3c4b68d700381d7b 100644
--- a/ui/views/controls/textfield/native_textfield_views.cc
+++ b/ui/views/controls/textfield/native_textfield_views.cc
@@ -1179,18 +1179,20 @@ bool NativeTextfieldViews::HandleKeyEvent(const ui::KeyEvent& key_event) {
cursor_changed = text_changed = Paste();
break;
case ui::VKEY_RIGHT:
- case ui::VKEY_LEFT:
+ case ui::VKEY_LEFT: {
// We should ignore the alt-left/right keys because alt key doesn't make
// any special effects for them and they can be shortcut keys such like
// forward/back of the browser history.
if (key_event.IsAltDown())
break;
+ size_t cursor_position = model_->GetCursorPosition();
model_->MoveCursor(
control ? gfx::WORD_BREAK : gfx::CHARACTER_BREAK,
(key_code == ui::VKEY_RIGHT) ? gfx::CURSOR_RIGHT : gfx::CURSOR_LEFT,
shift);
- cursor_changed = true;
+ cursor_changed = model_->GetCursorPosition() != cursor_position;
msw 2013/07/25 00:32:53 This is wrong and caused a regression, see http://
break;
+ }
case ui::VKEY_END:
case ui::VKEY_HOME:
if ((key_code == ui::VKEY_HOME) ==

Powered by Google App Engine
This is Rietveld 408576698