| 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 | 8 |
| 9 #include "base/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
| 10 #include "grit/ui_strings.h" | 10 #include "grit/ui_strings.h" |
| (...skipping 706 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 717 ui::GetTextEditKeyBindingsDelegate(); | 717 ui::GetTextEditKeyBindingsDelegate(); |
| 718 std::vector<ui::TextEditCommandAuraLinux> commands; | 718 std::vector<ui::TextEditCommandAuraLinux> commands; |
| 719 if (delegate && delegate->MatchEvent(event, &commands)) { | 719 if (delegate && delegate->MatchEvent(event, &commands)) { |
| 720 const bool rtl = GetTextDirection() == base::i18n::RIGHT_TO_LEFT; | 720 const bool rtl = GetTextDirection() == base::i18n::RIGHT_TO_LEFT; |
| 721 for (size_t i = 0; i < commands.size(); ++i) | 721 for (size_t i = 0; i < commands.size(); ++i) |
| 722 if (IsCommandIdEnabled(GetViewsCommand(commands[i], rtl))) | 722 if (IsCommandIdEnabled(GetViewsCommand(commands[i], rtl))) |
| 723 return true; | 723 return true; |
| 724 } | 724 } |
| 725 #endif | 725 #endif |
| 726 | 726 |
| 727 // Skip any accelerator handling of backspace; textfields handle this key. | 727 // Skip backspace accelerator handling; editable textfields handle this key. |
| 728 // Also skip processing Windows [Alt]+<num-pad digit> Unicode alt-codes. | 728 // Also skip processing Windows [Alt]+<num-pad digit> Unicode alt-codes. |
| 729 return event.key_code() == ui::VKEY_BACK || event.IsUnicodeKeyCode(); | 729 const bool is_backspace = event.key_code() == ui::VKEY_BACK; |
| 730 return (is_backspace && !read_only()) || event.IsUnicodeKeyCode(); |
| 730 } | 731 } |
| 731 | 732 |
| 732 bool Textfield::GetDropFormats( | 733 bool Textfield::GetDropFormats( |
| 733 int* formats, | 734 int* formats, |
| 734 std::set<OSExchangeData::CustomFormat>* custom_formats) { | 735 std::set<OSExchangeData::CustomFormat>* custom_formats) { |
| 735 if (!enabled() || read_only()) | 736 if (!enabled() || read_only()) |
| 736 return false; | 737 return false; |
| 737 // TODO(msw): Can we support URL, FILENAME, etc.? | 738 // TODO(msw): Can we support URL, FILENAME, etc.? |
| 738 *formats = ui::OSExchangeData::STRING; | 739 *formats = ui::OSExchangeData::STRING; |
| 739 if (controller_) | 740 if (controller_) |
| (...skipping 940 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1680 const size_t length = selection_clipboard_text.length(); | 1681 const size_t length = selection_clipboard_text.length(); |
| 1681 range = gfx::Range(range.start() + length, range.end() + length); | 1682 range = gfx::Range(range.start() + length, range.end() + length); |
| 1682 } | 1683 } |
| 1683 model_->MoveCursorTo(gfx::SelectionModel(range, affinity)); | 1684 model_->MoveCursorTo(gfx::SelectionModel(range, affinity)); |
| 1684 UpdateAfterChange(true, true); | 1685 UpdateAfterChange(true, true); |
| 1685 OnAfterUserAction(); | 1686 OnAfterUserAction(); |
| 1686 } | 1687 } |
| 1687 } | 1688 } |
| 1688 | 1689 |
| 1689 } // namespace views | 1690 } // namespace views |
| OLD | NEW |