diff options
author | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-07 16:40:15 +0000 |
---|---|---|
committer | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-07 16:40:15 +0000 |
commit | 8979ccea27f79faf5bee441547600a95c8eedce4 (patch) | |
tree | d1556a6cc2e31d737cffe079508e75a98c03a64c /chrome/browser/views/tabs/base_tab_strip.cc | |
parent | 0e76c9c9a560fd966c8f06719331179502a350ce (diff) | |
download | chromium_src-8979ccea27f79faf5bee441547600a95c8eedce4.zip chromium_src-8979ccea27f79faf5bee441547600a95c8eedce4.tar.gz chromium_src-8979ccea27f79faf5bee441547600a95c8eedce4.tar.bz2 |
Improves responsiveness when rapdily clicking to close tabs. If the
tab is already closing it's possible for the tab to no longer contain
the coordinates of the release event. I've changed it so that if the
tab is closing and the tab doesn't contain the mouse on the release
event we see if another tab does and if so close it.
BUG=48209
TEST=none
Review URL: http://codereview.chromium.org/2841038
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@51723 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/views/tabs/base_tab_strip.cc')
-rw-r--r-- | chrome/browser/views/tabs/base_tab_strip.cc | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/chrome/browser/views/tabs/base_tab_strip.cc b/chrome/browser/views/tabs/base_tab_strip.cc index 316f038..4e95535 100644 --- a/chrome/browser/views/tabs/base_tab_strip.cc +++ b/chrome/browser/views/tabs/base_tab_strip.cc @@ -5,6 +5,7 @@ #include "chrome/browser/views/tabs/base_tab_strip.h" #include "base/logging.h" +#include "chrome/browser/view_ids.h" #include "chrome/browser/views/tabs/dragged_tab_controller.h" #include "chrome/browser/views/tabs/tab_strip_controller.h" #include "views/widget/root_view.h" @@ -308,6 +309,22 @@ bool BaseTabStrip::EndDrag(bool canceled) { return started_drag; } +BaseTab* BaseTabStrip::GetTabAt(BaseTab* tab, + const gfx::Point& tab_in_tab_coordinates) { + gfx::Point local_point = tab_in_tab_coordinates; + ConvertPointToView(tab, this, &local_point); + views::View* view = GetViewForPoint(local_point); + if (!view) + return NULL; // No tab contains the point. + + // Walk up the view hierarchy until we find a tab, or the TabStrip. + while (view && view != this && view->GetID() != VIEW_ID_TAB) + view = view->GetParent(); + + return view && view->GetID() == VIEW_ID_TAB ? + static_cast<BaseTab*>(view) : NULL; +} + void BaseTabStrip::Layout() { StopAnimating(false); |