| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "ui/base/cocoa/controls/hyperlink_button_cell.h" | 5 #import "ui/base/cocoa/controls/hyperlink_button_cell.h" |
| 6 | 6 |
| 7 using hyperlink_button_cell::UnderlineBehavior; | 7 using hyperlink_button_cell::UnderlineBehavior; |
| 8 | 8 |
| 9 @interface HyperlinkButtonCell () | 9 @interface HyperlinkButtonCell () |
| 10 - (void)customizeButtonCell; | 10 - (void)customizeButtonCell; |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 [self setShowsBorderOnlyWhileMouseInside:YES]; | 84 [self setShowsBorderOnlyWhileMouseInside:YES]; |
| 85 } | 85 } |
| 86 | 86 |
| 87 - (void)setControlSize:(NSControlSize)size { | 87 - (void)setControlSize:(NSControlSize)size { |
| 88 [super setControlSize:size]; | 88 [super setControlSize:size]; |
| 89 [self customizeButtonCell]; // recompute |font|. | 89 [self customizeButtonCell]; // recompute |font|. |
| 90 } | 90 } |
| 91 | 91 |
| 92 // Creates the NSDictionary of attributes for the attributed string. | 92 // Creates the NSDictionary of attributes for the attributed string. |
| 93 - (NSDictionary*)linkAttributes { | 93 - (NSDictionary*)linkAttributes { |
| 94 NSUInteger underlineMask = NSNoUnderlineStyle; | 94 NSUInteger underlineMask = NSUnderlineStyleNone; |
| 95 if (underlineBehavior_ == UnderlineBehavior::ALWAYS || | 95 if (underlineBehavior_ == UnderlineBehavior::ALWAYS || |
| 96 (mouseIsInside_ && [self isEnabled] && | 96 (mouseIsInside_ && [self isEnabled] && |
| 97 underlineBehavior_ == UnderlineBehavior::ON_HOVER)) { | 97 underlineBehavior_ == UnderlineBehavior::ON_HOVER)) { |
| 98 underlineMask = NSUnderlinePatternSolid | NSUnderlineStyleSingle; | 98 underlineMask = NSUnderlinePatternSolid | NSUnderlineStyleSingle; |
| 99 } | 99 } |
| 100 | 100 |
| 101 base::scoped_nsobject<NSMutableParagraphStyle> paragraphStyle( | 101 base::scoped_nsobject<NSMutableParagraphStyle> paragraphStyle( |
| 102 [[NSParagraphStyle defaultParagraphStyle] mutableCopy]); | 102 [[NSParagraphStyle defaultParagraphStyle] mutableCopy]); |
| 103 [paragraphStyle setAlignment:[self alignment]]; | 103 [paragraphStyle setAlignment:[self alignment]]; |
| 104 [paragraphStyle setLineBreakMode:[self lineBreakMode]]; | 104 [paragraphStyle setLineBreakMode:[self lineBreakMode]]; |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 } | 158 } |
| 159 | 159 |
| 160 // Override so that |-sizeToFit| works better with this type of cell. | 160 // Override so that |-sizeToFit| works better with this type of cell. |
| 161 - (NSSize)cellSize { | 161 - (NSSize)cellSize { |
| 162 NSSize size = [super cellSize]; | 162 NSSize size = [super cellSize]; |
| 163 size.width += 2; | 163 size.width += 2; |
| 164 return size; | 164 return size; |
| 165 } | 165 } |
| 166 | 166 |
| 167 @end | 167 @end |
| OLD | NEW |