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

Unified Diff: chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.mm

Issue 184783007: [rAC, OSX] Fix Omnibox font issue (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: If at first you don't succeed Created 6 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.mm
diff --git a/chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.mm b/chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.mm
index 1777998887526adcc8cceccf1b949b828f4d40ce..9b53c5565bf1989d95485928c2d5aa04410e2ea6 100644
--- a/chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.mm
+++ b/chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.mm
@@ -401,6 +401,13 @@ void OmniboxViewMac::SetTextAndSelectedRange(const base::string16& display_text,
}
void OmniboxViewMac::EmphasizeURLComponents() {
+ // Obtain the text before any editing - GetText will update the field's value
+ // from textStorage, and if EmphasizeURLComponents is called from within the
+ // editor's -resignFirstResponder, |field_| will have a text value that is
+ // stripped of all attributes. (Since the editor is about to die and has
+ // already synced the field to its value).
+ base::string16 text = GetText();
Scott Hess - ex-Googler 2014/03/06 02:42:24 I cannot understand how the comment applies at all
groby-ooo-7-16 2014/03/06 04:07:51 Unfortunately, it still is the firstResponder, exc
Scott Hess - ex-Googler 2014/03/06 06:30:32 Still nack. base::string16 cannot have Cocoa attr
groby-ooo-7-16 2014/03/06 19:07:58 It doesn't. It's a side effect. Sequence of events
Scott Hess - ex-Googler 2014/03/06 19:28:12 This implies that calling [field_ stringValue] aft
Scott Hess - ex-Googler 2014/03/06 20:54:28 OK, I'm reading old CLs trying to wrap my head aro
groby-ooo-7-16 2014/03/07 01:47:08 Based on my reading of old CL's, we cannot call se
+
NSTextView* editor = (NSTextView*)[field_ currentEditor];
// If the autocomplete text field is in editing mode, then we can just change
// its attributes through its editor. Otherwise, we simply reset its content.
@@ -412,11 +419,11 @@ void OmniboxViewMac::EmphasizeURLComponents() {
// overlay the appropriate Omnibox attributes.
[storage setAttributes:[NSDictionary dictionary]
range:NSMakeRange(0, [storage length])];
- ApplyTextAttributes(GetText(), storage);
+ ApplyTextAttributes(text, storage);
[storage endEditing];
} else {
- SetText(GetText());
+ SetText(text);
}
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698