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

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

Issue 380010: [Mac] Fix a leak in HyperlinkButtonCell (Closed)
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
« no previous file with comments | « no previous file | tools/valgrind/memcheck/suppressions_mac.txt » ('j') | 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/hyperlink_button_cell.h" 5 #import "chrome/browser/cocoa/hyperlink_button_cell.h"
6 6
7 @interface HyperlinkButtonCell (Private) 7 @interface HyperlinkButtonCell (Private)
8 - (NSDictionary*)linkAttributres; 8 - (NSDictionary*)linkAttributres;
9 - (void)customizeButtonCell; 9 - (void)customizeButtonCell;
10 @end 10 @end
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 [self setHighlightsBy:NSNoCellMask]; 55 [self setHighlightsBy:NSNoCellMask];
56 56
57 // We need to set this so that we can override |-mouseEntered:| and 57 // We need to set this so that we can override |-mouseEntered:| and
58 // |-mouseExited:| to change the cursor style on hover states. 58 // |-mouseExited:| to change the cursor style on hover states.
59 [self setShowsBorderOnlyWhileMouseInside:YES]; 59 [self setShowsBorderOnlyWhileMouseInside:YES];
60 } 60 }
61 61
62 // Creates the NSDictionary of attributes for the attributed string. 62 // Creates the NSDictionary of attributes for the attributed string.
63 - (NSDictionary*)linkAttributes { 63 - (NSDictionary*)linkAttributes {
64 NSUInteger underlineMask = NSUnderlinePatternSolid | NSUnderlineStyleSingle; 64 NSUInteger underlineMask = NSUnderlinePatternSolid | NSUnderlineStyleSingle;
65 NSMutableParagraphStyle* paragraphStyle = 65 NSMutableParagraphStyle* paragraphStyle =
pink (ping after 24hrs) 2009/11/11 17:00:33 the best (and more consistent) fix here would be t
66 [[NSParagraphStyle defaultParagraphStyle] mutableCopy]; 66 [[[NSParagraphStyle defaultParagraphStyle] mutableCopy] autorelease];
67 [paragraphStyle setAlignment:[self alignment]]; 67 [paragraphStyle setAlignment:[self alignment]];
68 68
69 return [NSDictionary dictionaryWithObjectsAndKeys: 69 return [NSDictionary dictionaryWithObjectsAndKeys:
70 [self textColor], NSForegroundColorAttributeName, 70 [self textColor], NSForegroundColorAttributeName,
71 [NSNumber numberWithInt:underlineMask], NSUnderlineStyleAttributeName, 71 [NSNumber numberWithInt:underlineMask], NSUnderlineStyleAttributeName,
72 [self font], NSFontAttributeName, 72 [self font], NSFontAttributeName,
73 [NSCursor pointingHandCursor], NSCursorAttributeName, 73 [NSCursor pointingHandCursor], NSCursorAttributeName,
74 paragraphStyle, NSParagraphStyleAttributeName, 74 paragraphStyle, NSParagraphStyleAttributeName,
75 nil 75 nil
76 ]; 76 ];
(...skipping 23 matching lines...) Expand all
100 // Setters and getters. 100 // Setters and getters.
101 - (NSColor*)textColor { 101 - (NSColor*)textColor {
102 return textColor_.get(); 102 return textColor_.get();
103 } 103 }
104 104
105 - (void)setTextColor:(NSColor*)color { 105 - (void)setTextColor:(NSColor*)color {
106 textColor_.reset([color retain]); 106 textColor_.reset([color retain]);
107 } 107 }
108 108
109 @end 109 @end
OLDNEW
« no previous file with comments | « no previous file | tools/valgrind/memcheck/suppressions_mac.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698