| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/ui/cocoa/download/download_show_all_button.h" | 5 #import "chrome/browser/ui/cocoa/download/download_show_all_button.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #import "chrome/browser/ui/cocoa/download/download_show_all_cell.h" | 8 #import "chrome/browser/ui/cocoa/download/download_show_all_cell.h" |
| 9 #import "chrome/browser/ui/cocoa/view_id_util.h" | 9 #import "chrome/browser/ui/cocoa/view_id_util.h" |
| 10 #include "grit/theme_resources.h" | 10 #include "grit/theme_resources.h" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 } | 37 } |
| 38 | 38 |
| 39 - (BOOL)isOpaque { | 39 - (BOOL)isOpaque { |
| 40 // Make this control opaque so that sub-pixel anti-aliasing works when | 40 // Make this control opaque so that sub-pixel anti-aliasing works when |
| 41 // CoreAnimation is enabled. | 41 // CoreAnimation is enabled. |
| 42 return YES; | 42 return YES; |
| 43 } | 43 } |
| 44 | 44 |
| 45 - (void)drawRect:(NSRect)rect { | 45 - (void)drawRect:(NSRect)rect { |
| 46 NSView* downloadShelfView = [self ancestorWithViewID:VIEW_ID_DOWNLOAD_SHELF]; | 46 NSView* downloadShelfView = [self ancestorWithViewID:VIEW_ID_DOWNLOAD_SHELF]; |
| 47 [self cr_drawUsingAncestor:downloadShelfView inRect:rect]; | 47 // Previously the show all button used cr_drawUsingAncestor:inRect: to use |
| 48 // the download shelf to draw its background. However when the download |
| 49 // shelf has zero height, the shelf's drawing methods don't work as expected |
| 50 // because they constrain their drawing to the shelf's bounds rect. This |
| 51 // situation occurs sometimes when the shelf is about to become visible, |
| 52 // and the result is a very dark show all button |
| 53 // |
| 54 // To work around this problem, we'll call a variant of that method which |
| 55 // does restrict drawing to the ancestor view's bounds. |
| 56 [self cr_drawUsingAncestor:downloadShelfView |
| 57 inRect:rect |
| 58 clippedToAncestorBounds:NO]; |
| 48 [super drawRect:rect]; | 59 [super drawRect:rect]; |
| 49 } | 60 } |
| 50 | 61 |
| 51 // ThemedWindowDrawing implementation. | 62 // ThemedWindowDrawing implementation. |
| 52 | 63 |
| 53 - (void)windowDidChangeTheme { | 64 - (void)windowDidChangeTheme { |
| 54 [self setNeedsDisplay:YES]; | 65 [self setNeedsDisplay:YES]; |
| 55 } | 66 } |
| 56 | 67 |
| 57 - (void)windowDidChangeActive { | 68 - (void)windowDidChangeActive { |
| 58 [self setNeedsDisplay:YES]; | 69 [self setNeedsDisplay:YES]; |
| 59 } | 70 } |
| 60 | 71 |
| 61 @end | 72 @end |
| OLD | NEW |