| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "views/controls/textfield/native_textfield_views.h" | 5 #include "views/controls/textfield/native_textfield_views.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 457 break; | 457 break; |
| 458 case app::VKEY_END: | 458 case app::VKEY_END: |
| 459 model_->MoveCursorToEnd(selection); | 459 model_->MoveCursorToEnd(selection); |
| 460 cursor_changed = true; | 460 cursor_changed = true; |
| 461 break; | 461 break; |
| 462 case app::VKEY_HOME: | 462 case app::VKEY_HOME: |
| 463 model_->MoveCursorToStart(selection); | 463 model_->MoveCursorToStart(selection); |
| 464 cursor_changed = true; | 464 cursor_changed = true; |
| 465 break; | 465 break; |
| 466 case app::VKEY_BACK: | 466 case app::VKEY_BACK: |
| 467 if (!model_->HasSelection()) { |
| 468 if (selection && control) { |
| 469 // If both shift and control are pressed, then erase upto the |
| 470 // beginning of the buffer in ChromeOS. In windows, do nothing. |
| 471 #if defined(OS_WIN) |
| 472 break; |
| 473 #else |
| 474 model_->MoveCursorToStart(true); |
| 475 #endif |
| 476 } else if (control) { |
| 477 // If only control is pressed, then erase the previous word. |
| 478 model_->MoveCursorToPreviousWord(true); |
| 479 } |
| 480 } |
| 467 text_changed = model_->Backspace(); | 481 text_changed = model_->Backspace(); |
| 468 cursor_changed = true; | 482 cursor_changed = true; |
| 469 break; | 483 break; |
| 470 case app::VKEY_DELETE: | 484 case app::VKEY_DELETE: |
| 485 if (!model_->HasSelection()) { |
| 486 if (selection && control) { |
| 487 // If both shift and control are pressed, then erase upto the |
| 488 // end of the buffer in ChromeOS. In windows, do nothing. |
| 489 #if defined(OS_WIN) |
| 490 break; |
| 491 #else |
| 492 model_->MoveCursorToEnd(true); |
| 493 #endif |
| 494 } else if (control) { |
| 495 // If only control is pressed, then erase the next word. |
| 496 model_->MoveCursorToNextWord(true); |
| 497 } |
| 498 } |
| 471 text_changed = model_->Delete(); | 499 text_changed = model_->Delete(); |
| 472 break; | 500 break; |
| 473 case app::VKEY_INSERT: | 501 case app::VKEY_INSERT: |
| 474 insert_ = !insert_; | 502 insert_ = !insert_; |
| 475 cursor_changed = true; | 503 cursor_changed = true; |
| 476 break; | 504 break; |
| 477 default: | 505 default: |
| 478 break; | 506 break; |
| 479 } | 507 } |
| 480 char16 print_char = GetPrintableChar(key_event); | 508 char16 print_char = GetPrintableChar(key_event); |
| (...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 714 } | 742 } |
| 715 | 743 |
| 716 void NativeTextfieldViews::TextfieldBorder::SetInsets(int top, | 744 void NativeTextfieldViews::TextfieldBorder::SetInsets(int top, |
| 717 int left, | 745 int left, |
| 718 int bottom, | 746 int bottom, |
| 719 int right) { | 747 int right) { |
| 720 insets_.Set(top, left, bottom, right); | 748 insets_.Set(top, left, bottom, right); |
| 721 } | 749 } |
| 722 | 750 |
| 723 } // namespace views | 751 } // namespace views |
| OLD | NEW |