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

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

Issue 7598002: Fix up close button on mac not centering vertically in the download shelf in fullscreen. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rounded Created 9 years, 4 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 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/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 a45272c1ad17f73ffc7b9bed6cd4e520d525d965..b50cada4ebd6c84c2210635989110d4a4c69b728 100644
--- a/chrome/browser/ui/cocoa/hover_close_button.mm
+++ b/chrome/browser/ui/cocoa/hover_close_button.mm
@@ -135,19 +135,26 @@ NSString* const kFadeOutValueKeyPath = @"fadeOutValue";
}
- (void)drawRect:(NSRect)dirtyRect {
+ // Close boxes align left horizontally, and align center vertically.
+ // http:crbug.com/14739 requires this.
NSRect imageRect = NSZeroRect;
imageRect.size = [gHoverMouseOverImage size];
+ NSRect destRect = [self bounds];
+ destRect.origin.y = floor((NSHeight(destRect) / 2)
+ - (NSHeight(imageRect) / 2));
+ destRect.size = imageRect.size;
+
switch(self.hoverState) {
case kHoverStateMouseOver:
- [gHoverMouseOverImage drawInRect:imageRect
+ [gHoverMouseOverImage drawInRect:destRect
fromRect:imageRect
operation:NSCompositeSourceOver
fraction:1.0];
break;
case kHoverStateMouseDown:
- [gHoverMouseDownImage drawInRect:imageRect
+ [gHoverMouseDownImage drawInRect:destRect
fromRect:imageRect
operation:NSCompositeSourceOver
fraction:1.0];
@@ -164,12 +171,12 @@ NSString* const kFadeOutValueKeyPath = @"fadeOutValue";
} else {
previousImage = gHoverMouseDownImage;
}
- [previousImage drawInRect:imageRect
+ [previousImage drawInRect:destRect
fromRect:imageRect
operation:NSCompositeSourceOver
fraction:1.0 - value];
}
- [gHoverNoneImage drawInRect:imageRect
+ [gHoverNoneImage drawInRect:destRect
fromRect:imageRect
operation:NSCompositeSourceOver
fraction:value];
« 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