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

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

Issue 2973463002: MacViews: Don't InsertChar() for consumed events. (Closed)
Patch Set: Fix non-mac Created 3 years, 5 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
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 #import "base/mac/sdk_forward_declarations.h" 10 #import "base/mac/sdk_forward_declarations.h"
(...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after
523 // marked text. However, a KeyEvent will be generated corresponding to 'r'. 523 // marked text. However, a KeyEvent will be generated corresponding to 'r'.
524 524
525 // Currently there seems to be no use case to pass non-character events routed 525 // Currently there seems to be no use case to pass non-character events routed
526 // from insertText: handlers to the View hierarchy. 526 // from insertText: handlers to the View hierarchy.
527 if (isCharacterEvent && ![self hasMarkedText]) { 527 if (isCharacterEvent && ![self hasMarkedText]) {
528 ui::KeyEvent charEvent([text characterAtIndex:0], 528 ui::KeyEvent charEvent([text characterAtIndex:0],
529 ui::KeyboardCodeFromNSEvent(keyDownEvent_), 529 ui::KeyboardCodeFromNSEvent(keyDownEvent_),
530 ui::EF_NONE); 530 ui::EF_NONE);
531 [self handleKeyEvent:&charEvent]; 531 [self handleKeyEvent:&charEvent];
532 hasUnhandledKeyDownEvent_ = NO; 532 hasUnhandledKeyDownEvent_ = NO;
533 if (charEvent.handled())
msw 2017/07/05 19:21:21 q: Should this actually be in the |isCharacterEven
tapted 2017/07/06 05:58:07 This one is a special case. The |charEvent| that g
534 return;
533 } 535 }
534 536
535 // Forward the |text| to |textInputClient_| if no menu is active. 537 // Forward the |text| to |textInputClient_| if no menu is active.
536 if (textInputClient_ && ![self activeMenuController]) { 538 if (textInputClient_ && ![self activeMenuController]) {
537 // If a single character is inserted by keyDown's call to 539 // If a single character is inserted by keyDown's call to
538 // interpretKeyEvents: then use InsertChar() to allow editing events to be 540 // interpretKeyEvents: then use InsertChar() to allow editing events to be
539 // merged. We use ui::VKEY_UNKNOWN as the key code since it's not feasible 541 // merged. We use ui::VKEY_UNKNOWN as the key code since it's not feasible
540 // to determine the correct key code for each unicode character. Also a 542 // to determine the correct key code for each unicode character. Also a
541 // correct keycode is not needed in the current context. Send ui::EF_NONE as 543 // correct keycode is not needed in the current context. Send ui::EF_NONE as
542 // the key modifier since |text| already accounts for the pressed key 544 // the key modifier since |text| already accounts for the pressed key
(...skipping 975 matching lines...) Expand 10 before | Expand all | Expand 10 after
1518 return [hostedView_->GetNativeViewAccessible() accessibilityHitTest:point]; 1520 return [hostedView_->GetNativeViewAccessible() accessibilityHitTest:point];
1519 } 1521 }
1520 1522
1521 - (id)accessibilityFocusedUIElement { 1523 - (id)accessibilityFocusedUIElement {
1522 if (!hostedView_) 1524 if (!hostedView_)
1523 return nil; 1525 return nil;
1524 return [hostedView_->GetNativeViewAccessible() accessibilityFocusedUIElement]; 1526 return [hostedView_->GetNativeViewAccessible() accessibilityFocusedUIElement];
1525 } 1527 }
1526 1528
1527 @end 1529 @end
OLDNEW
« no previous file with comments | « no previous file | ui/views/controls/textfield/textfield_unittest.cc » ('j') | ui/views/controls/textfield/textfield_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698