summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-18 21:32:01 +0000
committerestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-18 21:32:01 +0000
commita77c2c5fb4a72ba4234fd6f3ae5c28c14428d3e4 (patch)
tree5c3a4b845cfe50c039cf4b0ebcb73f6ca2fce488 /chrome
parent98a91eebe63ab55dd345e6f197aad55da4e9f7b0 (diff)
downloadchromium_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')
-rw-r--r--chrome/browser/gtk/browser_window_gtk.cc5
-rw-r--r--chrome/browser/gtk/tab_contents_container_gtk.cc15
-rw-r--r--chrome/browser/gtk/tab_contents_container_gtk.h3
3 files changed, 18 insertions, 5 deletions
diff --git a/chrome/browser/gtk/browser_window_gtk.cc b/chrome/browser/gtk/browser_window_gtk.cc
index 49fc667..8417e64 100644
--- a/chrome/browser/gtk/browser_window_gtk.cc
+++ b/chrome/browser/gtk/browser_window_gtk.cc
@@ -619,10 +619,9 @@ void BrowserWindowGtk::TabDetachedAt(TabContents* contents, int index) {
// We use index here rather than comparing |contents| because by this time
// the model has already removed |contents| from its list, so
// browser_->GetSelectedTabContents() will return NULL or something else.
- if (index == browser_->tabstrip_model()->selected_index()) {
+ if (index == browser_->tabstrip_model()->selected_index())
infobar_container_->ChangeTabContents(NULL);
- contents_container_->SetTabContents(NULL);
- }
+ contents_container_->DetachTabContents(contents);
}
// TODO(estade): this function should probably be unforked from the BrowserView
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) {
diff --git a/chrome/browser/gtk/tab_contents_container_gtk.h b/chrome/browser/gtk/tab_contents_container_gtk.h
index 6b4697b..1cb72e5 100644
--- a/chrome/browser/gtk/tab_contents_container_gtk.h
+++ b/chrome/browser/gtk/tab_contents_container_gtk.h
@@ -25,6 +25,9 @@ class TabContentsContainerGtk : public NotificationObserver {
void SetTabContents(TabContents* tab_contents);
TabContents* GetTabContents() const { return tab_contents_; }
+ // Remove the tab from the hierarchy.
+ void DetachTabContents(TabContents* tab_contents);
+
// NotificationObserver implementation.
virtual void Observe(NotificationType type,
const NotificationSource& source,