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

Side by Side Diff: chrome/browser/ui/cocoa/gradient_button_cell.mm

Issue 6927001: Merge 84005 - Mac. Ensure no more than one visibly selected item in each bookmark folder menu. (Closed) Base URL: svn://svn.chromium.org/chrome/branches/742/src/
Patch Set: Created 9 years, 7 months 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/ui/cocoa/gradient_button_cell.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/cocoa/gradient_button_cell.h" 5 #include "chrome/browser/ui/cocoa/gradient_button_cell.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #import "base/memory/scoped_nsobject.h" 8 #import "base/memory/scoped_nsobject.h"
9 #import "chrome/browser/themes/theme_service.h" 9 #import "chrome/browser/themes/theme_service.h"
10 #import "chrome/browser/ui/cocoa/image_utils.h" 10 #import "chrome/browser/ui/cocoa/image_utils.h"
(...skipping 707 matching lines...) Expand 10 before | Expand all | Expand 10 after
718 clipPath:&boundingPath]; 718 clipPath:&boundingPath];
719 return boundingPath; 719 return boundingPath;
720 } 720 }
721 721
722 - (void)resetCursorRect:(NSRect)cellFrame inView:(NSView*)controlView { 722 - (void)resetCursorRect:(NSRect)cellFrame inView:(NSView*)controlView {
723 [super resetCursorRect:cellFrame inView:controlView]; 723 [super resetCursorRect:cellFrame inView:controlView];
724 if (trackingArea_) 724 if (trackingArea_)
725 [self updateTrackingAreas]; 725 [self updateTrackingAreas];
726 } 726 }
727 727
728 - (void)updateTrackingAreas { 728 - (BOOL)isMouseReallyInside {
729 BOOL mouseInView = NO; 729 BOOL mouseInView = NO;
730 NSView* controlView = [self controlView]; 730 NSView* controlView = [self controlView];
731 NSWindow* window = [controlView window]; 731 NSWindow* window = [controlView window];
732 NSRect bounds = [controlView bounds]; 732 NSRect bounds = [controlView bounds];
733 if (window) { 733 if (window) {
734 NSPoint mousePoint = [window mouseLocationOutsideOfEventStream]; 734 NSPoint mousePoint = [window mouseLocationOutsideOfEventStream];
735 mousePoint = [controlView convertPointFromBase:mousePoint]; 735 mousePoint = [controlView convertPointFromBase:mousePoint];
736 mouseInView = [controlView mouse:mousePoint inRect:bounds]; 736 mouseInView = [controlView mouse:mousePoint inRect:bounds];
737 } 737 }
738 return mouseInView;
739 }
740
741 - (void)updateTrackingAreas {
742 NSView* controlView = [self controlView];
743 BOOL mouseInView = [self isMouseReallyInside];
738 744
739 if (trackingArea_.get()) 745 if (trackingArea_.get())
740 [controlView removeTrackingArea:trackingArea_]; 746 [controlView removeTrackingArea:trackingArea_];
741 747
742 NSTrackingAreaOptions options = NSTrackingMouseEnteredAndExited | 748 NSTrackingAreaOptions options = NSTrackingMouseEnteredAndExited |
743 NSTrackingActiveInActiveApp; 749 NSTrackingActiveInActiveApp;
744 if (mouseInView) 750 if (mouseInView)
745 options |= NSTrackingAssumeInside; 751 options |= NSTrackingAssumeInside;
746 752
747 trackingArea_.reset([[NSTrackingArea alloc] 753 trackingArea_.reset([[NSTrackingArea alloc]
748 initWithRect:bounds 754 initWithRect:[controlView bounds]
749 options:options 755 options:options
750 owner:self 756 owner:self
751 userInfo:nil]); 757 userInfo:nil]);
752 if (isMouseInside_ != mouseInView) { 758 if (isMouseInside_ != mouseInView) {
753 isMouseInside_ = mouseInView; 759 [self setMouseInside:mouseInView animate:NO];
754 [controlView setNeedsDisplay:YES]; 760 [controlView setNeedsDisplay:YES];
755 } 761 }
756 } 762 }
757 763
758 @end 764 @end
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/gradient_button_cell.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698