| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/gtk/find_bar_gtk.h" | 5 #include "chrome/browser/gtk/find_bar_gtk.h" |
| 6 | 6 |
| 7 #include <gdk/gdkkeysyms.h> | 7 #include <gdk/gdkkeysyms.h> |
| 8 | 8 |
| 9 #include "base/gfx/gtk_util.h" | 9 #include "base/gfx/gtk_util.h" |
| 10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 NOTREACHED(); | 235 NOTREACHED(); |
| 236 } | 236 } |
| 237 } | 237 } |
| 238 | 238 |
| 239 // static | 239 // static |
| 240 void FindBarGtk::OnSizeAllocate(GtkWidget* fixed, | 240 void FindBarGtk::OnSizeAllocate(GtkWidget* fixed, |
| 241 GtkAllocation* allocation, | 241 GtkAllocation* allocation, |
| 242 FindBarGtk* findbar) { | 242 FindBarGtk* findbar) { |
| 243 // Set the background widget to the size of |fixed|. | 243 // Set the background widget to the size of |fixed|. |
| 244 if (findbar->border_->allocation.width != allocation->width) { | 244 if (findbar->border_->allocation.width != allocation->width) { |
| 245 gtk_widget_set_size_request(findbar->border_, allocation->width, 1); | 245 // Typically it's not a good idea to use this function outside of container |
| 246 // implementations, but GtkFixed doesn't do any sizing on its children so |
| 247 // in this case it's safe. |
| 248 gtk_widget_size_allocate(findbar->border_, allocation); |
| 246 } | 249 } |
| 247 | 250 |
| 248 // Reposition |container_|. | 251 // Reposition |container_|. |
| 249 GtkWidget* container = findbar->container_; | 252 GtkWidget* container = findbar->container_; |
| 250 DCHECK(container); | 253 DCHECK(container); |
| 251 if (!GTK_WIDGET_VISIBLE(container)) | 254 if (!GTK_WIDGET_VISIBLE(container)) |
| 252 return; | 255 return; |
| 253 | 256 |
| 254 int xposition = findbar->GetDialogPosition(gfx::Rect()).x(); | 257 int xposition = findbar->GetDialogPosition(gfx::Rect()).x(); |
| 255 if (xposition == container->allocation.x) { | 258 if (xposition == container->allocation.x) { |
| 256 return; | 259 return; |
| 257 } else { | 260 } else { |
| 258 gtk_fixed_move(GTK_FIXED(fixed), container, xposition, kVerticalOffset); | 261 gtk_fixed_move(GTK_FIXED(fixed), container, xposition, kVerticalOffset); |
| 259 } | 262 } |
| 260 } | 263 } |
| OLD | NEW |