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

Side by Side Diff: content/browser/renderer_host/render_widget_host_view_mac.mm

Issue 8227018: mac: Almost fix Lion accented character bubble input in web contents. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: test Created 9 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « content/browser/renderer_host/render_widget_host.cc ('k') | content/common/view_messages.h » ('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 (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "content/browser/renderer_host/render_widget_host_view_mac.h" 5 #include "content/browser/renderer_host/render_widget_host_view_mac.h"
6 6
7 #include <QuartzCore/QuartzCore.h> 7 #include <QuartzCore/QuartzCore.h>
8 8
9 #include "base/debug/trace_event.h" 9 #include "base/debug/trace_event.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 2460 matching lines...) Expand 10 before | Expand all | Expand 10 after
2471 // events, such as the Characters dialog. In this case the text should be 2471 // events, such as the Characters dialog. In this case the text should be
2472 // sent as an input method event as well. 2472 // sent as an input method event as well.
2473 // TODO(suzhe): It's hard for us to support replacementRange without accessing 2473 // TODO(suzhe): It's hard for us to support replacementRange without accessing
2474 // the full web content. NOTE: If someone adds support for this, make sure 2474 // the full web content. NOTE: If someone adds support for this, make sure
2475 // it works with the default range passed in by -insertText: below. 2475 // it works with the default range passed in by -insertText: below.
2476 BOOL isAttributedString = [string isKindOfClass:[NSAttributedString class]]; 2476 BOOL isAttributedString = [string isKindOfClass:[NSAttributedString class]];
2477 NSString* im_text = isAttributedString ? [string string] : string; 2477 NSString* im_text = isAttributedString ? [string string] : string;
2478 if (handlingKeyDown_) { 2478 if (handlingKeyDown_) {
2479 textToBeInserted_.append(base::SysNSStringToUTF16(im_text)); 2479 textToBeInserted_.append(base::SysNSStringToUTF16(im_text));
2480 } else { 2480 } else {
2481 ui::Range replacement_range(replacementRange);
2481 renderWidgetHostView_->render_widget_host_->ImeConfirmComposition( 2482 renderWidgetHostView_->render_widget_host_->ImeConfirmComposition(
2482 base::SysNSStringToUTF16(im_text)); 2483 base::SysNSStringToUTF16(im_text), replacement_range);
2483 } 2484 }
2484 2485
2485 // Inserting text will delete all marked text automatically. 2486 // Inserting text will delete all marked text automatically.
2486 hasMarkedText_ = NO; 2487 hasMarkedText_ = NO;
2487 } 2488 }
2488 2489
2489 - (void)insertText:(id)string { 2490 - (void)insertText:(id)string {
2490 // This is a method on NSTextInput, not NSTextInputClient. But on 10.5, this 2491 // This is a method on NSTextInput, not NSTextInputClient. But on 10.5, this
2491 // gets called anyway. Forward to the right method. http://crbug.com/47890 2492 // gets called anyway. Forward to the right method. http://crbug.com/47890
2492 [self insertText:string replacementRange:NSMakeRange(0, 0)]; 2493 [self insertText:string replacementRange:NSMakeRange(0, 0)];
Avi (use Gerrit) 2011/10/11 23:58:36 Does an NSRange of (0,0) convert to an invalid ran
Avi (use Gerrit) 2011/10/12 00:06:01 According to ui::Range, this should be NSMakeRange
Nico 2011/10/12 00:10:36 Great catch, thanks! Done.
2493 } 2494 }
2494 2495
2495 - (void)viewDidMoveToWindow { 2496 - (void)viewDidMoveToWindow {
2496 if (canBeKeyView_) { 2497 if (canBeKeyView_) {
2497 NSWindow* newWindow = [self window]; 2498 NSWindow* newWindow = [self window];
2498 // Pointer comparison only, since we don't know if lastWindow_ is still 2499 // Pointer comparison only, since we don't know if lastWindow_ is still
2499 // valid. 2500 // valid.
2500 if (newWindow) { 2501 if (newWindow) {
2501 // If we move into a new window, refresh the frame information. We 2502 // If we move into a new window, refresh the frame information. We
2502 // don't need to do it if it was the same window as it used to be in, 2503 // don't need to do it if it was the same window as it used to be in,
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
2709 if (!string) return NO; 2710 if (!string) return NO;
2710 2711
2711 // If the user is currently using an IME, confirm the IME input, 2712 // If the user is currently using an IME, confirm the IME input,
2712 // and then insert the text from the service, the same as TextEdit and Safari. 2713 // and then insert the text from the service, the same as TextEdit and Safari.
2713 [self confirmComposition]; 2714 [self confirmComposition];
2714 [self insertText:string]; 2715 [self insertText:string];
2715 return YES; 2716 return YES;
2716 } 2717 }
2717 2718
2718 @end 2719 @end
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_widget_host.cc ('k') | content/common/view_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698