From 1894c45056cc5d0ce54f850f670a94bf3c7ce4d5 Mon Sep 17 00:00:00 2001 From: "rohitrao@chromium.org" Date: Thu, 30 Apr 2009 20:58:19 +0000 Subject: Changes the way we calculate hit rects in TabView to reduce overlap between tabs. TEST=Open a few tabs, try clicking on the right half of the close button that's to the left of the selected tab. Review URL: http://codereview.chromium.org/99225 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@14990 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/browser/cocoa/tab_view.mm | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'chrome/browser/cocoa/tab_view.mm') diff --git a/chrome/browser/cocoa/tab_view.mm b/chrome/browser/cocoa/tab_view.mm index 01f30e6..c8ce90d 100644 --- a/chrome/browser/cocoa/tab_view.mm +++ b/chrome/browser/cocoa/tab_view.mm @@ -32,8 +32,16 @@ // view or our child close button. - (NSView *)hitTest:(NSPoint)aPoint { NSPoint viewPoint = [self convertPoint:aPoint fromView:[self superview]]; + NSRect frame = [self frame]; + + // Reduce the width of the hit rect slightly to remove the overlap + // between adjacent tabs. The drawing code in TabCell has the top + // corners of the tab inset by height*2/3, so we inset by half of + // that here. This doesn't completely eliminate the overlap, but it + // works well enough. + NSRect hitRect = NSInsetRect(frame, frame.size.height / 3.0f, 0); if (NSPointInRect(viewPoint, [closeButton_ frame])) return closeButton_; - if (NSPointInRect(aPoint, [self frame])) return self; + if (NSPointInRect(aPoint, hitRect)) return self; return nil; } -- cgit v1.1