Chromium Code Reviews| Index: chrome/browser/ui/cocoa/hover_close_button.mm |
| diff --git a/chrome/browser/ui/cocoa/hover_close_button.mm b/chrome/browser/ui/cocoa/hover_close_button.mm |
| index 28322b4eae5c3d77c07bd4afa9e906a6a59b680d..b09abe79d72035bf1d89de830b8ebe45b9566b22 100644 |
| --- a/chrome/browser/ui/cocoa/hover_close_button.mm |
| +++ b/chrome/browser/ui/cocoa/hover_close_button.mm |
| @@ -79,6 +79,24 @@ NSString* const kFadeOutValueKeyPath = @"fadeOutValue"; |
| [self animationDidStop:animation]; |
| } |
| +// Override to only accept clicks within the bounds of the defined path, not |
| +// the entire bounding box. |aPoint| is in the superview's coordinate system. |
| +- (NSView*)hitTest:(NSPoint)point { |
| + NSPoint localPoint = [self convertPoint:point fromView:[self superview]]; |
| + NSRect pointRect = NSMakeRect(localPoint.x, localPoint.y, 1, 1); |
| + |
| + NSImage* hoverImage = [self imageForHoverState:kHoverStateMouseOver]; |
| + NSRect destinationRect = NSMakeRect( |
| + 0, 0, NSWidth([self bounds]), NSHeight([self bounds])); |
|
sail
2013/01/10 17:57:19
All our code already assumes that [self bounds] ha
Nico
2013/01/10 23:26:51
Done, thanks.
|
| + if ([hoverImage hitTestRect:pointRect |
| + withImageDestinationRect:destinationRect |
| + context:nil |
| + hints:nil |
| + flipped:YES]) |
| + return [super hitTest:point]; |
| + return nil; |
| +} |
| + |
| - (void)drawRect:(NSRect)dirtyRect { |
| NSImage* image = [self imageForHoverState:[self hoverState]]; |