summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorshess@chromium.org <shess@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-05-04 23:23:35 +0000
committershess@chromium.org <shess@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-05-04 23:23:35 +0000
commit274a2a86145f82814f0a0652a2c255469e256d06 (patch)
tree97c4c10ff1bc64b8f0b719334fea99e36607b380
parente460f3436a92c27af1f45449993c8c5a31b0b2ff (diff)
downloadchromium_src-274a2a86145f82814f0a0652a2c255469e256d06.zip
chromium_src-274a2a86145f82814f0a0652a2c255469e256d06.tar.gz
chromium_src-274a2a86145f82814f0a0652a2c255469e256d06.tar.bz2
[Mac] Always reset attributes as Omnibox changes.
r45524 regressed things so that color and other attributes could "leak" through as the omnibox text was changed to values which where those attributes were no longer appropriate. For instance strike-through or https coloring. This resets the text attributes for the in-focus case. BUG=43149 TEST=See bug report. Review URL: http://codereview.chromium.org/1938004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@46404 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/autocomplete/autocomplete_edit_view_mac.mm6
1 files changed, 6 insertions, 0 deletions
diff --git a/chrome/browser/autocomplete/autocomplete_edit_view_mac.mm b/chrome/browser/autocomplete/autocomplete_edit_view_mac.mm
index e13f11c..e0362a9 100644
--- a/chrome/browser/autocomplete/autocomplete_edit_view_mac.mm
+++ b/chrome/browser/autocomplete/autocomplete_edit_view_mac.mm
@@ -471,7 +471,13 @@ void AutocompleteEditViewMac::EmphasizeURLComponents() {
if (editor) {
NSTextStorage* storage = [editor textStorage];
[storage beginEditing];
+
+ // Clear the existing attributes from the text storage, then
+ // overlay the appropriate Omnibox attributes.
+ [storage setAttributes:[NSDictionary dictionary]
+ range:NSMakeRange(0, [storage length])];
ApplyTextAttributes(GetText(), storage);
+
[storage endEditing];
} else {
SetText(GetText());