diff options
author | Andre Santoso <andresantoso@chromium.org> | 2015-09-15 10:15:21 -0700 |
---|---|---|
committer | Andre Santoso <andresantoso@chromium.org> | 2015-09-15 17:16:26 +0000 |
commit | c58a65851366bec1941e6179c3580ab36d718e9b (patch) | |
tree | ec52800168cf6d8c57f501f2ab90e43f5b785df6 | |
parent | 1bf646e7f6ccc4a6b71a00636e1c8392223c6210 (diff) | |
download | chromium_src-c58a65851366bec1941e6179c3580ab36d718e9b.zip chromium_src-c58a65851366bec1941e6179c3580ab36d718e9b.tar.gz chromium_src-c58a65851366bec1941e6179c3580ab36d718e9b.tar.bz2 |
Mac: Audit use of -[NSFont fontName] (Merge to M45)
System fonts have special attributes starting with 10.11, they should not be
requested by name.
BUG=503786
TBR=rsesek@chromium.org
Review URL: https://codereview.chromium.org/1235273002
Cr-Commit-Position: refs/heads/master@{#338878}
(cherry picked from commit 3c029bf08ccf51d142c7f3380964ba9176941fc4)
Review URL: https://codereview.chromium.org/1341133004 .
Cr-Commit-Position: refs/branch-heads/2454@{#479}
Cr-Branched-From: 12bfc3360892ec53cd00fc239a47e5298beb063b-refs/heads/master@{#338390}
-rw-r--r-- | chrome/browser/ui/cocoa/content_settings/content_setting_bubble_cocoa.mm | 3 | ||||
-rw-r--r-- | chrome/browser/ui/cocoa/status_bubble_mac.mm | 5 |
2 files changed, 4 insertions, 4 deletions
diff --git a/chrome/browser/ui/cocoa/content_settings/content_setting_bubble_cocoa.mm b/chrome/browser/ui/cocoa/content_settings/content_setting_bubble_cocoa.mm index d9bf7b8..428e51f 100644 --- a/chrome/browser/ui/cocoa/content_settings/content_setting_bubble_cocoa.mm +++ b/chrome/browser/ui/cocoa/content_settings/content_setting_bubble_cocoa.mm @@ -82,8 +82,7 @@ const int kMIDISysExHostPadding = 4; void SetControlSize(NSControl* control, NSControlSize controlSize) { CGFloat fontSize = [NSFont systemFontSizeForControlSize:controlSize]; NSCell* cell = [control cell]; - NSFont* font = [NSFont fontWithName:[[cell font] fontName] size:fontSize]; - [cell setFont:font]; + [cell setFont:[NSFont systemFontOfSize:fontSize]]; [cell setControlSize:controlSize]; } diff --git a/chrome/browser/ui/cocoa/status_bubble_mac.mm b/chrome/browser/ui/cocoa/status_bubble_mac.mm index 3099838..7f7c455 100644 --- a/chrome/browser/ui/cocoa/status_bubble_mac.mm +++ b/chrome/browser/ui/cocoa/status_bubble_mac.mm @@ -25,6 +25,7 @@ #include "ui/base/cocoa/window_size_constants.h" #include "ui/gfx/font_list.h" #include "ui/gfx/geometry/point.h" +#include "ui/gfx/platform_font.h" #include "ui/gfx/text_elider.h" #include "ui/gfx/text_utils.h" @@ -232,7 +233,7 @@ void StatusBubbleMac::SetURL(const GURL& url, const std::string& languages) { text_width = static_cast<int>(scaled_width.width); NSFont* font = [[window_ contentView] font]; gfx::FontList font_list_chr( - gfx::Font(base::SysNSStringToUTF8([font fontName]), [font pointSize])); + gfx::Font(gfx::PlatformFont::CreateFromNativeFont(font))); base::string16 original_url_text = net::FormatUrl(url, languages); base::string16 status = @@ -704,7 +705,7 @@ void StatusBubbleMac::ExpandBubble() { // Generate the URL string that fits in the expanded bubble. NSFont* font = [[window_ contentView] font]; gfx::FontList font_list_chr( - gfx::Font(base::SysNSStringToUTF8([font fontName]), [font pointSize])); + gfx::Font(gfx::PlatformFont::CreateFromNativeFont(font))); base::string16 expanded_url = ElideUrl( url_, font_list_chr, max_bubble_width, languages_); |