| 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 1301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1312 case IDS_DELETE_TO_BEGINNING_OF_LINE: | 1312 case IDS_DELETE_TO_BEGINNING_OF_LINE: |
| 1313 command_id = IDS_DELETE_BACKWARD; | 1313 command_id = IDS_DELETE_BACKWARD; |
| 1314 break; | 1314 break; |
| 1315 case IDS_DELETE_WORD_FORWARD: | 1315 case IDS_DELETE_WORD_FORWARD: |
| 1316 case IDS_DELETE_TO_END_OF_LINE: | 1316 case IDS_DELETE_TO_END_OF_LINE: |
| 1317 command_id = IDS_DELETE_FORWARD; | 1317 command_id = IDS_DELETE_FORWARD; |
| 1318 break; | 1318 break; |
| 1319 } | 1319 } |
| 1320 } | 1320 } |
| 1321 | 1321 |
| 1322 if (!IsCommandIdEnabled(command_id)) | 1322 // We only execute the commands enabled in Textfield::IsCommandIdEnabled |
| 1323 // below. Hence don't do a virtual IsCommandIdEnabled call. |
| 1324 if (!Textfield::IsCommandIdEnabled(command_id)) |
| 1323 return; | 1325 return; |
| 1324 | 1326 |
| 1325 bool text_changed = false; | 1327 bool text_changed = false; |
| 1326 bool cursor_changed = false; | 1328 bool cursor_changed = false; |
| 1327 bool rtl = GetTextDirection() == base::i18n::RIGHT_TO_LEFT; | 1329 bool rtl = GetTextDirection() == base::i18n::RIGHT_TO_LEFT; |
| 1328 gfx::VisualCursorDirection begin = rtl ? gfx::CURSOR_RIGHT : gfx::CURSOR_LEFT; | 1330 gfx::VisualCursorDirection begin = rtl ? gfx::CURSOR_RIGHT : gfx::CURSOR_LEFT; |
| 1329 gfx::VisualCursorDirection end = rtl ? gfx::CURSOR_LEFT : gfx::CURSOR_RIGHT; | 1331 gfx::VisualCursorDirection end = rtl ? gfx::CURSOR_LEFT : gfx::CURSOR_RIGHT; |
| 1330 gfx::SelectionModel selection_model = GetSelectionModel(); | 1332 gfx::SelectionModel selection_model = GetSelectionModel(); |
| 1331 | 1333 |
| 1332 OnBeforeUserAction(); | 1334 OnBeforeUserAction(); |
| (...skipping 596 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1929 RequestFocus(); | 1931 RequestFocus(); |
| 1930 model_->MoveCursorTo(mouse); | 1932 model_->MoveCursorTo(mouse); |
| 1931 if (!selection_clipboard_text.empty()) { | 1933 if (!selection_clipboard_text.empty()) { |
| 1932 model_->InsertText(selection_clipboard_text); | 1934 model_->InsertText(selection_clipboard_text); |
| 1933 UpdateAfterChange(true, true); | 1935 UpdateAfterChange(true, true); |
| 1934 } | 1936 } |
| 1935 OnAfterUserAction(); | 1937 OnAfterUserAction(); |
| 1936 } | 1938 } |
| 1937 | 1939 |
| 1938 } // namespace views | 1940 } // namespace views |
| OLD | NEW |