diff options
-rwxr-xr-x[-rw-r--r--] | app/gfx/canvas_linux.cc | 10 | ||||
-rwxr-xr-x[-rw-r--r--] | app/gfx/font_skia.cc | 1 | ||||
-rwxr-xr-x[-rw-r--r--] | chrome/browser/chromeos/status_area_view.cc | 6 | ||||
-rwxr-xr-x[-rw-r--r--] | chrome/browser/views/about_chrome_view.cc | 9 | ||||
-rwxr-xr-x[-rw-r--r--] | views/controls/label.cc | 7 |
5 files changed, 15 insertions, 18 deletions
diff --git a/app/gfx/canvas_linux.cc b/app/gfx/canvas_linux.cc index b08b4ce..e658c6a 100644..100755 --- a/app/gfx/canvas_linux.cc +++ b/app/gfx/canvas_linux.cc @@ -154,11 +154,7 @@ void Canvas::SizeStringInt(const std::wstring& text, std::string utf8 = WideToUTF8(text); pango_layout_set_text(layout, utf8.data(), utf8.size()); - int chars_height; - pango_layout_get_size(layout, width, &chars_height); - *width /= PANGO_SCALE; - // Pango returns the height of the characters, not the height of the font. - *height = font.height(); + pango_layout_get_pixel_size(layout, width, height); g_object_unref(layout); cairo_destroy(cr); @@ -187,9 +183,7 @@ void Canvas::DrawStringInt(const std::wstring& text, pango_layout_set_text(layout, utf8.data(), utf8.size()); int width, height; - pango_layout_get_size(layout, &width, &height); - width /= PANGO_SCALE; - height /= PANGO_SCALE; + pango_layout_get_pixel_size(layout, &width, &height); if (flags & Canvas::TEXT_VALIGN_TOP) { // Cairo should draw from the top left corner already. diff --git a/app/gfx/font_skia.cc b/app/gfx/font_skia.cc index 37cbe8d..8f6ccc1 100644..100755 --- a/app/gfx/font_skia.cc +++ b/app/gfx/font_skia.cc @@ -187,7 +187,6 @@ double Font::avg_width() { int text_width = GetStringWidth( L"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"); double dialog_units = (text_width / 26 + 1) / 2; - avg_width_ = std::min(pango_width, dialog_units); pango_font_metrics_unref(pango_metrics); pango_font_description_free(pango_desc); diff --git a/chrome/browser/chromeos/status_area_view.cc b/chrome/browser/chromeos/status_area_view.cc index 59f4f9c..5b268dd 100644..100755 --- a/chrome/browser/chromeos/status_area_view.cc +++ b/chrome/browser/chromeos/status_area_view.cc @@ -33,8 +33,6 @@ namespace { const int kLeftBorder = 1; // Number of pixels to separate the clock from the next item on the right. const int kClockSeparation = 4; -// Number of pixels to adjust the y value of the clock. -const int kClockYAdjustment = 2; // BrowserWindowGtk tiles its image with this offset const int kCustomFrameBackgroundVerticalOffset = 15; @@ -173,10 +171,6 @@ void StatusAreaView::Layout() { // Handle odd number of pixels. cur_y += (height() - cur_size.height()) % 2; - // Adjustment to make clock line up right. - if (cur == clock_view_) - cur_y += kClockYAdjustment; - // Put next in row horizontally, and center vertically. cur->SetBounds(cur_x, cur_y, cur_size.width(), cur_size.height()); diff --git a/chrome/browser/views/about_chrome_view.cc b/chrome/browser/views/about_chrome_view.cc index 63fabce..c4b2fdd 100644..100755 --- a/chrome/browser/views/about_chrome_view.cc +++ b/chrome/browser/views/about_chrome_view.cc @@ -486,8 +486,13 @@ void AboutChromeView::DrawTextAndPositionUrl(gfx::Canvas* canvas, gfx::Size sz = link->GetPreferredSize(); gfx::Insets insets = link->GetInsets(); WrapIfWordDoesntFit(sz.width(), font.height(), position, bounds); - *rect = gfx::Rect(position->width(), position->height() - insets.top(), - sz.width(), sz.height()); + int x = position->width(); + int y = position->height(); + + // Links have a border to allow them to be focused. + y -= insets.top(); + + *rect = gfx::Rect(x, y, sz.width(), sz.height()); // Go from relative pixel coordinates (within the label we are drawing on) // to absolute pixel coordinates (relative to the top left corner of the diff --git a/views/controls/label.cc b/views/controls/label.cc index 6da6c48..6b17338 100644..100755 --- a/views/controls/label.cc +++ b/views/controls/label.cc @@ -264,7 +264,12 @@ const GURL Label::GetURL() const { gfx::Size Label::GetTextSize() { if (!text_size_valid_) { - text_size_.SetSize(font_.GetStringWidth(text_), font_.height()); + int w = 0, h = 0; + gfx::Canvas cc(0, 0, true); + int flags = is_multi_line_ ? ComputeMultiLineFlags() : 0; + + cc.SizeStringInt(text_, font_, &w, &h, flags); + text_size_.SetSize(w, h); if (highlighted_) text_size_.Enlarge(1, 1); text_size_valid_ = true; |