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

Side by Side Diff: chrome/browser/cocoa/tab_view.mm

Issue 384100: Revert 31814 - Testing to see if it caused performance problems.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 11 years, 1 month 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/cocoa/tab_strip_controller.mm ('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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 #import "chrome/browser/cocoa/tab_view.h" 5 #import "chrome/browser/cocoa/tab_view.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/nsimage_cache_mac.h" 8 #include "base/nsimage_cache_mac.h"
9 #import "chrome/browser/cocoa/tab_controller.h" 9 #import "chrome/browser/cocoa/tab_controller.h"
10 #import "chrome/browser/cocoa/tab_window_controller.h" 10 #import "chrome/browser/cocoa/tab_window_controller.h"
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 if ([theEvent trackingArea] == closeTrackingArea_) { 109 if ([theEvent trackingArea] == closeTrackingArea_) {
110 [closeButton_ setImage:nsimage_cache::ImageNamed(@"close_bar.pdf")]; 110 [closeButton_ setImage:nsimage_cache::ImageNamed(@"close_bar.pdf")];
111 } else { 111 } else {
112 lastHoverUpdate_ = [NSDate timeIntervalSinceReferenceDate]; 112 lastHoverUpdate_ = [NSDate timeIntervalSinceReferenceDate];
113 isMouseInside_ = NO; 113 isMouseInside_ = NO;
114 [self adjustHoverValue]; 114 [self adjustHoverValue];
115 [self setNeedsDisplay:YES]; 115 [self setNeedsDisplay:YES];
116 } 116 }
117 } 117 }
118 118
119 // The tracking areas have been moved. Make sure that the close button is
120 // highlighting correctly with respect to the cursor position with the new
121 // tracking area locations.
122 - (void)updateTrackingAreas {
123 [super updateTrackingAreas];
124
125 // Update the close buttons if the tab has moved.
126 NSPoint mouseLoc = [[self window] mouseLocationOutsideOfEventStream];
127 mouseLoc = [self convertPointFromBase:mouseLoc];
128 NSString* name = nil;
129 if (NSPointInRect(mouseLoc, [closeButton_ frame])) {
130 name = @"close_bar_h.pdf";
131 } else {
132 name = @"close_bar.pdf";
133 }
134 NSImage* newImage = nsimage_cache::ImageNamed(name);
135 NSImage* buttonImage = [closeButton_ image];
136 if (![buttonImage isEqual:newImage]) {
137 [closeButton_ setImage:newImage];
138 }
139 }
140
141 // Determines which view a click in our frame actually hit. It's either this 119 // Determines which view a click in our frame actually hit. It's either this
142 // view or our child close button. 120 // view or our child close button.
143 - (NSView*)hitTest:(NSPoint)aPoint { 121 - (NSView*)hitTest:(NSPoint)aPoint {
144 NSPoint viewPoint = [self convertPoint:aPoint fromView:[self superview]]; 122 NSPoint viewPoint = [self convertPoint:aPoint fromView:[self superview]];
145 NSRect frame = [self frame]; 123 NSRect frame = [self frame];
146 124
147 // Reduce the width of the hit rect slightly to remove the overlap 125 // Reduce the width of the hit rect slightly to remove the overlap
148 // between adjacent tabs. The drawing code in TabCell has the top 126 // between adjacent tabs. The drawing code in TabCell has the top
149 // corners of the tab inset by height*2/3, so we inset by half of 127 // corners of the tab inset by height*2/3, so we inset by half of
150 // that here. This doesn't completely eliminate the overlap, but it 128 // that here. This doesn't completely eliminate the overlap, but it
(...skipping 640 matching lines...) Expand 10 before | Expand all | Expand 10 after
791 } 769 }
792 770
793 - (void)viewDidMoveToWindow { 771 - (void)viewDidMoveToWindow {
794 [super viewDidMoveToWindow]; 772 [super viewDidMoveToWindow];
795 if ([self window]) { 773 if ([self window]) {
796 [controller_ updateTitleColor]; 774 [controller_ updateTitleColor];
797 } 775 }
798 } 776 }
799 777
800 @end 778 @end
OLDNEW
« no previous file with comments | « chrome/browser/cocoa/tab_strip_controller.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698