From 58fa398caf8b71a608490fee0457cf0d229c7e0d Mon Sep 17 00:00:00 2001 From: "estade@chromium.org" Date: Thu, 6 Aug 2009 23:52:25 +0000 Subject: GTK: Change the way to calculate the position of the tab title text. On my machine this doesn't actually change the position, but at least it gets rid of the magic -1. BUG=18555 Review URL: http://codereview.chromium.org/165024 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@22696 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/browser/gtk/tabs/tab_renderer_gtk.cc | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'chrome/browser') diff --git a/chrome/browser/gtk/tabs/tab_renderer_gtk.cc b/chrome/browser/gtk/tabs/tab_renderer_gtk.cc index d9e96a5..f0c228f 100644 --- a/chrome/browser/gtk/tabs/tab_renderer_gtk.cc +++ b/chrome/browser/gtk/tabs/tab_renderer_gtk.cc @@ -544,10 +544,14 @@ void TabRendererGtk::Layout() { if (!is_pinned() || width() >= kPinnedTabRendererAsTabWidth) { // Size the Title text to fill the remaining space. int title_left = favicon_bounds_.right() + kFavIconTitleSpacing; - // Center the text in the content area. We need to shift the text up by a - // pixel to match Windows. TODO(estade): Figure out why we need to shift - // the text up by a pixel. http://crbug.com/18555 - int title_top = kTopPadding + (content_height - title_font_height_) / 2 - 1; + // Center of the text in the content area. + int center_of_text = kTopPadding + (content_height / 2); + // Distance between the top of the text and the middle of the text. + // (This should actually be fTop - fAscent / 2, but we can't access fTop + // here so this is as close as we can get.) + int title_offset = title_font_height_ - title_font_->baseline() / 2; + // Top of the text. + int title_top = center_of_text - title_offset; // If the user has big fonts, the title will appear rendered too far down // on the y-axis if we use the regular top padding, so we need to adjust it -- cgit v1.1