Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ui/views/controls/textfield/textfield.h" | 5 #include "ui/views/controls/textfield/textfield.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/trace_event/trace_event.h" | 10 #include "base/trace_event/trace_event.h" |
| (...skipping 826 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 837 bool Textfield::CanHandleAccelerators() const { | 837 bool Textfield::CanHandleAccelerators() const { |
| 838 return GetRenderText()->focused() && View::CanHandleAccelerators(); | 838 return GetRenderText()->focused() && View::CanHandleAccelerators(); |
| 839 } | 839 } |
| 840 | 840 |
| 841 void Textfield::AboutToRequestFocusFromTabTraversal(bool reverse) { | 841 void Textfield::AboutToRequestFocusFromTabTraversal(bool reverse) { |
| 842 SelectAll(false); | 842 SelectAll(false); |
| 843 } | 843 } |
| 844 | 844 |
| 845 bool Textfield::SkipDefaultKeyEventProcessing(const ui::KeyEvent& event) { | 845 bool Textfield::SkipDefaultKeyEventProcessing(const ui::KeyEvent& event) { |
| 846 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) | 846 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) |
| 847 // TODO: This bool needs to be set if the key corresponds to altgr+left. | |
| 848 // Linux doesn't have a built-in shortcut for alt+left, so alt doesn't | |
| 849 // need special handling here, but altgr does even thought it doesn't do | |
| 850 // anything with the left arrow as best I can tell. | |
| 851 bool isAltGrLeftBackNavigation = true; | |
|
ojan
2016/05/27 00:53:54
This is the bit of code that needs to be finished
Peter Kasting
2016/05/27 01:11:01
Let me see if I understand. This code needs to re
| |
| 852 | |
| 847 // Skip any accelerator handling that conflicts with custom keybindings. | 853 // Skip any accelerator handling that conflicts with custom keybindings. |
| 848 ui::TextEditKeyBindingsDelegateAuraLinux* delegate = | 854 ui::TextEditKeyBindingsDelegateAuraLinux* delegate = |
| 849 ui::GetTextEditKeyBindingsDelegate(); | 855 ui::GetTextEditKeyBindingsDelegate(); |
| 850 std::vector<ui::TextEditCommandAuraLinux> commands; | 856 std::vector<ui::TextEditCommandAuraLinux> commands; |
| 851 if (delegate && delegate->MatchEvent(event, &commands)) { | 857 if (!isAltGrLeftBackNavigation && |
| 858 (delegate && delegate->MatchEvent(event, &commands))) { | |
| 852 const bool rtl = GetTextDirection() == base::i18n::RIGHT_TO_LEFT; | 859 const bool rtl = GetTextDirection() == base::i18n::RIGHT_TO_LEFT; |
| 853 for (size_t i = 0; i < commands.size(); ++i) | 860 for (size_t i = 0; i < commands.size(); ++i) |
| 854 if (IsCommandIdEnabled(GetViewsCommand(commands[i], rtl))) | 861 if (IsCommandIdEnabled(GetViewsCommand(commands[i], rtl))) |
| 855 return true; | 862 return true; |
| 856 } | 863 } |
| 857 #endif | 864 #endif |
| 858 | 865 |
| 859 // Skip backspace accelerator handling; editable textfields handle this key. | 866 // Skip backspace accelerator handling; editable textfields handle this key. |
| 860 // Also skip processing Windows [Alt]+<num-pad digit> Unicode alt-codes. | 867 // Also skip processing Windows [Alt]+<num-pad digit> Unicode alt-codes. |
| 861 const bool is_backspace = event.key_code() == ui::VKEY_BACK; | 868 const bool is_backspace = event.key_code() == ui::VKEY_BACK; |
| (...skipping 1063 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1925 RequestFocus(); | 1932 RequestFocus(); |
| 1926 model_->MoveCursorTo(mouse); | 1933 model_->MoveCursorTo(mouse); |
| 1927 if (!selection_clipboard_text.empty()) { | 1934 if (!selection_clipboard_text.empty()) { |
| 1928 model_->InsertText(selection_clipboard_text); | 1935 model_->InsertText(selection_clipboard_text); |
| 1929 UpdateAfterChange(true, true); | 1936 UpdateAfterChange(true, true); |
| 1930 } | 1937 } |
| 1931 OnAfterUserAction(); | 1938 OnAfterUserAction(); |
| 1932 } | 1939 } |
| 1933 | 1940 |
| 1934 } // namespace views | 1941 } // namespace views |
| OLD | NEW |