From 7e9e8584da57a63465cd9619fb023a427e8d6bfe Mon Sep 17 00:00:00 2001 From: "derat@chromium.org" Date: Fri, 9 Oct 2009 01:02:48 +0000 Subject: Linux: Prevent first-run bubble from getting clipped on high-DPI displays. Avoids setting the width of the contents vbox (so it can grow if the combined width of the two buttons exceeds the estimated width of the bubble's text) and fixes an issue where we were getting even-more-bogus estimates due to using an unrealized widget. Also adds a DCHECK() to catch future code that passes unrealized widgets to gtk_util::GetWidgetSizeFromResources() (I checked the existing calls to it and they all look fine). BUG=23367 TEST=tested first-run bubble on displays with various DPIs (75, 120, 200, etc.) Review URL: http://codereview.chromium.org/265023 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@28500 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/common/gtk_util.cc | 2 ++ 1 file changed, 2 insertions(+) (limited to 'chrome/common/gtk_util.cc') diff --git a/chrome/common/gtk_util.cc b/chrome/common/gtk_util.cc index e88ceb7..2c42f7d 100644 --- a/chrome/common/gtk_util.cc +++ b/chrome/common/gtk_util.cc @@ -159,6 +159,8 @@ GtkWidget* CreateGtkBorderBin(GtkWidget* child, const GdkColor* color, void GetWidgetSizeFromResources(GtkWidget* widget, int width_chars, int height_lines, int* width, int* height) { + DCHECK(GTK_WIDGET_REALIZED(widget)) + << " widget must be realized to compute font metrics correctly"; PangoContext* context = gtk_widget_create_pango_context(widget); PangoFontMetrics* metrics = pango_context_get_metrics(context, widget->style->font_desc, pango_context_get_language(context)); -- cgit v1.1