diff options
author | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-18 21:32:01 +0000 |
---|---|---|
committer | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-18 21:32:01 +0000 |
commit | a77c2c5fb4a72ba4234fd6f3ae5c28c14428d3e4 (patch) | |
tree | 5c3a4b845cfe50c039cf4b0ebcb73f6ca2fce488 /chrome/browser/gtk/tab_contents_container_gtk.cc | |
parent | 98a91eebe63ab55dd345e6f197aad55da4e9f7b0 (diff) | |
download | chromium_src-a77c2c5fb4a72ba4234fd6f3ae5c28c14428d3e4.zip chromium_src-a77c2c5fb4a72ba4234fd6f3ae5c28c14428d3e4.tar.gz chromium_src-a77c2c5fb4a72ba4234fd6f3ae5c28c14428d3e4.tar.bz2 |
Linux: Don't unparent unselected tab contentses.
Instead, hide them. Sometimes an unselected tab contents can get unhandled keyboard events after it's been deselected (if the renderer was really slow in handling and returning the event).
http://crbug.com/12178
Review URL: http://codereview.chromium.org/113545
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@16329 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/gtk/tab_contents_container_gtk.cc')
-rw-r--r-- | chrome/browser/gtk/tab_contents_container_gtk.cc | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/chrome/browser/gtk/tab_contents_container_gtk.cc b/chrome/browser/gtk/tab_contents_container_gtk.cc index ef4db61..be8fe19 100644 --- a/chrome/browser/gtk/tab_contents_container_gtk.cc +++ b/chrome/browser/gtk/tab_contents_container_gtk.cc @@ -28,7 +28,7 @@ void TabContentsContainerGtk::SetTabContents(TabContents* tab_contents) { if (tab_contents_) { gfx::NativeView widget = tab_contents_->GetNativeView(); if (widget) - gtk_container_remove(GTK_CONTAINER(vbox_), widget); + gtk_widget_hide(widget); tab_contents_->WasHidden(); @@ -44,9 +44,12 @@ void TabContentsContainerGtk::SetTabContents(TabContents* tab_contents) { gfx::NativeView widget = tab_contents_->GetNativeView(); if (widget) { - gtk_box_pack_end(GTK_BOX(vbox_), widget, TRUE, TRUE, 0); + // Pack it into |vbox_| if it isn't already. + if (widget->parent != vbox_) + gtk_box_pack_end(GTK_BOX(vbox_), widget, TRUE, TRUE, 0); gtk_widget_show(widget); } + // We need to make sure that we are below the findbar. // Sometimes the content native view will be null. // TODO(estade): will this case ever cause findbar occlusion problems? @@ -59,6 +62,14 @@ void TabContentsContainerGtk::SetTabContents(TabContents* tab_contents) { } } +void TabContentsContainerGtk::DetachTabContents(TabContents* tab_contents) { + gfx::NativeView widget = tab_contents_->GetNativeView(); + if (widget) { + DCHECK_EQ(widget->parent, vbox_); + gtk_container_remove(GTK_CONTAINER(vbox_), widget); + } +} + void TabContentsContainerGtk::Observe(NotificationType type, const NotificationSource& source, const NotificationDetails& details) { |