Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7840)

Unified Diff: chrome/browser/ui/cocoa/gradient_button_cell.mm

Issue 5729003: Mac: Fix stuck hover state in bookmark button... (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: Created 10 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/cocoa/gradient_button_cell.mm
===================================================================
--- chrome/browser/ui/cocoa/gradient_button_cell.mm (revision 68678)
+++ chrome/browser/ui/cocoa/gradient_button_cell.mm (working copy)
@@ -28,6 +28,7 @@
innerPath:(NSBezierPath**)returnInnerPath
clipPath:(NSBezierPath**)returnClipPath;
+- (void)updateTrackingAreas;
@end
@@ -320,21 +321,16 @@
if (showOnly) {
if (trackingArea_.get()) {
[self setShowsBorderOnlyWhileMouseInside:NO];
- [[self controlView] removeTrackingArea:trackingArea_];
}
- trackingArea_.reset([[NSTrackingArea alloc]
- initWithRect:[[self controlView]
- bounds]
- options:(NSTrackingMouseEnteredAndExited |
- NSTrackingActiveInActiveApp)
- owner:self
- userInfo:nil]);
- [[self controlView] addTrackingArea:trackingArea_];
+ [self updateTrackingAreas];
} else {
if (trackingArea_) {
[[self controlView] removeTrackingArea:trackingArea_];
trackingArea_.reset(nil);
- isMouseInside_ = NO;
+ if (isMouseInside_) {
+ isMouseInside_ = NO;
+ [[self controlView] setNeedsDisplay:YES];
+ }
}
}
}
@@ -716,4 +712,45 @@
return boundingPath;
}
+- (void)resetCursorRect:(NSRect)cellFrame inView:(NSView *)controlView
+{
mrossetti 2010/12/10 18:12:49 Move brace up to end of previous line.
Leib 2010/12/13 17:32:00 Done.
+ [super resetCursorRect:cellFrame inView:controlView];
+ if (trackingArea_) {
mrossetti 2010/12/10 18:12:49 Note that braces are optional for single-line if b
Leib 2010/12/13 17:32:00 Done.
+ [self updateTrackingAreas];
+ }
+}
+
+- (void)updateTrackingAreas
+{
mrossetti 2010/12/10 18:12:49 Brace up to previous line.
Leib 2010/12/13 17:32:00 Done.
+ BOOL mouseInView = NO;
+ NSView *controlView = [self controlView];
mrossetti 2010/12/10 18:12:49 Asterisks precede the space in Chromium.
Leib 2010/12/13 17:32:00 Done.
+ NSWindow *window = [controlView window];
mrossetti 2010/12/10 18:12:49 Move asterisk to before the space.
Leib 2010/12/13 17:32:00 Done.
+ NSRect bounds = [controlView bounds];
+ if (window) {
+ NSPoint mousePoint = [window mouseLocationOutsideOfEventStream];
+ mousePoint = [controlView convertPointFromBase:mousePoint];
+ mouseInView = [controlView mouse:mousePoint inRect:bounds];
+ }
+
+ if (trackingArea_.get()) {
+ [controlView removeTrackingArea:trackingArea_];
+ }
+
+ NSTrackingAreaOptions options = NSTrackingMouseEnteredAndExited |
+ NSTrackingActiveInActiveApp;
+ if (mouseInView) {
+ options |= NSTrackingAssumeInside;
+ }
+
+ trackingArea_.reset([[NSTrackingArea alloc]
+ initWithRect:bounds
+ options:options
+ owner:self
+ userInfo:nil]);
+ if (isMouseInside_ != mouseInView) {
+ isMouseInside_ = mouseInView;
+ [controlView setNeedsDisplay:YES];
+ }
+}
+
@end
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698