diff options
author | rohitrao@chromium.org <rohitrao@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-30 20:58:19 +0000 |
---|---|---|
committer | rohitrao@chromium.org <rohitrao@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-30 20:58:19 +0000 |
commit | 1894c45056cc5d0ce54f850f670a94bf3c7ce4d5 (patch) | |
tree | b552e8976f8a580a660f87ef27f79833bb0b6f41 /chrome/browser/cocoa/tab_view.mm | |
parent | cd8c47902d23091ed28cc9aacb07cbccef7dd673 (diff) | |
download | chromium_src-1894c45056cc5d0ce54f850f670a94bf3c7ce4d5.zip chromium_src-1894c45056cc5d0ce54f850f670a94bf3c7ce4d5.tar.gz chromium_src-1894c45056cc5d0ce54f850f670a94bf3c7ce4d5.tar.bz2 |
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
Diffstat (limited to 'chrome/browser/cocoa/tab_view.mm')
-rw-r--r-- | chrome/browser/cocoa/tab_view.mm | 10 |
1 files changed, 9 insertions, 1 deletions
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; } |