summaryrefslogtreecommitdiffstats
path: root/chrome/browser/cocoa/tab_view.mm
diff options
context:
space:
mode:
authordmaclach@chromium.org <dmaclach@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-12 20:12:49 +0000
committerdmaclach@chromium.org <dmaclach@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-12 20:12:49 +0000
commit0335b08e730b0ba14e2125da6bcdd8bc826b6853 (patch)
tree852bb43f445475b7beaef75ff7125138ba77af56 /chrome/browser/cocoa/tab_view.mm
parent5c71605ec69c83c5e9a54b3c0ba922ff4d15c957 (diff)
downloadchromium_src-0335b08e730b0ba14e2125da6bcdd8bc826b6853.zip
chromium_src-0335b08e730b0ba14e2125da6bcdd8bc826b6853.tar.gz
chromium_src-0335b08e730b0ba14e2125da6bcdd8bc826b6853.tar.bz2
Add support for observing tracking areas so that when tabs are moved underneath
our cursor, we highlight them correctly. BUG=27458, 13208, 21448 TEST=Create a pile of tabs. Select a middle one. Put your cursor in some other tab. Hit cmd-w a couple of times Watch to make sure highlights occur correctly in both the tabs and the close buttons. Review URL: http://codereview.chromium.org/386021 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@31814 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/cocoa/tab_view.mm')
-rw-r--r--chrome/browser/cocoa/tab_view.mm22
1 files changed, 22 insertions, 0 deletions
diff --git a/chrome/browser/cocoa/tab_view.mm b/chrome/browser/cocoa/tab_view.mm
index 6ad5a05..3106dd1 100644
--- a/chrome/browser/cocoa/tab_view.mm
+++ b/chrome/browser/cocoa/tab_view.mm
@@ -116,6 +116,28 @@ static const NSTimeInterval kAnimationHideDuration = 0.4;
}
}
+// The tracking areas have been moved. Make sure that the close button is
+// highlighting correctly with respect to the cursor position with the new
+// tracking area locations.
+- (void)updateTrackingAreas {
+ [super updateTrackingAreas];
+
+ // Update the close buttons if the tab has moved.
+ NSPoint mouseLoc = [[self window] mouseLocationOutsideOfEventStream];
+ mouseLoc = [self convertPointFromBase:mouseLoc];
+ NSString* name = nil;
+ if (NSPointInRect(mouseLoc, [closeButton_ frame])) {
+ name = @"close_bar_h.pdf";
+ } else {
+ name = @"close_bar.pdf";
+ }
+ NSImage* newImage = nsimage_cache::ImageNamed(name);
+ NSImage* buttonImage = [closeButton_ image];
+ if (![buttonImage isEqual:newImage]) {
+ [closeButton_ setImage:newImage];
+ }
+}
+
// Determines which view a click in our frame actually hit. It's either this
// view or our child close button.
- (NSView*)hitTest:(NSPoint)aPoint {