From 5a9280908ae2e9a3abb5d0c1888dc96f828c1bf3 Mon Sep 17 00:00:00 2001 From: "estade@chromium.org" Date: Thu, 30 Jul 2009 23:01:44 +0000 Subject: GTK find bar positioning: Don't try to make a negative-width rectangle. BUG=none TEST=make your browser very narrow in debug mode, it doesn't crash Review URL: http://codereview.chromium.org/159665 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@22117 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/browser/gtk/find_bar_gtk.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/chrome/browser/gtk/find_bar_gtk.cc b/chrome/browser/gtk/find_bar_gtk.cc index 5f17d0c..ab068c5 100644 --- a/chrome/browser/gtk/find_bar_gtk.cc +++ b/chrome/browser/gtk/find_bar_gtk.cc @@ -345,9 +345,11 @@ gfx::Rect FindBarGtk::GetDialogPosition(gfx::Rect avoid_overlapping_rect) { bool ltr = l10n_util::GetTextDirection() == l10n_util::LEFT_TO_RIGHT; // 15 is the size of the scrollbar, copied from ScrollbarThemeChromium. // The height is not used. + // At very low browser widths we can wind up with a negative |dialog_bounds| + // width, so clamp it to 0. gfx::Rect dialog_bounds = gfx::Rect(ltr ? 0 : 15, 0, - widget()->allocation.width - - (ltr ? 15 : 0), + std::max(0, widget()->allocation.width - + (ltr ? 15 : 0)), 0); GtkRequisition req; -- cgit v1.1