summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-28 22:57:48 +0000
committerjhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-28 22:57:48 +0000
commit74feab233e90553d9e52a97a355a6d004225be1f (patch)
tree502fb1a2dd223d865f8e99bb6916cb2f7e6e2edb
parentd35aea25a87c33247ebe8bbc06f0f1771cce2be8 (diff)
downloadchromium_src-74feab233e90553d9e52a97a355a6d004225be1f.zip
chromium_src-74feab233e90553d9e52a97a355a6d004225be1f.tar.gz
chromium_src-74feab233e90553d9e52a97a355a6d004225be1f.tar.bz2
Fix the case where a previous tab is closing and the mouse is pressed on a tab to the right of the closing tab.
Review URL: http://codereview.chromium.org/100116 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@14792 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/gtk/tabs/tab_strip_gtk.cc13
1 files changed, 12 insertions, 1 deletions
diff --git a/chrome/browser/gtk/tabs/tab_strip_gtk.cc b/chrome/browser/gtk/tabs/tab_strip_gtk.cc
index d3da0f2..c72824c 100644
--- a/chrome/browser/gtk/tabs/tab_strip_gtk.cc
+++ b/chrome/browser/gtk/tabs/tab_strip_gtk.cc
@@ -1179,11 +1179,17 @@ gboolean TabStripGtk::OnMotionNotify(GtkWidget* widget, GdkEventMotion* event,
// static
gboolean TabStripGtk::OnMousePress(GtkWidget* widget, GdkEventButton* event,
TabStripGtk* tabstrip) {
+ gfx::Point point(event->x, event->y);
+
// Nothing happens on mouse press for middle and right click.
if (event->button != 1)
return TRUE;
- gfx::Point point(event->x, event->y);
+ // The hover index is stale if we're in the middle of an animation and the
+ // mouse is pressed without any movement.
+ if (tabstrip->active_animation_.get())
+ tabstrip->hover_index_ = tabstrip->FindTabHoverIndexIterative(point);
+
if (tabstrip->hover_index_ == -1) {
if (tabstrip->newtab_button_.get()->IsPointInBounds(point) &&
tabstrip->newtab_button_.get()->OnMousePress())
@@ -1193,6 +1199,11 @@ gboolean TabStripGtk::OnMousePress(GtkWidget* widget, GdkEventButton* event,
}
TabGtk* tab = tabstrip->GetTabAt(tabstrip->hover_index_);
+
+ // If a previous tab is closing, the hover index does not match the model
+ // index.
+ tabstrip->hover_index_ = tabstrip->GetIndexOfTab(tab);
+
if (tab->OnMousePress(point)) {
gtk_widget_queue_draw(tabstrip->tabstrip_.get());
} else if (tabstrip->hover_index_ != tabstrip->model()->selected_index() &&