summaryrefslogtreecommitdiffstats
path: root/chrome/browser/cocoa/autocomplete_text_field.mm
diff options
context:
space:
mode:
authorsuzhe@chromium.org <suzhe@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-24 02:05:59 +0000
committersuzhe@chromium.org <suzhe@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-24 02:05:59 +0000
commit0a49b0f7dba1433a73e1c98e029b0d6561ce1fb8 (patch)
tree9d540d782b880bc45c56f4524ddcb9f9c19a95a5 /chrome/browser/cocoa/autocomplete_text_field.mm
parent5c7e12555109c97ad0a2fc123898824ce8ecab9c (diff)
downloadchromium_src-0a49b0f7dba1433a73e1c98e029b0d6561ce1fb8.zip
chromium_src-0a49b0f7dba1433a73e1c98e029b0d6561ce1fb8.tar.gz
chromium_src-0a49b0f7dba1433a73e1c98e029b0d6561ce1fb8.tar.bz2
[Mac] Fix issue 19421: IMEs do not work well in the omnibox due to a race condition
This CL makes following major changes: 1. Exclude marked text from GetText()'s result. 2. When the text field is in editing mode, EmphasizeURLComponents() changes its attributes through its editor rather than reseting its content. 3. When the text field is in editing mode, SetText() sets its content through its editor. BUG=19421 TEST=See bug report. Review URL: http://codereview.chromium.org/1549033 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@45524 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/cocoa/autocomplete_text_field.mm')
-rw-r--r--chrome/browser/cocoa/autocomplete_text_field.mm22
1 files changed, 8 insertions, 14 deletions
diff --git a/chrome/browser/cocoa/autocomplete_text_field.mm b/chrome/browser/cocoa/autocomplete_text_field.mm
index a07cac1..a4242bb 100644
--- a/chrome/browser/cocoa/autocomplete_text_field.mm
+++ b/chrome/browser/cocoa/autocomplete_text_field.mm
@@ -6,6 +6,7 @@
#include "base/logging.h"
#import "chrome/browser/cocoa/autocomplete_text_field_cell.h"
+#import "chrome/browser/cocoa/autocomplete_text_field_editor.h"
#import "chrome/browser/cocoa/browser_window_controller.h"
#import "chrome/browser/cocoa/toolbar_controller.h"
#import "chrome/browser/cocoa/url_drop_target.h"
@@ -169,17 +170,17 @@
}
- (void)setAttributedStringValue:(NSAttributedString*)aString {
- NSTextView* editor = static_cast<NSTextView*>([self currentEditor]);
+ AutocompleteTextFieldEditor* editor =
+ static_cast<AutocompleteTextFieldEditor*>([self currentEditor]);
+
if (!editor) {
[super setAttributedStringValue:aString];
} else {
- // -currentEditor is defined to return NSText*, make sure our
- // assumptions still hold, here.
- DCHECK([editor isKindOfClass:[NSTextView class]]);
+ // The type of the field editor must be AutocompleteTextFieldEditor,
+ // otherwise things won't work.
+ DCHECK([editor isKindOfClass:[AutocompleteTextFieldEditor class]]);
- NSTextStorage* textStorage = [editor textStorage];
- DCHECK(textStorage);
- [textStorage setAttributedString:aString];
+ [editor setAttributedString:aString];
}
}
@@ -253,13 +254,6 @@
}
}
-- (void)textDidChange:(NSNotification *)aNotification {
- [super textDidChange:aNotification];
- if (observer_) {
- observer_->OnDidChange();
- }
-}
-
- (void)textDidEndEditing:(NSNotification *)aNotification {
[super textDidEndEditing:aNotification];
if (observer_) {