summaryrefslogtreecommitdiffstats
path: root/chrome/browser/gtk
diff options
context:
space:
mode:
authorestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-24 20:27:47 +0000
committerestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-24 20:27:47 +0000
commit05c6bcf466f08a0bea39fea32bbe9b741ec8d4c5 (patch)
tree8a43d6c09bff22dfb3bbe8253b7d1677f349f7b6 /chrome/browser/gtk
parentf6d1d6ebe485a9e4523d652eaee2f14178211ddd (diff)
downloadchromium_src-05c6bcf466f08a0bea39fea32bbe9b741ec8d4c5.zip
chromium_src-05c6bcf466f08a0bea39fea32bbe9b741ec8d4c5.tar.gz
chromium_src-05c6bcf466f08a0bea39fea32bbe9b741ec8d4c5.tar.bz2
Avoid setting a widget's allocation outside of a widget implementation.
GtkFixeds do allocate their children. They give them an allocation that matches their size request. Hence when you directly allocate the child, it gets two allocates right in a row (one from you, one from the fixed). This was causing flicker in slide animator gtk (most noticeable when opening a new browser window and seeing the restore infobar, but also confirmed with debugging statements). The original reason for needing to use size_allocate() instead of set_size_request() (which had to do with browser window resizing) is now obsolete, so revert these back to size_request()s. BUG=none TEST=less flicker when an infobar is opening; border at bottom of toolbar/bookmark bar still looks the same Review URL: http://codereview.chromium.org/147100 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@19164 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/gtk')
-rw-r--r--chrome/browser/gtk/find_bar_gtk.cc8
-rw-r--r--chrome/browser/gtk/slide_animator_gtk.cc10
2 files changed, 5 insertions, 13 deletions
diff --git a/chrome/browser/gtk/find_bar_gtk.cc b/chrome/browser/gtk/find_bar_gtk.cc
index 9c784d3..e8e70d3 100644
--- a/chrome/browser/gtk/find_bar_gtk.cc
+++ b/chrome/browser/gtk/find_bar_gtk.cc
@@ -476,12 +476,8 @@ void FindBarGtk::OnFixedSizeAllocate(GtkWidget* fixed,
GtkAllocation* allocation,
FindBarGtk* findbar) {
// Set the background widget to the size of |fixed|.
- if (findbar->border_->allocation.width != allocation->width) {
- // Typically it's not a good idea to use this function outside of container
- // implementations, but GtkFixed doesn't do any sizing on its children so
- // in this case it's safe.
- gtk_widget_size_allocate(findbar->border_, allocation);
- }
+ gtk_widget_set_size_request(findbar->border_,
+ allocation->width, allocation->height);
// Reposition the dialog.
GtkWidget* dialog = findbar->slide_widget();
diff --git a/chrome/browser/gtk/slide_animator_gtk.cc b/chrome/browser/gtk/slide_animator_gtk.cc
index cea09b6..d978316 100644
--- a/chrome/browser/gtk/slide_animator_gtk.cc
+++ b/chrome/browser/gtk/slide_animator_gtk.cc
@@ -13,13 +13,9 @@ namespace {
void OnFixedSizeAllocate(GtkWidget* fixed,
GtkAllocation* allocation,
GtkWidget* child) {
- if (allocation->width != child->allocation.width) {
- // The size of the GtkFixed has changed. We want |child_| to match widths,
- // but the height should not change.
- GtkAllocation new_allocation = child->allocation;
- new_allocation.width = allocation->width;
- gtk_widget_size_allocate(child, &new_allocation);
- }
+ // The size of the GtkFixed has changed. We want |child_| to match widths,
+ // but the height should not change.
+ gtk_widget_set_size_request(child, allocation->width, -1);
}
} // namespace