diff options
Diffstat (limited to 'chrome/browser')
-rw-r--r-- | chrome/browser/gtk/tabs/tab_gtk.cc | 8 | ||||
-rw-r--r-- | chrome/browser/gtk/tabs/tab_renderer_gtk.h | 2 |
2 files changed, 6 insertions, 4 deletions
diff --git a/chrome/browser/gtk/tabs/tab_gtk.cc b/chrome/browser/gtk/tabs/tab_gtk.cc index 547c655..ee7789a 100644 --- a/chrome/browser/gtk/tabs/tab_gtk.cc +++ b/chrome/browser/gtk/tabs/tab_gtk.cc @@ -24,10 +24,10 @@ void SetEmptyDragIcon(GtkWidget* widget) { } // Returns the width of the title for the current font, in pixels. -int GetTitleWidth(std::wstring title) { +int GetTitleWidth(gfx::Font* font, std::wstring title) { + DCHECK(font); if (!title.empty()) { - gfx::Font font; - return font.GetStringWidth(title); + return font->GetStringWidth(title); } return 0; } @@ -290,7 +290,7 @@ void TabGtk::UpdateData(TabContents* contents, bool loading_only) { TabRendererGtk::UpdateData(contents, loading_only); // Cache the title width so we don't recalculate it every time the tab is // resized. - title_width_ = GetTitleWidth(GetTitle()); + title_width_ = GetTitleWidth(title_font(), GetTitle()); UpdateTooltipState(); } diff --git a/chrome/browser/gtk/tabs/tab_renderer_gtk.h b/chrome/browser/gtk/tabs/tab_renderer_gtk.h index b996f5d..7029f7e 100644 --- a/chrome/browser/gtk/tabs/tab_renderer_gtk.h +++ b/chrome/browser/gtk/tabs/tab_renderer_gtk.h @@ -157,6 +157,8 @@ class TabRendererGtk : public AnimationDelegate { static void SetSelectedTitleColor(SkColor color); static void SetUnselectedTitleColor(SkColor color); + static gfx::Font* title_font() { return title_font_; } + // Returns the bounds of the Tab. int x() const { return bounds_.x(); } int y() const { return bounds_.y(); } |