diff options
Diffstat (limited to 'chrome/common/gfx')
-rw-r--r-- | chrome/common/gfx/chrome_font.h | 2 | ||||
-rw-r--r-- | chrome/common/gfx/chrome_font_mac.mm | 10 | ||||
-rw-r--r-- | chrome/common/gfx/text_elider.cc | 4 |
3 files changed, 8 insertions, 8 deletions
diff --git a/chrome/common/gfx/chrome_font.h b/chrome/common/gfx/chrome_font.h index 8ac225c..7c25a9b 100644 --- a/chrome/common/gfx/chrome_font.h +++ b/chrome/common/gfx/chrome_font.h @@ -215,7 +215,7 @@ class ChromeFont { int avg_width_; #elif defined(OS_MACOSX) explicit ChromeFont(const std::wstring& font_name, int font_size, int style); - + // Calculate and cache the font metrics. void calculateMetrics(); diff --git a/chrome/common/gfx/chrome_font_mac.mm b/chrome/common/gfx/chrome_font_mac.mm index a553be6..590c54e 100644 --- a/chrome/common/gfx/chrome_font_mac.mm +++ b/chrome/common/gfx/chrome_font_mac.mm @@ -9,8 +9,8 @@ #include "base/logging.h" #include "base/sys_string_conversions.h" -// static -ChromeFont ChromeFont::CreateFont(const std::wstring& font_name, +// static +ChromeFont ChromeFont::CreateFont(const std::wstring& font_name, int font_size) { return ChromeFont(font_name, font_size, NORMAL); } @@ -22,7 +22,7 @@ ChromeFont::ChromeFont(const std::wstring& font_name, int font_size, int style) calculateMetrics(); } -ChromeFont::ChromeFont() +ChromeFont::ChromeFont() : font_size_([NSFont systemFontSize]), style_(NORMAL) { NSFont* system_font = [NSFont systemFontOfSize:font_size_]; @@ -56,7 +56,7 @@ int ChromeFont::ave_char_width() const { int ChromeFont::GetStringWidth(const std::wstring& text) const { NSFont* font = nativeFont(); NSString* ns_string = base::SysWideToNSString(text); - NSDictionary* attributes = + NSDictionary* attributes = [NSDictionary dictionaryWithObject:font forKey:NSFontAttributeName]; NSSize string_size = [ns_string sizeWithAttributes:attributes]; return string_size.width; @@ -82,6 +82,6 @@ NativeFont ChromeFont::nativeFont() const { // TODO(pinkerton): apply |style_| to font. // We could cache this, but then we'd have to conditionally change the // dtor just for MacOS. Not sure if we want to/need to do that. - return [NSFont fontWithName:base::SysWideToNSString(font_name_) + return [NSFont fontWithName:base::SysWideToNSString(font_name_) size:font_size_]; } diff --git a/chrome/common/gfx/text_elider.cc b/chrome/common/gfx/text_elider.cc index f7405a2..f4a6d4e 100644 --- a/chrome/common/gfx/text_elider.cc +++ b/chrome/common/gfx/text_elider.cc @@ -168,9 +168,9 @@ std::wstring ElideUrl(const GURL& url, } const int kMaxNumberOfUrlPathElementsAllowed = 1024; - if (url_path_number_of_elements <= 1 || + if (url_path_number_of_elements <= 1 || url_path_number_of_elements > kMaxNumberOfUrlPathElementsAllowed) { - // No path to elide, or too long of a path (could overflow in loop below) + // No path to elide, or too long of a path (could overflow in loop below) // Just elide this as a text string. return ElideText(url_subdomain + url_domain + url_path_query_etc, font, available_pixel_width); |