OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.h" | 5 #include "chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.h" |
6 | 6 |
7 #include <Carbon/Carbon.h> // kVK_Return | 7 #include <Carbon/Carbon.h> // kVK_Return |
8 | 8 |
9 #include "base/mac/foundation_util.h" | 9 #include "base/mac/foundation_util.h" |
10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
(...skipping 1100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1111 // static | 1111 // static |
1112 NSFont* OmniboxViewMac::GetNormalFieldFont() { | 1112 NSFont* OmniboxViewMac::GetNormalFieldFont() { |
1113 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | 1113 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
1114 return rb | 1114 return rb |
1115 .GetFontWithDelta(kOmniboxNormalFontSizeDelta, gfx::Font::NORMAL, | 1115 .GetFontWithDelta(kOmniboxNormalFontSizeDelta, gfx::Font::NORMAL, |
1116 gfx::Font::Weight::NORMAL) | 1116 gfx::Font::Weight::NORMAL) |
1117 .GetNativeFont(); | 1117 .GetNativeFont(); |
1118 } | 1118 } |
1119 | 1119 |
1120 NSFont* OmniboxViewMac::GetBoldFieldFont() { | 1120 NSFont* OmniboxViewMac::GetBoldFieldFont() { |
| 1121 // Request a bold font, then make it larger. ResourceBundle will do the |
| 1122 // opposite which makes a large system normal font a non-system bold font. |
| 1123 // That gives a different baseline to making the non-system bold font larger. |
| 1124 // And while the omnibox locks the baseline in ApplyTextStyle(), |
| 1125 // OmniboxPopupCellData does not. |
1121 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | 1126 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
1122 return rb | 1127 return rb |
1123 .GetFontWithDelta(kOmniboxNormalFontSizeDelta, gfx::Font::NORMAL, | 1128 .GetFontWithDelta(0, gfx::Font::NORMAL, gfx::Font::Weight::BOLD) |
1124 gfx::Font::Weight::BOLD) | 1129 .Derive(kOmniboxNormalFontSizeDelta, gfx::Font::NORMAL, |
| 1130 gfx::Font::Weight::BOLD) |
1125 .GetNativeFont(); | 1131 .GetNativeFont(); |
1126 } | 1132 } |
1127 | 1133 |
1128 NSFont* OmniboxViewMac::GetLargeFont() { | 1134 NSFont* OmniboxViewMac::GetLargeFont() { |
1129 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | 1135 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
1130 return rb | 1136 return rb |
1131 .GetFontWithDelta(kOmniboxLargeFontSizeDelta, gfx::Font::NORMAL, | 1137 .GetFontWithDelta(kOmniboxLargeFontSizeDelta, gfx::Font::NORMAL, |
1132 gfx::Font::Weight::NORMAL) | 1138 gfx::Font::Weight::NORMAL) |
1133 .GetNativeFont(); | 1139 .GetNativeFont(); |
1134 } | 1140 } |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1169 display_text); | 1175 display_text); |
1170 NSDictionary* notification_info = @{ | 1176 NSDictionary* notification_info = @{ |
1171 NSAccessibilityAnnouncementKey : announcement, | 1177 NSAccessibilityAnnouncementKey : announcement, |
1172 NSAccessibilityPriorityKey : @(NSAccessibilityPriorityHigh) | 1178 NSAccessibilityPriorityKey : @(NSAccessibilityPriorityHigh) |
1173 }; | 1179 }; |
1174 NSAccessibilityPostNotificationWithUserInfo( | 1180 NSAccessibilityPostNotificationWithUserInfo( |
1175 [field_ window], | 1181 [field_ window], |
1176 NSAccessibilityAnnouncementRequestedNotification, | 1182 NSAccessibilityAnnouncementRequestedNotification, |
1177 notification_info); | 1183 notification_info); |
1178 } | 1184 } |
OLD | NEW |