Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #import "ui/views/cocoa/bridged_content_view.h" | 5 #import "ui/views/cocoa/bridged_content_view.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #import "base/mac/mac_util.h" | 8 #import "base/mac/mac_util.h" |
| 9 #import "base/mac/scoped_nsobject.h" | 9 #import "base/mac/scoped_nsobject.h" |
| 10 #include "base/strings/sys_string_conversions.h" | 10 #include "base/strings/sys_string_conversions.h" |
| (...skipping 675 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 686 } | 686 } |
| 687 | 687 |
| 688 - (void)deleteBackward:(id)sender { | 688 - (void)deleteBackward:(id)sender { |
| 689 [self handleAction:IDS_DELETE_BACKWARD | 689 [self handleAction:IDS_DELETE_BACKWARD |
| 690 keyCode:ui::VKEY_BACK | 690 keyCode:ui::VKEY_BACK |
| 691 domCode:ui::DomCode::BACKSPACE | 691 domCode:ui::DomCode::BACKSPACE |
| 692 eventFlags:0]; | 692 eventFlags:0]; |
| 693 } | 693 } |
| 694 | 694 |
| 695 - (void)deleteWordForward:(id)sender { | 695 - (void)deleteWordForward:(id)sender { |
| 696 [self handleAction:IDS_DELETE_WORD_FORWARD | 696 // In case of a non-empty selection, delete the selection. |
| 697 int command = [self selectedRange].length ? IDS_DELETE_FORWARD | |
|
karandeepb
2016/04/22 02:02:46
For other platforms, this case is handled in Textf
tapted
2016/04/26 05:46:54
Yeah I like the idea of moving this into ExecuteCo
karandeepb
2016/04/29 01:52:48
Done. CL here - https://codereview.chromium.org/19
| |
| 698 : IDS_DELETE_WORD_FORWARD; | |
| 699 [self handleAction:command | |
| 697 keyCode:ui::VKEY_DELETE | 700 keyCode:ui::VKEY_DELETE |
| 698 domCode:ui::DomCode::DEL | 701 domCode:ui::DomCode::DEL |
| 699 eventFlags:ui::EF_CONTROL_DOWN]; | 702 eventFlags:ui::EF_CONTROL_DOWN]; |
| 700 } | 703 } |
| 701 | 704 |
| 702 - (void)deleteWordBackward:(id)sender { | 705 - (void)deleteWordBackward:(id)sender { |
| 703 [self handleAction:IDS_DELETE_WORD_BACKWARD | 706 // In case of a non-empty selection, delete the selection. |
| 707 int command = [self selectedRange].length ? IDS_DELETE_BACKWARD | |
| 708 : IDS_DELETE_WORD_BACKWARD; | |
| 709 [self handleAction:command | |
| 704 keyCode:ui::VKEY_BACK | 710 keyCode:ui::VKEY_BACK |
| 705 domCode:ui::DomCode::BACKSPACE | 711 domCode:ui::DomCode::BACKSPACE |
| 706 eventFlags:ui::EF_CONTROL_DOWN]; | 712 eventFlags:ui::EF_CONTROL_DOWN]; |
| 707 } | 713 } |
| 708 | 714 |
| 715 - (void)deleteToBeginningOfLine:(id)sender { | |
| 716 // In case of a non-empty selection, delete the selection. | |
| 717 int command = [self selectedRange].length ? IDS_DELETE_BACKWARD | |
| 718 : IDS_DELETE_TO_BEGINNING_OF_LINE; | |
| 719 [self handleAction:command | |
| 720 keyCode:ui::VKEY_BACK | |
| 721 domCode:ui::DomCode::BACKSPACE | |
| 722 eventFlags:ui::EF_CONTROL_DOWN | ui::EF_SHIFT_DOWN]; | |
| 723 } | |
| 724 | |
| 725 - (void)deleteToEndOfLine:(id)sender { | |
| 726 // In case of a non-empty selection, delete the selection. | |
| 727 int command = [self selectedRange].length ? IDS_DELETE_FORWARD | |
| 728 : IDS_DELETE_TO_END_OF_LINE; | |
| 729 [self handleAction:command | |
| 730 keyCode:ui::VKEY_DELETE | |
| 731 domCode:ui::DomCode::DEL | |
| 732 eventFlags:ui::EF_CONTROL_DOWN | ui::EF_SHIFT_DOWN]; | |
| 733 } | |
| 734 | |
| 735 - (void)deleteToBeginningOfParagraph:(id)sender { | |
| 736 // Since we currently only support single line textfields, forward the action | |
|
tapted
2016/04/26 05:46:54
Generally it's bad to repeat comments - just like
karandeepb
2016/04/29 01:52:48
Done. If it's ok, will add the movement commands i
| |
| 737 // message to deleteToBeginningOfLine:. | |
| 738 [self deleteToBeginningOfLine:sender]; | |
| 739 } | |
| 740 | |
| 741 - (void)deleteToEndOfParagraph:(id)sender { | |
| 742 // Since we currently only support single line textfields, forward the action | |
| 743 // message to deleteToEndOfLine:. | |
| 744 [self deleteToEndOfLine:sender]; | |
| 745 } | |
| 746 | |
| 709 // Cancellation. | 747 // Cancellation. |
| 710 | 748 |
| 711 - (void)cancelOperation:(id)sender { | 749 - (void)cancelOperation:(id)sender { |
| 712 [self handleAction:0 | 750 [self handleAction:0 |
| 713 keyCode:ui::VKEY_ESCAPE | 751 keyCode:ui::VKEY_ESCAPE |
| 714 domCode:ui::DomCode::ESCAPE | 752 domCode:ui::DomCode::ESCAPE |
| 715 eventFlags:0]; | 753 eventFlags:0]; |
| 716 } | 754 } |
| 717 | 755 |
| 718 // Support for Services in context menus. | 756 // Support for Services in context menus. |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 927 } | 965 } |
| 928 | 966 |
| 929 return [super accessibilityAttributeValue:attribute]; | 967 return [super accessibilityAttributeValue:attribute]; |
| 930 } | 968 } |
| 931 | 969 |
| 932 - (id)accessibilityHitTest:(NSPoint)point { | 970 - (id)accessibilityHitTest:(NSPoint)point { |
| 933 return [hostedView_->GetNativeViewAccessible() accessibilityHitTest:point]; | 971 return [hostedView_->GetNativeViewAccessible() accessibilityHitTest:point]; |
| 934 } | 972 } |
| 935 | 973 |
| 936 @end | 974 @end |
| OLD | NEW |