summaryrefslogtreecommitdiffstats
path: root/chrome/browser/gtk/find_bar_gtk.cc
diff options
context:
space:
mode:
authorestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-29 23:00:25 +0000
committerestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-29 23:00:25 +0000
commitd46dccd915503b397f775bd5332e27c0b0a8e114 (patch)
tree4c70944cbec6417e4bbd7ca49ea0e191c3f132d2 /chrome/browser/gtk/find_bar_gtk.cc
parent25e08e4911b7f49ad7fbaa7bacbd45d601ad6dee (diff)
downloadchromium_src-d46dccd915503b397f775bd5332e27c0b0a8e114.zip
chromium_src-d46dccd915503b397f775bd5332e27c0b0a8e114.tar.gz
chromium_src-d46dccd915503b397f775bd5332e27c0b0a8e114.tar.bz2
GTK: move the findbar out of the way when it covers a find result.
BUG=15875 Review URL: http://codereview.chromium.org/160350 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@22012 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/gtk/find_bar_gtk.cc')
-rw-r--r--chrome/browser/gtk/find_bar_gtk.cc25
1 files changed, 11 insertions, 14 deletions
diff --git a/chrome/browser/gtk/find_bar_gtk.cc b/chrome/browser/gtk/find_bar_gtk.cc
index 4436455..a0179d0 100644
--- a/chrome/browser/gtk/find_bar_gtk.cc
+++ b/chrome/browser/gtk/find_bar_gtk.cc
@@ -88,7 +88,8 @@ FindBarGtk::FindBarGtk(Browser* browser)
window_(static_cast<BrowserWindowGtk*>(browser->window())),
theme_provider_(GtkThemeProvider::GetFrom(browser->profile())),
container_shaped_(false),
- ignore_changed_signal_(false) {
+ ignore_changed_signal_(false),
+ current_fixed_width_(-1) {
InitWidgets();
dialog_background_.reset(new NineBox(browser->profile()->GetThemeProvider(),
@@ -356,15 +357,10 @@ gfx::Rect FindBarGtk::GetDialogPosition(gfx::Rect avoid_overlapping_rect) {
gfx::Rect view_location(
ltr ? dialog_bounds.width() - prefsize.width() : dialog_bounds.x(),
dialog_bounds.y(), prefsize.width(), prefsize.height());
+ gfx::Rect new_pos = FindBarController::GetLocationForFindbarView(
+ view_location, dialog_bounds, avoid_overlapping_rect);
- if (!avoid_overlapping_rect.IsEmpty()) {
- // TODO(estade): move out of the way if need be.
- }
-
- if (view_location.x() < 0)
- view_location.set_x(0);
-
- return view_location;
+ return new_pos;
}
void FindBarGtk::SetDialogPosition(const gfx::Rect& new_pos, bool no_redraw) {
@@ -512,17 +508,18 @@ void FindBarGtk::OnClicked(GtkWidget* button, FindBarGtk* find_bar) {
void FindBarGtk::OnFixedSizeAllocate(GtkWidget* fixed,
GtkAllocation* allocation,
FindBarGtk* findbar) {
+ // Do nothing if our width hasn't changed.
+ if (findbar->current_fixed_width_ == allocation->width)
+ return;
+ findbar->current_fixed_width_ = allocation->width;
+
// Set the background widget to the size of |fixed|.
gtk_widget_set_size_request(findbar->border_,
allocation->width, allocation->height);
// Reposition the dialog.
- GtkWidget* dialog = findbar->slide_widget();
- if (!GTK_WIDGET_VISIBLE(dialog))
- return;
-
int xposition = findbar->GetDialogPosition(gfx::Rect()).x();
- if (xposition == dialog->allocation.x) {
+ if (xposition == findbar->slide_widget()->allocation.x) {
return;
} else {
gtk_fixed_move(GTK_FIXED(fixed), findbar->slide_widget(), xposition, 0);