Index: views/controls/textfield/native_textfield_views.cc |
diff --git a/views/controls/textfield/native_textfield_views.cc b/views/controls/textfield/native_textfield_views.cc |
index a4220d7cab40625b557cdc5d3556ca688c05ed2a..291644520a9477562e5b97ece141229e7ffa93b6 100644 |
--- a/views/controls/textfield/native_textfield_views.cc |
+++ b/views/controls/textfield/native_textfield_views.cc |
@@ -873,11 +873,18 @@ bool NativeTextfieldViews::HandleKeyEvent(const KeyEvent& key_event) { |
cursor_changed = true; |
break; |
case ui::VKEY_END: |
- model_->MoveCursorRight(gfx::LINE_BREAK, selection); |
- cursor_changed = true; |
- break; |
case ui::VKEY_HOME: |
- model_->MoveCursorLeft(gfx::LINE_BREAK, selection); |
+ // TODO(msw): Implement RenderText::GetTextDirection for platforms. |
+ // Windows string directionality is determined by UI directionality. |
+ // Linux/ChromeOS uses the first strong directionality character. |
+#if defined(OS_WIN) |
+ if (base::i18n::IsRTL() == (key_code == ui::VKEY_HOME)) |
+#else |
+ if (key_code == ui::VKEY_END) |
+#endif |
+ model_->MoveCursorRight(gfx::LINE_BREAK, selection); |
+ else |
+ model_->MoveCursorLeft(gfx::LINE_BREAK, selection); |
cursor_changed = true; |
break; |
case ui::VKEY_BACK: |
@@ -920,7 +927,7 @@ bool NativeTextfieldViews::HandleKeyEvent(const KeyEvent& key_event) { |
cursor_changed = text_changed = model_->Delete(); |
break; |
case ui::VKEY_INSERT: |
- GetRenderText()->toggle_insert_mode(); |
+ GetRenderText()->ToggleInsertMode(); |
cursor_changed = true; |
break; |
default: |