summaryrefslogtreecommitdiffstats
path: root/chrome/browser/gtk
diff options
context:
space:
mode:
authorestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-21 01:57:58 +0000
committerestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-21 01:57:58 +0000
commit9293f24476481c51ea0d4804a8c8db7888f02d93 (patch)
treea307b5eb209a13e200f6d2a4d8b6d793c50647cc /chrome/browser/gtk
parent7753518221d970398c094e977ba2e266c25284f7 (diff)
downloadchromium_src-9293f24476481c51ea0d4804a8c8db7888f02d93.zip
chromium_src-9293f24476481c51ea0d4804a8c8db7888f02d93.tar.gz
chromium_src-9293f24476481c51ea0d4804a8c8db7888f02d93.tar.bz2
Don't get stuck in an allocate loop on closing the download shelf.
Review URL: http://codereview.chromium.org/113674 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@16565 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/gtk')
-rw-r--r--chrome/browser/gtk/status_bubble_gtk.cc13
-rw-r--r--chrome/browser/gtk/tab_contents_container_gtk.cc11
2 files changed, 16 insertions, 8 deletions
diff --git a/chrome/browser/gtk/status_bubble_gtk.cc b/chrome/browser/gtk/status_bubble_gtk.cc
index 1034bf9..83f2aae 100644
--- a/chrome/browser/gtk/status_bubble_gtk.cc
+++ b/chrome/browser/gtk/status_bubble_gtk.cc
@@ -93,10 +93,15 @@ void StatusBubbleGtk::SetStatusBubbleSize() {
0);
widget_allocation.x = 0;
widget_allocation.y = child_y;
- widget_allocation.width = std::min(requisition.width,
- parent_allocation_.width);
- widget_allocation.height = requisition.height;
- gtk_widget_size_allocate(container_.get(), &widget_allocation);
+ widget_allocation.width = std::max(1, std::min(requisition.width,
+ parent_allocation_.width));
+ widget_allocation.height = std::max(1, requisition.height);
+
+ if (memcmp(&widget_allocation, &container_.get()->allocation,
+ sizeof widget_allocation) != 0) {
+ // Only do something when we are actually changing sizes.
+ gtk_widget_size_allocate(container_.get(), &widget_allocation);
+ }
}
}
diff --git a/chrome/browser/gtk/tab_contents_container_gtk.cc b/chrome/browser/gtk/tab_contents_container_gtk.cc
index 02f635f..b05070b 100644
--- a/chrome/browser/gtk/tab_contents_container_gtk.cc
+++ b/chrome/browser/gtk/tab_contents_container_gtk.cc
@@ -14,11 +14,15 @@ namespace {
// Allocates all normal tab contents views to the size of the passed in
// |allocation|. Ignores StatusBubbles, which are handled separately.
-void ChildrenSizeAllocate(GtkWidget* widget, void* param) {
+void ResizeChildren(GtkWidget* widget, void* param) {
GtkAllocation* allocation = reinterpret_cast<GtkAllocation*>(param);
if (strcmp(gtk_widget_get_name(widget), "status-bubble") != 0) {
- gtk_widget_size_allocate(widget, allocation);
+ if (widget->allocation.width != allocation->width ||
+ widget->allocation.height != allocation->height) {
+ gtk_widget_set_size_request(widget, allocation->width,
+ allocation->height);
+ }
}
}
@@ -158,8 +162,7 @@ void TabContentsContainerGtk::OnFixedSizeAllocate(
GtkAllocation* allocation,
TabContentsContainerGtk* container) {
// Set all the tab contents GtkWidgets to the size of the allocation.
- gtk_container_foreach(GTK_CONTAINER(fixed), ChildrenSizeAllocate,
- allocation);
+ gtk_container_foreach(GTK_CONTAINER(fixed), ResizeChildren, allocation);
// Tell the status bubble about how large it can be.
container->status_bubble_->SetParentAllocation(fixed, allocation);