From 0700c200bb205dde188c46096ca4c6bac3425b57 Mon Sep 17 00:00:00 2001 From: "pkasting@chromium.org" Date: Mon, 1 Dec 2008 23:54:12 +0000 Subject: Don't close tabs on middle-click when the release happens off the tab. Patch by Mohamed Mansour, r=ben. See http://codereview.chromium.org/12816/ . BUG=1062 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@6184 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/browser/views/tabs/tab.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'chrome/browser/views/tabs') diff --git a/chrome/browser/views/tabs/tab.cc b/chrome/browser/views/tabs/tab.cc index d4b28ac..8a23f20 100644 --- a/chrome/browser/views/tabs/tab.cc +++ b/chrome/browser/views/tabs/tab.cc @@ -156,7 +156,11 @@ void Tab::OnMouseReleased(const views::MouseEvent& event, bool canceled) { // Notify the drag helper that we're done with any potential drag operations. // Clean up the drag helper, which is re-created on the next mouse press. delegate_->EndDrag(canceled); - if (event.IsMiddleMouseButton()) + + // Close tabs on middle click, but only if the button is released over the tab + // (normal windows behavior is to discard presses of a UI element where the + // releases happen off the element). + if (event.IsMiddleMouseButton() && HitTest(event.location())) delegate_->CloseTab(this); } -- cgit v1.1