diff options
author | shess@chromium.org <shess@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-26 19:13:08 +0000 |
---|---|---|
committer | shess@chromium.org <shess@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-26 19:13:08 +0000 |
commit | d665d12de993bc2eb904cfa9607661ffc6f553b9 (patch) | |
tree | 35d625564c0ac77b9e1a79dc098c677a02ac21ca /chrome/browser/cocoa/autocomplete_text_field.mm | |
parent | 64c67f0fdbca63433f52127b3725bcd2c3417b36 (diff) | |
download | chromium_src-d665d12de993bc2eb904cfa9607661ffc6f553b9.zip chromium_src-d665d12de993bc2eb904cfa9607661ffc6f553b9.tar.gz chromium_src-d665d12de993bc2eb904cfa9607661ffc6f553b9.tar.bz2 |
[Mac] Adjust Omnibox implementation to not break undo chain.
This does not fix undo, it just makes the implementation break it
less.
BUG=18084
TEST=Omnibox should continue to work.
Review URL: http://codereview.chromium.org/337027
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@30071 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/cocoa/autocomplete_text_field.mm')
-rw-r--r-- | chrome/browser/cocoa/autocomplete_text_field.mm | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/chrome/browser/cocoa/autocomplete_text_field.mm b/chrome/browser/cocoa/autocomplete_text_field.mm index 3071519..182a8b3 100644 --- a/chrome/browser/cocoa/autocomplete_text_field.mm +++ b/chrome/browser/cocoa/autocomplete_text_field.mm @@ -193,4 +193,19 @@ return NO; } +- (void)setAttributedStringValue:(NSAttributedString*)aString { + NSTextView* editor = static_cast<NSTextView*>([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]]); + + NSTextStorage* textStorage = [editor textStorage]; + DCHECK(textStorage); + [textStorage setAttributedString:aString]; + } +} + @end |