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 d08a756a49c74f383743b22209859e8775cd595d..48b7cc905df833ae28fdb1d63bc693a4d7eabc5c 100644 |
--- a/chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.mm |
+++ b/chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.mm |
@@ -241,13 +241,13 @@ void OmniboxViewMac::UpdatePlaceholderText() { |
if (chrome::ShouldDisplayOriginChip() || |
OmniboxFieldTrial::DisplayHintTextWhenPossible()) { |
NSDictionary* placeholder_attributes = @{ |
- NSFontAttributeName : GetFieldFont(gfx::Font::NORMAL), |
NSForegroundColorAttributeName : [NSColor disabledControlTextColor] |
}; |
base::scoped_nsobject<NSMutableAttributedString> placeholder_text( |
[[NSMutableAttributedString alloc] |
initWithString:base::SysUTF16ToNSString(GetHintText()) |
attributes:placeholder_attributes]); |
+ ApplyTextStyle(placeholder_text); |
[[field_ cell] setPlaceholderAttributedString:placeholder_text]; |
} |
} |
@@ -481,18 +481,9 @@ void OmniboxViewMac::EmphasizeURLComponents() { |
} |
} |
-void OmniboxViewMac::ApplyTextAttributes(const base::string16& display_text, |
- NSMutableAttributedString* as) { |
- NSUInteger as_length = [as length]; |
- NSRange as_entire_string = NSMakeRange(0, as_length); |
- |
+void OmniboxViewMac::ApplyTextStyle(NSMutableAttributedString* as) { |
[as addAttribute:NSFontAttributeName value:GetFieldFont(gfx::Font::NORMAL) |
- range:as_entire_string]; |
- |
- // A kinda hacky way to add breaking at periods. This is what Safari does. |
- // This works for IDNs too, despite the "en_US". |
- [as addAttribute:@"NSLanguage" value:@"en_US_POSIX" |
- range:as_entire_string]; |
+ range:NSMakeRange(0, [as length])]; |
// Make a paragraph style locking in the standard line height as the maximum, |
// otherwise the baseline may shift "downwards". |
@@ -503,6 +494,19 @@ void OmniboxViewMac::ApplyTextAttributes(const base::string16& display_text, |
[paragraph_style setMinimumLineHeight:line_height]; |
[paragraph_style setLineBreakMode:NSLineBreakByTruncatingTail]; |
[as addAttribute:NSParagraphStyleAttributeName value:paragraph_style |
+ range:NSMakeRange(0, [as length])]; |
+} |
+ |
+void OmniboxViewMac::ApplyTextAttributes(const base::string16& display_text, |
+ NSMutableAttributedString* as) { |
+ NSUInteger as_length = [as length]; |
+ NSRange as_entire_string = NSMakeRange(0, as_length); |
+ |
+ ApplyTextStyle(as); |
+ |
+ // A kinda hacky way to add breaking at periods. This is what Safari does. |
+ // This works for IDNs too, despite the "en_US". |
+ [as addAttribute:@"NSLanguage" value:@"en_US_POSIX" |
range:as_entire_string]; |
url::Component scheme, host; |