summaryrefslogtreecommitdiffstats
path: root/chrome/browser/tab_contents
diff options
context:
space:
mode:
authorerg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-23 23:53:21 +0000
committererg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-23 23:53:21 +0000
commit9fe6464530f957ed38be9edc7a6d0cc47ab5b2df (patch)
tree45e1cfe10eafd6edcee02473d9e950c7a3ada0cc /chrome/browser/tab_contents
parent7cc4ad1d9f0cdae224af53eb29272d1bfca64df3 (diff)
downloadchromium_src-9fe6464530f957ed38be9edc7a6d0cc47ab5b2df.zip
chromium_src-9fe6464530f957ed38be9edc7a6d0cc47ab5b2df.tar.gz
chromium_src-9fe6464530f957ed38be9edc7a6d0cc47ab5b2df.tar.bz2
Clear out the vbox before adding a new widget.
This prevents the weird issue where gtk tries to pack both views into the box. It isn't optimal, though. This solution leaves the area blank since it clears the old renderer as soon as the new one is created instead of waiting until the new renderer has something to display. Review URL: http://codereview.chromium.org/27057 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@10223 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/tab_contents')
-rw-r--r--chrome/browser/tab_contents/web_contents_view_gtk.cc10
1 files changed, 10 insertions, 0 deletions
diff --git a/chrome/browser/tab_contents/web_contents_view_gtk.cc b/chrome/browser/tab_contents/web_contents_view_gtk.cc
index 3dd3ec3..c63d2bf 100644
--- a/chrome/browser/tab_contents/web_contents_view_gtk.cc
+++ b/chrome/browser/tab_contents/web_contents_view_gtk.cc
@@ -12,6 +12,15 @@
#include "chrome/browser/renderer_host/render_widget_host_view_gtk.h"
#include "chrome/browser/tab_contents/web_contents.h"
+namespace {
+
+// Callback used in WebContentsViewGtk::CreateViewForWidget().
+void RemoveWidget(GtkWidget* widget, void* container) {
+ gtk_container_remove(GTK_CONTAINER(container), widget);
+}
+
+} // namespace
+
// static
WebContentsView* WebContentsView::Create(WebContents* web_contents) {
return new WebContentsViewGtk(web_contents);
@@ -40,6 +49,7 @@ RenderWidgetHostView* WebContentsViewGtk::CreateViewForWidget(
RenderWidgetHostViewGtk* view =
new RenderWidgetHostViewGtk(render_widget_host);
gtk_widget_show(view->native_view());
+ gtk_container_foreach(GTK_CONTAINER(vbox_), RemoveWidget, vbox_);
gtk_box_pack_start(GTK_BOX(vbox_), view->native_view(), TRUE, TRUE, 0);
return view;
}