Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(297)

Side by Side Diff: ui/views/cocoa/bridged_content_view.mm

Issue 1912993002: MacViews: Implement NSResponder deletion action messages. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Change "Depends on Patchset". Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | ui/views/cocoa/bridged_native_widget_unittest.mm » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 549 matching lines...) Expand 10 before | Expand all | Expand 10 after
560 hostedView_->GetWidget()->OnMouseEvent(&event); 560 hostedView_->GetWidget()->OnMouseEvent(&event);
561 } 561 }
562 562
563 //////////////////////////////////////////////////////////////////////////////// 563 ////////////////////////////////////////////////////////////////////////////////
564 // NSResponder Action Messages. Keep sorted according NSResponder.h (from the 564 // NSResponder Action Messages. Keep sorted according NSResponder.h (from the
565 // 10.9 SDK). The list should eventually be complete. Anything not defined will 565 // 10.9 SDK). The list should eventually be complete. Anything not defined will
566 // beep when interpretKeyEvents: would otherwise call it. 566 // beep when interpretKeyEvents: would otherwise call it.
567 // TODO(tapted): Make this list complete, except for insert* methods which are 567 // TODO(tapted): Make this list complete, except for insert* methods which are
568 // dispatched as regular key events in doCommandBySelector:. 568 // dispatched as regular key events in doCommandBySelector:.
569 569
570 // views::Textfields are single-line only, map Paragraph and Document commands
571 // to Line.
572
570 // The insertText action message forwards to the TextInputClient unless a menu 573 // The insertText action message forwards to the TextInputClient unless a menu
571 // is active. Note that NSResponder's interpretKeyEvents: implementation doesn't 574 // is active. Note that NSResponder's interpretKeyEvents: implementation doesn't
572 // direct insertText: through doCommandBySelector:, so this is still needed to 575 // direct insertText: through doCommandBySelector:, so this is still needed to
573 // handle the case when inputContext: is nil. When inputContext: returns non-nil 576 // handle the case when inputContext: is nil. When inputContext: returns non-nil
574 // text goes directly to insertText:replacementRange:. 577 // text goes directly to insertText:replacementRange:.
575 - (void)insertText:(id)text { 578 - (void)insertText:(id)text {
576 [self insertText:text replacementRange:NSMakeRange(NSNotFound, 0)]; 579 [self insertText:text replacementRange:NSMakeRange(NSNotFound, 0)];
577 } 580 }
578 581
579 // Selection movement and scrolling. 582 // Selection movement and scrolling.
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 [self handleAction:IDS_DELETE_WORD_BACKWARD
704 keyCode:ui::VKEY_BACK 707 keyCode:ui::VKEY_BACK
705 domCode:ui::DomCode::BACKSPACE 708 domCode:ui::DomCode::BACKSPACE
706 eventFlags:ui::EF_CONTROL_DOWN]; 709 eventFlags:ui::EF_CONTROL_DOWN];
707 } 710 }
708 711
712 - (void)deleteToBeginningOfLine:(id)sender {
713 [self handleAction:IDS_DELETE_TO_BEGINNING_OF_LINE
714 keyCode:ui::VKEY_BACK
715 domCode:ui::DomCode::BACKSPACE
716 eventFlags:ui::EF_CONTROL_DOWN | ui::EF_SHIFT_DOWN];
717 }
718
719 - (void)deleteToEndOfLine:(id)sender {
720 [self handleAction:IDS_DELETE_TO_END_OF_LINE
721 keyCode:ui::VKEY_DELETE
722 domCode:ui::DomCode::DEL
723 eventFlags:ui::EF_CONTROL_DOWN | ui::EF_SHIFT_DOWN];
724 }
725
726 - (void)deleteToBeginningOfParagraph:(id)sender {
727 [self deleteToBeginningOfLine:sender];
728 }
729
730 - (void)deleteToEndOfParagraph:(id)sender {
731 [self deleteToEndOfLine:sender];
732 }
733
709 // Cancellation. 734 // Cancellation.
710 735
711 - (void)cancelOperation:(id)sender { 736 - (void)cancelOperation:(id)sender {
712 [self handleAction:0 737 [self handleAction:0
713 keyCode:ui::VKEY_ESCAPE 738 keyCode:ui::VKEY_ESCAPE
714 domCode:ui::DomCode::ESCAPE 739 domCode:ui::DomCode::ESCAPE
715 eventFlags:0]; 740 eventFlags:0];
716 } 741 }
717 742
718 // Support for Services in context menus. 743 // Support for Services in context menus.
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
927 } 952 }
928 953
929 return [super accessibilityAttributeValue:attribute]; 954 return [super accessibilityAttributeValue:attribute];
930 } 955 }
931 956
932 - (id)accessibilityHitTest:(NSPoint)point { 957 - (id)accessibilityHitTest:(NSPoint)point {
933 return [hostedView_->GetNativeViewAccessible() accessibilityHitTest:point]; 958 return [hostedView_->GetNativeViewAccessible() accessibilityHitTest:point];
934 } 959 }
935 960
936 @end 961 @end
OLDNEW
« no previous file with comments | « no previous file | ui/views/cocoa/bridged_native_widget_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698